PragmaTwice commented on code in PR #3022:
URL: https://github.com/apache/kvrocks/pull/3022#discussion_r2140540121
##########
src/commands/cmd_server.cc:
##########
@@ -1493,6 +1493,40 @@ class CommandSST : public Commander {
rocksdb::IngestExternalFileOptions ingest_options_;
};
+// command format: flushmemtable [async]
+class CommandFlushMemTable : public Commander {
+ public:
+ Status Parse([[maybe_unused]] const std::vector<std::string> &args) override
{
+ if (args.size() > 2) {
+ return {Status::RedisParseErr, errWrongNumOfArguments};
+ }
+
+ flush_options_.wait = true;
+ if (args.size() > 1) {
+ if (util::EqualICase(args[1], "async")) {
+ flush_options_.wait = true;
+ } else {
+ return {Status::RedisParseErr, "parameter must be 'async'"};
+ }
+ }
+
+ return Status::OK();
+ }
+
+ Status Execute([[maybe_unused]] engine::Context &ctx, Server *srv,
[[maybe_unused]] Connection *conn,
+ std::string *output) override {
+ const auto s = srv->storage->FlushMemTable(nullptr, flush_options_);
+ if (!s.ok()) return {Status::RedisExecErr, s.ToString()};
+
+ *output = redis::RESP_OK;
+ info("flushmemtable was triggered by manual with executed success");
Review Comment:
```suggestion
info("FLUSHMEMTABLE is triggered and executed successfully");
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]