Skip to content

Commit 8842d1a

Browse files
committed
Add undocumented -forcecompactdb to force LevelDB compactions
1 parent e222618 commit 8842d1a

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

contrib/devtools/check-doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
REGEX_ARG = re.compile(r'(?:map(?:Multi)?Args(?:\.count\(|\[)|Get(?:Bool)?Arg\()\"(\-[^\"]+?)\"')
2222
REGEX_DOC = re.compile(r'HelpMessageOpt\(\"(\-[^\"=]+?)(?:=|\")')
2323
# list unsupported, deprecated and duplicate args as they need no documentation
24-
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-dbcrashratio'])
24+
SET_DOC_OPTIONAL = set(['-rpcssl', '-benchmark', '-h', '-help', '-socks', '-tor', '-debugnet', '-whitelistalwaysrelay', '-prematurewitness', '-walletprematurewitness', '-promiscuousmempoolflags', '-blockminsize', '-dbcrashratio', '-forcecompactdb'])
2525

2626
def main():
2727
used = check_output(CMD_GREP_ARGS, shell=True)

src/dbwrapper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ CDBWrapper::CDBWrapper(const fs::path& path, size_t nCacheSize, bool fMemory, bo
115115
dbwrapper_private::HandleError(status);
116116
LogPrintf("Opened LevelDB successfully\n");
117117

118+
if (GetBoolArg("-forcecompactdb", false)) {
119+
LogPrintf("Starting database compaction of %s\n", path.string());
120+
pdb->CompactRange(nullptr, nullptr);
121+
LogPrintf("Finished database compaction of %s\n", path.string());
122+
}
123+
118124
// The base-case obfuscation key, which is a noop.
119125
obfuscate_key = std::vector<unsigned char>(OBFUSCATE_KEY_NUM_BYTES, '\000');
120126

0 commit comments

Comments
 (0)