From 8780c762e2a681c12f403e58b28cb9c7c98963d2 Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sat, 5 Aug 2017 13:11:55 +0200 Subject: [PATCH] Merge #10985: Add undocumented -forcecompactdb to force LevelDB compactions 8842d1a Add undocumented -forcecompactdb to force LevelDB compactions (Pieter Wuille) Pull request description: Tree-SHA512: de91f3f574f75248fa6e5091089c840957fae5a972ebcd2b89493f7d777d4658560a6f5a3b43ab0c9b2c333ad98f9f185ae224c9caffc1a5e8df369cc414f123 --- src/dbwrapper.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/dbwrapper.cpp b/src/dbwrapper.cpp index 4a4bd41b3..e4518d198 100644 --- a/src/dbwrapper.cpp +++ b/src/dbwrapper.cpp @@ -115,6 +115,12 @@ CDBWrapper::CDBWrapper(const boost::filesystem::path& path, size_t nCacheSize, b dbwrapper_private::HandleError(status); LogPrintf("Opened LevelDB successfully\n"); + if (GetBoolArg("-forcecompactdb", false)) { + LogPrintf("Starting database compaction of %s\n", path.string()); + pdb->CompactRange(nullptr, nullptr); + LogPrintf("Finished database compaction of %s\n", path.string()); + } + // The base-case obfuscation key, which is a noop. obfuscate_key = std::vector(OBFUSCATE_KEY_NUM_BYTES, '\000');