Skip to content

Commit 00063a9

Browse files
author
wanglinke
committed
kv/RocksDBStore: add kv_stats function to print all CF info
- Added the function of printing all cf's rocksdb level information. - Currently, only the default cf information is printed. - Print all cf information to facilitate observation of the level to which rocksdb is written. - The main purpose is to observe the usage of db/ssd. co-author: Jrchyang Yu <[email protected]> Signed-off-by: Wang Linke <[email protected]>
1 parent 7f56802 commit 00063a9

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

src/kv/RocksDBStore.cc

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,21 +1421,34 @@ void RocksDBStore::get_statistics(Formatter *f)
14211421
<< dendl;
14221422
return;
14231423
}
1424-
1424+
14251425
if (cct->_conf->rocksdb_collect_compaction_stats) {
1426-
std::string stat_str;
1427-
bool status = db->GetProperty("rocksdb.stats", &stat_str);
1428-
if (status) {
1429-
f->open_object_section("rocksdb_statistics");
1426+
vector<rocksdb::ColumnFamilyHandle*> handles;
1427+
handles.push_back(default_cf);
1428+
for (auto cf : cf_handles) {
1429+
for (auto shard_cf : cf.second.handles) {
1430+
handles.push_back(shard_cf);
1431+
}
1432+
}
1433+
f->open_object_section("rocksdb_statistics");
1434+
for (auto handle : handles) {
1435+
std::string stat_str;
1436+
bool status = db->GetProperty(handle, "rocksdb.stats", &stat_str);
1437+
if (!status) {
1438+
derr << __func__ << " failed to get rocksdb.stats for the cf: "
1439+
<< handle->GetName() << dendl;
1440+
continue;
1441+
}
14301442
f->dump_string("rocksdb_compaction_statistics", "");
14311443
vector<string> stats;
14321444
split_stats(stat_str, '\n', stats);
14331445
for (auto st :stats) {
14341446
f->dump_string("", st);
1435-
}
1436-
f->close_section();
1447+
}
14371448
}
1449+
f->close_section();
14381450
}
1451+
14391452
if (cct->_conf->rocksdb_collect_extended_stats) {
14401453
if (dbstats) {
14411454
f->open_object_section("rocksdb_extended_statistics");

0 commit comments

Comments
 (0)