-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: allow sampling of topk hottest keys. #4649
Conversation
045730a
to
71a591f
Compare
The core data structure code was added long time ago, now we allow using it via `DEBUG TOPK ON/OFF` subcommand. Signed-off-by: Roman Gershman <roman@dragonflydb.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't checked the TopKeys changes since I am unfamiliar with the class. Happy to jump in though if it's needed
@@ -584,6 +587,10 @@ void DebugCmd::Run(CmdArgList args, facade::SinkReplyBuilder* builder) { | |||
return RecvSize(ArgS(args, 1), builder); | |||
} | |||
|
|||
if (subcmd == "TOPK" && args.size() >= 2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the things I don't really like about how we implement subcommands, is that we miss basic arity checks and they are also orthogonal to our ACL's (subcommands of ACL"s are actual commands stored in the registry as opposed to what we have here). Long time now I wanted to check if we can simplify this, but never got a chance to actually check this.
Not important just thinking out loud.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought maybe we can provide parse function for every command and split the code of parsing and execution of the command
public: | ||
struct Options { | ||
// HeavyKeeper options | ||
uint64_t buckets = 1 << 16; | ||
uint64_t arrays = 4; | ||
uint32_t buckets = 1 << 16; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use sometimes uint64 for buckets and sometimes uint32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
src/server/table.cc
Outdated
if (top_keys) { | ||
delete top_keys; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit you don't need if(top_keys) delete nullptr is correct statement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
auto* rb = static_cast<RedisReplyBuilder*>(builder); | ||
DCHECK_GE(args.size(), 1u); | ||
|
||
string_view subcmd = ArgS(args, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about cmdArgParser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can give it as a starter task to someone
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
The core data structure code was added long time ago, now we allow using it via
DEBUG TOPK ON/OFF
subcommand.