From: Garry Drankovich Date: Thu, 4 Dec 2025 23:01:00 +0000 (+0300) Subject: os/bluestore: show RocksDB sharding information X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=df3a38ca122bb876203e879dffa9ebf41d9ecbcd;p=ceph-ci.git os/bluestore: show RocksDB sharding information 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 --- diff --git a/src/os/bluestore/BlueAdmin.cc b/src/os/bluestore/BlueAdmin.cc index 7e4d263f837..475d47a16ac 100644 --- a/src/os/bluestore/BlueAdmin.cc +++ b/src/os/bluestore/BlueAdmin.cc @@ -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; diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 28ee6a4f87a..126769bb0b1 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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(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 *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( diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 38bea331c09..4fd4299a071 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -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;