From: Sage Weil Date: Tue, 3 Oct 2017 03:17:54 +0000 (-0500) Subject: kv: add per-prefix space estimation X-Git-Tag: v12.2.13~172^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7fa8e852ad500b25aa7c5b8b2d7c6428ce5f4011;p=ceph.git kv: add per-prefix space estimation Signed-off-by: Sage Weil (cherry picked from commit c6da00b418764ca8fec248b768f3744ca1e655ed) backport: remove column family handling, which doesn't exist in luminous --- diff --git a/src/kv/KeyValueDB.h b/src/kv/KeyValueDB.h index eca9ddfa6a7..2c31944edc7 100644 --- a/src/kv/KeyValueDB.h +++ b/src/kv/KeyValueDB.h @@ -370,6 +370,11 @@ public: virtual ~KeyValueDB() {} + /// estimate space utilization for a prefix (in bytes) + virtual int64_t estimate_prefix_size(const string& prefix) { + return 0; + } + /// compact the underlying store virtual void compact() {} diff --git a/src/kv/RocksDBStore.cc b/src/kv/RocksDBStore.cc index 08bb6408735..1cfa7548b40 100644 --- a/src/kv/RocksDBStore.cc +++ b/src/kv/RocksDBStore.cc @@ -451,6 +451,18 @@ void RocksDBStore::split_stats(const std::string &s, char delim, std::vectorGetApproximateSizes(&r, 1, &size, flags); + return size; +} + void RocksDBStore::get_statistics(Formatter *f) { if (!g_conf->rocksdb_perf) { diff --git a/src/kv/RocksDBStore.h b/src/kv/RocksDBStore.h index ffae58d3cf1..0b0d31d12de 100644 --- a/src/kv/RocksDBStore.h +++ b/src/kv/RocksDBStore.h @@ -166,6 +166,8 @@ public: return logger; } + int64_t estimate_prefix_size(const string& prefix) override; + struct RocksWBHandler: public rocksdb::WriteBatch::Handler { std::string seen ; int num_seen = 0;