-
Notifications
You must be signed in to change notification settings - Fork 468
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
Conversation
Signed-off-by: Jinze Wu <[email protected]>
TYPE
command with bloom filter
Also cc @zncleon |
This patch is LGTM. Would you mind add a tiny test in |
Signed-off-by: Jinze Wu <[email protected]>
done |
Signed-off-by: Jinze Wu <[email protected]>
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.
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"}; |
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 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
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.
done
Signed-off-by: Jinze Wu <[email protected]>
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.
thanks.
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).