From 43c599023f00fb11b5a1a97064f9fbc8721f934b Mon Sep 17 00:00:00 2001 From: Jianpeng Ma Date: Fri, 2 Dec 2016 13:20:20 -0500 Subject: [PATCH] osd: dump kv stats for ObjectStores (if any) Signed-off-by: Sage Weil Signed-off-by: Jianpeng Ma --- src/os/ObjectStore.h | 2 ++ src/osd/OSD.cc | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 3bbce7555607e..304e352b3a368 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1496,6 +1496,8 @@ public: return 0; } + virtual void get_db_statistics(Formatter *f) { } + virtual string get_type() = 0; // mgmt diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d6db61b13dc6f..fba2fcec5f7ef 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1934,6 +1934,8 @@ bool OSD::asok_command(string command, cmdmap_t& cmdmap, string format, f->dump_bool("success", success); f->dump_int("value", value); f->close_section(); + } else if (command == "dump_objectstore_kv_stats") { + store->get_db_statistics(f); } else { assert(0 == "broken asok registration"); } @@ -2393,6 +2395,9 @@ void OSD::final_init() "get malloc extension heap property"); assert(r == 0); + r = admin_socket->register_command("dump_objectstore_kv_stats", "dump_objectstore_kv_stats", asok_hook, + "print statistics of kvdb which used by bluestore"); + assert(r == 0); test_ops_hook = new TestOpsSocketHook(&(this->service), this->store); // Note: pools are CephString instead of CephPoolname because @@ -2714,6 +2719,7 @@ int OSD::shutdown() 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("dump_objectstore_kv_stats"); delete asok_hook; asok_hook = NULL; -- 2.39.5