mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
feat: add defragment command (#3003)
* feat: add defragment command and improve auto defragmentation algorithm
This commit is contained in:
parent
d675e63ab0
commit
3dd6c4959c
5 changed files with 93 additions and 37 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue