summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-29 10:51:00 -0700
committerSage Weil <sage@inktank.com>2013-04-29 15:45:17 -0700
commitee3cdaa86c03536ef42d4c2f2af702bdf650be8a (patch)
tree5767daa98ab5b712157725e18d24f1ebffdc4bb0
parent5fa0f04852ce1fc80690194f101d3bed644290ca (diff)
downloadceph-ee3cdaa86c03536ef42d4c2f2af702bdf650be8a.tar.gz
mon: compact leveldb on bootstrap
This is an opportunistic time to optimize our local data since we are out of quorum. It serves as a safety net for cases where leveldb's automatic compaction doesn't work quite right and lets things get out of hand. Anecdotally we have seen stores in excess of 30GB compact down to a few hundred KB. And a 9GB store compact down to 900MB in only 1 minute. Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/common/config_opts.h1
-rw-r--r--src/mon/Monitor.cc7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h
index 78b98b1cc24..348b1cd3fec 100644
--- a/src/common/config_opts.h
+++ b/src/common/config_opts.h
@@ -125,6 +125,7 @@ OPTION(mon_data, OPT_STR, "/var/lib/ceph/mon/$cluster-$id")
OPTION(mon_initial_members, OPT_STR, "") // list of initial cluster mon ids; if specified, need majority to form initial quorum and create new cluster
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, true) // trigger leveldb compaction on bootstrap
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/Monitor.cc b/src/mon/Monitor.cc
index 405ab30597b..06030ac1e01 100644
--- a/src/mon/Monitor.cc
+++ b/src/mon/Monitor.cc
@@ -634,6 +634,13 @@ void Monitor::bootstrap()
reset();
+ // sync store
+ if (g_conf->mon_compact_on_bootstrap) {
+ dout(10) << "bootstrap -- triggering compaction" << dendl;
+ store->compact();
+ dout(10) << "bootstrap -- finished compaction" << dendl;
+ }
+
// singleton monitor?
if (monmap->size() == 1 && rank == 0) {
win_standalone_election();