feat: add defragment command (#3003)

* feat: add defragment command and improve auto defragmentation algorithm
This commit is contained in:
Borys 2024-05-08 14:26:42 +03:00 committed by GitHub
parent d675e63ab0
commit 3dd6c4959c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 93 additions and 37 deletions

View file

@ -154,6 +154,14 @@ void MemoryCmd::Run(CmdArgList args) {
return Track(args);
}
if (sub_cmd == "DEFRAGMENT") {
shard_set->pool()->DispatchOnAll([this](util::ProactorBase*) {
if (auto* shard = EngineShard::tlocal(); shard)
shard->ForceDefrag();
});
return cntx_->SendSimpleString("OK");
}
string err = UnknownSubCmd(sub_cmd, "MEMORY");
return cntx_->SendError(err, kSyntaxErrType);
}