]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: compact PaxosService prefix on trim
authorSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 22:04:09 +0000 (15:04 -0700)
committerSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 22:45:56 +0000 (15:45 -0700)
Each time we trim a PaxosService, have leveldb compact so that the
space from removed states is reclaimed.

This is probably not optimal if leveldb's heuristics are doing the right
thing, but it currently appears as if they are not.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/mon/PaxosService.cc

index c8e634f46ac6f5135267dfa1c348df1a5b02485a..d78a7cc9d8ad4b6d77471252bf7ba6ece00f34c2 100644 (file)
@@ -126,6 +126,7 @@ OPTION(mon_initial_members, OPT_STR, "")    // list of initial cluster mon ids;
 OPTION(mon_sync_fs_threshold, OPT_INT, 5)   // sync() when writing this many objects; 0 to disable.
 OPTION(mon_compact_on_start, OPT_BOOL, false)  // compact leveldb on ceph-mon start
 OPTION(mon_compact_on_bootstrap, OPT_BOOL, false)  // trigger leveldb compaction on bootstrap
+OPTION(mon_compact_on_trim, OPT_BOOL, false)       // compact (a prefix) when we trim old states
 OPTION(mon_tick_interval, OPT_INT, 5)
 OPTION(mon_subscribe_interval, OPT_DOUBLE, 300)
 OPTION(mon_osd_laggy_halflife, OPT_INT, 60*60)        // (seconds) how quickly our laggy estimations decay
index d02cb1d7ab56b8c3ab9f06340f645d25e864720e..647980a9342c229d1bb255513f795f926d9db20f 100644 (file)
@@ -318,6 +318,10 @@ void PaxosService::trim(MonitorDBStore::Transaction *t,
       t->erase(get_service_name(), full_key);
     }
   }
+  if (g_conf->mon_compact_on_trim) {
+    dout(20) << " compacting prefix " << get_service_name() << dendl;
+    t->compact_prefix(get_service_name());
+  }
 }
 
 void PaxosService::encode_trim(MonitorDBStore::Transaction *t)