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

Fix TYPE command with bloom filter #1747

Merged
merged 4 commits into from
Sep 9, 2023
Merged

Conversation

gogim1
Copy link
Contributor

@gogim1 gogim1 commented Sep 8, 2023

When #1699 introduced BloomFilter, RedisTypeNames was not modified
at the same time, causing the TYPE command return nothing in bf key.
Now it will return MBbloom-- (keep names consistent with Redis).

@gogim1 gogim1 changed the title fix type name of bloom filter Fix TYPE command with bloom filter Sep 8, 2023
@mapleFU
Copy link
Member

mapleFU commented Sep 8, 2023

Also cc @zncleon

@mapleFU
Copy link
Member

mapleFU commented Sep 8, 2023

This patch is LGTM. Would you mind add a tiny test in tests/gocase/unit/type/bloom/bloom_test.go for this?

Signed-off-by: Jinze Wu <[email protected]>
@gogim1
Copy link
Contributor Author

gogim1 commented Sep 8, 2023

This patch is LGTM. Would you mind add a tiny test in tests/gocase/unit/type/bloom/bloom_test.go for this?

done

mapleFU
mapleFU previously approved these changes Sep 8, 2023
Signed-off-by: Jinze Wu <[email protected]>
PragmaTwice
PragmaTwice previously approved these changes Sep 8, 2023
torwig
torwig previously approved these changes Sep 8, 2023
Copy link
Contributor

@torwig torwig left a comment

Choose a reason for hiding this comment

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

LGTM.
@gogim1 Thank you for the contribution.

@@ -37,6 +37,7 @@ class CommandType : public Commander {
RedisType type = kRedisNone;
auto s = redis.Type(args_[1], &type);
if (s.ok()) {
if (type >= RedisTypeNames.size()) return {Status::RedisExecErr, "Invalid type"};
Copy link
Member

@enjoy-binbin enjoy-binbin Sep 8, 2023

Choose a reason for hiding this comment

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

i think in this case we can trigger a crash instead of returning an error.

returning an error will make the user think he is doing something wrong,
when in fact this is a kvrocks internally bug (user can fire a issue and report this)

but i am also ok with it since mostly it will be a dead code.
(actually returning nothing seems better than returning an error)

please also add a comment near by RedisType and RedisTypeNames, mention that they need to stay in sync

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Signed-off-by: Jinze Wu <[email protected]>
@gogim1 gogim1 dismissed stale reviews from torwig and PragmaTwice via 15f0376 September 9, 2023 06:55
Copy link
Member

@enjoy-binbin enjoy-binbin left a comment

Choose a reason for hiding this comment

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

thanks.

@enjoy-binbin enjoy-binbin merged commit 166f9a7 into apache:unstable Sep 9, 2023
26 checks passed
@gogim1 gogim1 deleted the type-bloom branch September 9, 2023 09:11
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.

5 participants