From: Sage Weil Date: Fri, 17 May 2013 16:17:18 +0000 (-0700) Subject: mon: add 'compact' command X-Git-Tag: v0.64~106 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=69e2cbef6ab84a6510920f39204099ac76d655fe;p=ceph.git mon: add 'compact' command As in, 'ceph mon tell \* compact' Signed-off-by: Sage Weil Reviewed-by: Joao Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 7325bfade6ba..f1d16aa69e85 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -2550,6 +2550,24 @@ void Monitor::handle_command(MMonCommand *m) return; } + if (m->cmd[0] == "compact") { + if (!access_all) { + r = -EACCES; + rs = "access denied"; + goto out; + } + dout(1) << "triggering manual compaction" << dendl; + utime_t start = ceph_clock_now(g_ceph_context); + store->compact(); + utime_t end = ceph_clock_now(g_ceph_context); + end -= start; + dout(1) << "finished manual compaction in " << end << " seconds" << dendl; + ostringstream oss; + oss << "compacted leveldb in " << end; + rs = oss.str(); + r = 0; + } + if (m->cmd[0] == "injectargs") { if (!access_all) { r = -EACCES;