]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: show RocksDB sharding information
authorGarry Drankovich <garry.drankovich@clyso.com>
Thu, 4 Dec 2025 23:01:00 +0000 (02:01 +0300)
committerGarry Drankovich <garry.drankovich@clyso.com>
Thu, 4 Dec 2025 23:07:12 +0000 (02:07 +0300)
This allows to view RocksDB sharding information via both admin socket and osd metadata commands.

Fixes: https://tracker.ceph.com/issues/71609
Signed-off-by: Garry Drankovich <garry.drankovich@clyso.com>
src/os/bluestore/BlueAdmin.cc
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 7e4d263f837c550e5cd99078e6726309085fbc3b..475d47a16acfb0e11f910068c812bc94eefa7870 100644 (file)
@@ -49,6 +49,11 @@ BlueStore::SocketHook::SocketHook(BlueStore& store)
       this,
       "print compression stats, per collection");
     ceph_assert(r == 0);
+    r = admin_socket->register_command(
+      "bluestore show sharding ",
+      this,
+      "print RocksDB sharding");
+    ceph_assert(r == 0);
   }
 }
 
@@ -177,6 +182,16 @@ int BlueStore::SocketHook::call(
     }
     f->close_section();
     return 0;
+  } else if (command == "bluestore show sharding") {
+    int r = 0;
+    std::string sharding;
+    if (store.get_db_sharding(sharding)) {
+      out.append(sharding + '\n');
+    } else {
+      r = -EFAULT;
+      ss << "Failed to get sharding" << std::endl;
+    }
+    return r;
   } else {
     ss << "Invalid command" << std::endl;
     r = -ENOSYS;
index 28ee6a4f87a44a0a1639ab14f18889b0f38be1e7..126769bb0b1e5f49c1e8172fe0737eb81b6b1b84 100644 (file)
@@ -9160,6 +9160,16 @@ int BlueStore::expand_devices(ostream& out)
   return r;
 }
 
+bool BlueStore::get_db_sharding(std::string& res_sharding)
+{
+  bool ret = false;
+  RocksDBStore* rdb = dynamic_cast<RocksDBStore*>(db);
+  if (db) {
+    ret = rdb->get_sharding(res_sharding);
+  }
+  return ret;
+}
+
 int BlueStore::dump_bluefs_sizes(ostream& out)
 {
   int r = _open_db_and_around(true);
@@ -12081,6 +12091,10 @@ void BlueStore::collect_metadata(map<string,string> *pm)
   (*pm)["bluestore_allocator"] = alloc ? alloc->get_type() : "null";
   (*pm)["bluestore_write_mode"] = use_write_v2 ? "new" : "classic";
   (*pm)["bluestore_onode_segmentation"] = segment_size == 0 ? "inactive" : "active";
+  std::string sharding;
+  if (get_db_sharding(sharding)) {
+    (*pm)["bluestore_db_sharding"] = sharding;
+  }
 }
 
 int BlueStore::get_numa_node(
index 38bea331c096e162c3b69fd3d0a717c1434debbb..4fd4299a071f049244d27dde1a02ef3166298ebd 100644 (file)
@@ -3187,10 +3187,13 @@ public:
   int expand_devices(std::ostream& out);
   std::string get_device_path(unsigned id);
 
+  bool get_db_sharding(std::string& res_sharding);
+
   int dump_bluefs_sizes(std::ostream& out);
   void trim_free_space(const std::string& type, std::ostream& outss);
   static int zap_device(CephContext* cct, const std::string& dev);
 
+
 public:
   int statfs(struct store_statfs_t *buf,
              osd_alert_list_t* alerts = nullptr) override;