diff options
author | Sage Weil <sage@inktank.com> | 2013-04-29 09:43:17 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-04-29 15:43:47 -0700 |
commit | 6a00f33251d8c5046f2b6de60d37c2d9bb203c42 (patch) | |
tree | e01f2fc57fc5ca7141439539c3602df1b8012b32 | |
parent | 29831f9662fea2877efa95b35d3bc7b187f0b0e5 (diff) | |
download | ceph-6a00f33251d8c5046f2b6de60d37c2d9bb203c42.tar.gz |
leveldb: add compact() method
This will compact the entire store; it will be slow!
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/mon/MonitorDBStore.h | 4 | ||||
-rw-r--r-- | src/os/LevelDBStore.h | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/mon/MonitorDBStore.h b/src/mon/MonitorDBStore.h index ac2703ec5e6..b14c5aaae46 100644 --- a/src/mon/MonitorDBStore.h +++ b/src/mon/MonitorDBStore.h @@ -456,6 +456,10 @@ class MonitorDBStore return db->create_and_open(out); } + void compact() { + db->compact(); + } + MonitorDBStore(const string& path) : db(0) { string::const_reverse_iterator rit; int pos = 0; diff --git a/src/os/LevelDBStore.h b/src/os/LevelDBStore.h index 6b1afceb753..9f8cd52ca9c 100644 --- a/src/os/LevelDBStore.h +++ b/src/os/LevelDBStore.h @@ -33,6 +33,11 @@ class LevelDBStore : public KeyValueDB { int init(ostream &out, bool create_if_missing); public: + /// compact the underlying leveldb store + void compact() { + db->CompactRange(NULL, NULL); + } + /** * options_t: Holds options which are minimally interpreted * on initialization and then passed through to LevelDB. |