summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-29 15:04:09 -0700
committerSage Weil <sage@inktank.com>2013-04-29 15:45:56 -0700
commit3cb4f6783ba63dd6c931a9fc5cd5feb9c0d4d837 (patch)
tree0becbcaa0e313b435ca0de22b313fb6aaa726f86
parente8c9824102f5b3e123a87ec7bfffa19fa278d7ca (diff)
downloadceph-3cb4f6783ba63dd6c931a9fc5cd5feb9c0d4d837.tar.gz
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 <sage@inktank.com>
-rw-r--r--src/common/config_opts.h1
-rw-r--r--src/mon/PaxosService.cc4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index c8e634f46ac..d78a7cc9d8a 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 d02cb1d7ab5..647980a9342 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)