-
Notifications
You must be signed in to change notification settings - Fork 472
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 crash in zset store getkeys, fix zdiff/bzmpop range, add tests #2051
Conversation
These following cases will crash the server, the reason is that the index of numkeys is wrong: ``` command getkeys zdiffstore dst 2 src1 src2 command getkeys zinterstore dst 2 src1 src2 command getkeys zunionstore dst 2 src1 src2 ``` These following getkeys output is wrong: ``` > command getkeys zdiff 2 key1 key2 1) "key1" 2) "key2" 3) (nil) > command getkeys bzmpop 0 2 key1 key2 1) "key1" ``` These are ok: ``` command getkeys zinter 2 key1 key2 command getkeys zunion 2 key1 key2 command getkeys sintercard 2 key1 key2 command getkeys zintercard 2 key1 key2 command getkeys zmpop 2 key1 key2 command getkeys lmpop 2 key1 key2 command getkeys blmpop 0 2 key1 key2 ``` However, at present, there is still a problem with our zset store. We do not support returning dst key, but let's do it later... ``` 127.0.0.1:6379> command getkeys zinterstore dst 2 src1 src2 1) "dst" 2) "src1" 3) "src2" 127.0.0.1:6666> command getkeys zinterstore dst 2 src1 src2 1) "src1" 2) "src2" ```
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, thanks
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 too, thanks.
I think we need to inform developers that in versions of kvrocks before 2.8, some commands may cause server crashes. |
@jihuayu Thanks for your warm reminder. Yes we should mention this in our next release note. |
For store key related commands, we cannot extract the store key, see apache#2051. This PR adds store_key to CommandKeyRange to represent its index. This PR handle these store key commands: - zunionstore - zinterstore - zdiffstore - georadius - georadiusbymember - geosearchstore before: ``` > command getkeys zinterstore dst 2 src1 src2 1) "src1" 2) "src2" > command getkeys GEORADIUS src 1 1 1 km store dst 1) "src" > command getkeys GEORADIUSBYMEMBER src member radius m store dst 1) "src" > command getkeys GEOSEARCHSTORE dst src frommember member byradius 10 m 1) "dst" ``` after: ``` > command getkeys zinterstore dst 2 src1 src2 1) "dst" 2) "src1" 3) "src2" > command getkeys GEORADIUS src 1 1 1 km store dst 1) "src" 2) "dst" > command getkeys GEORADIUSBYMEMBER src member radius m store dst 1) "src" 2) "dst" > command getkeys GEOSEARCHSTORE dst src frommember member byradius 10 m 1) "dst" 2) "src" ```
These following cases will crash the server, the reason is that
the index of numkeys is wrong:
These following getkeys output is wrong:
These are ok:
However, at present, there is still a problem with our zset store.
We do not support returning dst key, but let's do it later...