Skip to content
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

Merged
merged 2 commits into from
Feb 24, 2025
Merged

chore: allow sampling of topk hottest keys. #4649

merged 2 commits into from
Feb 24, 2025

Conversation

romange
Copy link
Collaborator

@romange romange commented Feb 23, 2025

The core data structure code was added long time ago, now we allow using it via DEBUG TOPK ON/OFF subcommand.

@romange romange requested a review from BorysTheDev February 23, 2025 17:22
@romange romange force-pushed the Pr6 branch 2 times, most recently from 045730a to 71a591f Compare February 23, 2025 18:24

Verified

This commit was signed with the committer’s verified signature.
romange Roman Gershman
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>
Copy link
Contributor

@kostasrim kostasrim left a 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) {
Copy link
Contributor

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.

Copy link
Contributor

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;
Copy link
Contributor

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines 97 to 99
if (top_keys) {
delete top_keys;
}
Copy link
Contributor

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

Copy link
Collaborator Author

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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about cmdArgParser

Copy link
Collaborator Author

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

BorysTheDev
BorysTheDev previously approved these changes Feb 24, 2025

Verified

This commit was signed with the committer’s verified signature.
romange Roman Gershman
Signed-off-by: Roman Gershman <roman@dragonflydb.io>
@romange romange merged commit 91a3dd8 into main Feb 24, 2025
10 checks passed
@romange romange deleted the Pr6 branch February 24, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants