]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: dump kv stats for ObjectStores (if any)
authorJianpeng Ma <jianpeng.ma@intel.com>
Fri, 2 Dec 2016 18:20:20 +0000 (13:20 -0500)
committerSage Weil <sage@redhat.com>
Fri, 2 Dec 2016 19:10:07 +0000 (14:10 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/ObjectStore.h
src/osd/OSD.cc

index 3bbce7555607e40c66ca2c3acf165ce7c3f3099c..304e352b3a3688d8f3846ff289713582beec8adf 100644 (file)
@@ -1496,6 +1496,8 @@ public:
     return 0;
   }
 
+  virtual void get_db_statistics(Formatter *f) { }
+
   virtual string get_type() = 0;
 
   // mgmt
index d6db61b13dc6f770e06b8e10c33ba95b04ccfa44..fba2fcec5f7effeb0713bbb9f0c1e2a516c91074 100644 (file)
@@ -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;