From 5fa0f04852ce1fc80690194f101d3bed644290ca Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 29 Apr 2013 15:44:58 -0700 Subject: [PATCH] mon: --compact argument, config option to compact the store on start Signed-off-by: Sage Weil --- src/ceph_mon.cc | 9 +++++++++ src/common/config_opts.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/ceph_mon.cc b/src/ceph_mon.cc index 01072728db2..69bcf6d3282 100644 --- a/src/ceph_mon.cc +++ b/src/ceph_mon.cc @@ -114,6 +114,7 @@ int main(int argc, const char **argv) int err; bool mkfs = false; + bool compact = false; std::string osdmapfn, inject_monmap; vector args; @@ -132,6 +133,8 @@ int main(int argc, const char **argv) exit(0); } else if (ceph_argparse_flag(args, i, "--mkfs", (char*)NULL)) { mkfs = true; + } else if (ceph_argparse_flag(args, i, "--compact", (char*)NULL)) { + compact = true; } else if (ceph_argparse_witharg(args, i, &val, "--osdmap", (char*)NULL)) { osdmapfn = val; } else if (ceph_argparse_witharg(args, i, &val, "--inject_monmap", (char*)NULL)) { @@ -474,6 +477,12 @@ int main(int argc, const char **argv) if (err < 0) return 1; + if (compact || g_conf->mon_compact_on_start) { + derr << "compacting monitor store ..." << dendl; + mon->store->compact(); + derr << "done compacting" << dendl; + } + global_init_daemonize(g_ceph_context, 0); common_init_finish(g_ceph_context); global_init_chdir(g_ceph_context); diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 22d3d334f36..78b98b1cc24 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -124,6 +124,7 @@ OPTION(ms_inject_internal_delays, OPT_DOUBLE, 0) // seconds 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_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