From: Sage Weil Date: Mon, 29 Apr 2013 22:04:09 +0000 (-0700) Subject: mon: compact PaxosService prefix on trim X-Git-Tag: v0.61~32^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3cb4f6783ba63dd6c931a9fc5cd5feb9c0d4d837;p=ceph.git mon: compact PaxosService prefix on trim 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 --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index c8e634f46ac6..d78a7cc9d8ad 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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 diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index d02cb1d7ab56..647980a9342c 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -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)