#include "osdc/Objecter.h"
#include "common/ceph_argparse.h"
+#include "common/ceph_time.h"
#include "common/version.h"
#include "common/io_priority.h"
#undef dout_prefix
#define dout_prefix _prefix(_dout, whoami, get_osdmap_epoch())
+
const double OSD::OSD_TICK_INTERVAL = 1.0;
static ostream& _prefix(std::ostream* _dout, int whoami, epoch_t epoch) {
f->dump_bool("success", success);
f->dump_int("value", value);
f->close_section();
+ } else if (command == "compact") {
+ dout(1) << "triggering manual compaction" << dendl;
+ auto start = ceph::coarse_mono_clock::now();
+ store->compact();
+ auto end = ceph::coarse_mono_clock::now();
+ auto time_span = chrono::duration_cast<chrono::duration<double>>(end - start);
+ dout(1) << "finished manual compaction in "
+ << time_span.count()
+ << " seconds" << dendl;
+ f->open_object_section("compact_result");
+ f->dump_float("elapsed_time", time_span.count());
+ f->close_section();
} else {
assert(0 == "broken asok registration");
}
assert(r == 0);
+ r = admin_socket->register_command("compact", "compact",
+ asok_hook,
+ "Commpact object store's omap."
+ " WARNING: Compaction probably slows your requests");
+ assert(r == 0);
+
test_ops_hook = new TestOpsSocketHook(&(this->service), this->store);
// Note: pools are CephString instead of CephPoolname because
// these commands traditionally support both pool names and numbers
cct->get_admin_socket()->unregister_command("get_latest_osdmap");
cct->get_admin_socket()->unregister_command("set_heap_property");
cct->get_admin_socket()->unregister_command("get_heap_property");
+ cct->get_admin_socket()->unregister_command("compact");
delete asok_hook;
asok_hook = NULL;
"osd", "r", "cli,rest")
COMMAND("reset_pg_recovery_stats", "reset pg recovery statistics",
"osd", "rw", "cli,rest")
+COMMAND("compact",
+ "compact object store's omap. "
+ "WARNING: Compaction probably slows your requests",
+ "osd", "rw", "cli,rest")
};
void OSD::do_command(Connection *con, ceph_tid_t tid, vector<string>& cmd, bufferlist& data)
pg_recovery_stats.reset();
}
+ else if (prefix == "compact") {
+ dout(1) << "triggering manual compaction" << dendl;
+ auto start = ceph::coarse_mono_clock::now();
+ store->compact();
+ auto end = ceph::coarse_mono_clock::now();
+ auto time_span = chrono::duration_cast<chrono::duration<double>>(end - start);
+ dout(1) << "finished manual compaction in "
+ << time_span.count()
+ << " seconds" << dendl;
+ ss << "compacted omap in " << time_span.count() << " seconds";
+ }
+
else {
ss << "unrecognized command! " << cmd;
r = -EINVAL;