]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
leveldb: add compact() method
authorSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 16:43:17 +0000 (09:43 -0700)
committerSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 22:43:47 +0000 (15:43 -0700)
This will compact the entire store; it will be slow!

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/MonitorDBStore.h
src/os/LevelDBStore.h

index ac2703ec5e65965c72c38038a2d7ca905a265d6d..b14c5aaae46aa0f7f54123ea5b0d592b9d9123e1 100644 (file)
@@ -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;
index 6b1afceb75377d10f104095aa15914feac427afb..9f8cd52ca9c758b0dbdcf62456d5421a14b801af 100644 (file)
@@ -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.