Commit 33a78d13 authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Add command to show per-compaction-level size and number of SST files

parent 1f9500d6
Pipeline #411253 passed with stages
in 29 minutes and 49 seconds
......@@ -121,6 +121,7 @@ struct cmdMapInit {
redis_cmd_map["quarkdb_bulkload_finalize"] = {RedisCommand::QUARKDB_BULKLOAD_FINALIZE, CommandType::QUARKDB};
redis_cmd_map["quarkdb_invalid_command"] = {RedisCommand::QUARKDB_INVALID_COMMAND, CommandType::QUARKDB};
redis_cmd_map["quarkdb_manual_compaction"] = {RedisCommand::QUARKDB_MANUAL_COMPACTION, CommandType::QUARKDB};
redis_cmd_map["quarkdb_level_stats"] = {RedisCommand::QUARKDB_LEVEL_STATS, CommandType::QUARKDB};
redis_cmd_map["recovery_info"] = {RedisCommand::RECOVERY_INFO, CommandType::QUARKDB};
}
......
......@@ -128,6 +128,7 @@ enum class RedisCommand {
QUARKDB_BULKLOAD_FINALIZE,
QUARKDB_INVALID_COMMAND, // used in tests
QUARKDB_MANUAL_COMPACTION,
QUARKDB_LEVEL_STATS,
RECOVERY_INFO
};
......
......@@ -185,6 +185,15 @@ LinkStatus Shard::dispatch(Connection *conn, RedisRequest &req) {
return conn->fromStatus(stateMachine->manualCompaction());
}
case RedisCommand::QUARKDB_LEVEL_STATS: {
if(req.size() != 1) return conn->errArgs(req[0]);
InFlightRegistration registration(inFlightTracker);
if(!registration.ok()) {
return conn->err("unavailable");
}
return conn->status(stateMachine->levelStats());
}
default: {
if(req.getCommandType() == CommandType::QUARKDB) {
qdb_critical("Unable to dispatch command '" << req[0] << "' of type QUARKDB");
......
......@@ -1222,6 +1222,12 @@ std::string StateMachine::statistics() {
return stats;
}
std::string StateMachine::levelStats() {
std::string stats;
db->GetProperty(rocksdb::DB::Properties::kLevelStats, &stats);
return stats;
}
rocksdb::Status StateMachine::noop(LogIndex index) {
StagingArea stagingArea(*this);
return stagingArea.commit(index);
......
......@@ -168,6 +168,11 @@ public:
//----------------------------------------------------------------------------
std::string statistics();
//----------------------------------------------------------------------------
// Get level stats
//----------------------------------------------------------------------------
std::string levelStats();
bool inBulkLoad() const {
return bulkLoad;
}
......
......@@ -936,6 +936,7 @@ TEST_F(Raft_e2e, smove) {
ASSERT_REPLY(tunnel(leaderID)->exec("smembers", "set1"), make_vec("i2", "i3", "i4", "i5"));
ASSERT_REPLY(tunnel(leaderID)->exec("smembers", "set2"), make_vec("i1", "t1", "t2", "t3", "t4", "t5"));
ASSERT_REPLY(tunnel(leaderID)->exec("quarkdb-manual-compaction"), "OK");
qdb_info(qclient::describeRedisReply(tunnel(leaderID)->exec("quarkdb-level-stats").get()));
}
TEST_F(Raft_e2e, sscan) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment