Commit 891d4246 authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Implement quarkdb-verify-checksum command

parent 4af91997
Pipeline #1431171 passed with stages
in 74 minutes and 23 seconds
......@@ -2,6 +2,9 @@
## Unreleased
### New features
- Implement command ``quarkdb-verify-checksum`` for manually running a full checksum scan.
### Improvements
- Security hardening of the redis parser for unauthenticated clients.
- Package and distribute ``quarkdb-ldb`` tool based on the one provided by RocksDB.
......
......@@ -155,6 +155,7 @@ struct cmdMapInit {
redis_cmd_map["quarkdb_version"] = {RedisCommand::QUARKDB_VERSION, CommandType::QUARKDB};
redis_cmd_map["quarkdb_checkpoint"] = {RedisCommand::QUARKDB_CHECKPOINT, CommandType::QUARKDB};
redis_cmd_map["quarkdb_health"] = {RedisCommand::QUARKDB_HEALTH, CommandType::QUARKDB};
redis_cmd_map["quarkdb_verify_checksum"] = {RedisCommand::QUARKDB_VERIFY_CHECKSUM, CommandType::QUARKDB};
// Compatibility: Keep raft_checkpoint, make identical to quarkdb_checkpoint.
// Maybe remove in a few versions.
......
......@@ -162,6 +162,7 @@ enum class RedisCommand {
QUARKDB_VERSION,
QUARKDB_CHECKPOINT,
QUARKDB_HEALTH,
QUARKDB_VERIFY_CHECKSUM,
RECOVERY_GET,
RECOVERY_SET,
......
......@@ -258,6 +258,19 @@ LinkStatus Shard::dispatch(Connection *conn, RedisRequest &req) {
stateMachine->getRequestCounter().fillHistorical(headers, data);
return conn->raw(Formatter::vectorsWithHeaders(headers, data));
}
case RedisCommand::QUARKDB_VERIFY_CHECKSUM: {
if(req.size() != 1) return conn->errArgs(req[0]);
InFlightRegistration registration(inFlightTracker);
if(!registration.ok()) {
return conn->err("unavailable");
}
rocksdb::Status st = stateMachine->verifyChecksum();
std::vector<std::string> output;
output.emplace_back(SSTR("state-machine: " << st.ToString()));
return conn->statusVector(output);
}
default: {
if(req.getCommandType() == CommandType::QUARKDB) {
qdb_critical("Unable to dispatch command '" << req[0] << "' of type QUARKDB");
......
......@@ -821,6 +821,11 @@ TEST_F(Raft_e2e, test_many_redis_commands) {
"3) \"12345\"\n"
"4) \"1\"\n"
);
ASSERT_REPLY_DESCRIBE(
tunnel(leaderID)->exec("quarkdb-verify-checksum").get(),
"1) state-machine: OK\n"
);
}
TEST_F(Raft_e2e, DequeTrimming) {
......
Markdown is supported
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