-
Notifications
You must be signed in to change notification settings - Fork 24.4k
fix ZRANGESTORE - should return 0 when src points to an empty key #9089
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
Conversation
|
I'm not sure if this is a bug, because |
|
@sundb by "null" I mean an empty key (BTW, removing all the members from a sorted set will also reset the key value to null) |
|
@leibale All keys in redis will not be empty(except stream), if empty key will be deleted. |
|
@sundb yea, you're right, an empty sorted set will be deleted, but still: throwing an error in case the |
|
@leibale I'm not sure I fully understand what you're saying. |
|
@sundb I feel like my short comments with my broken English will not get this forward.. let me try to explain myself again: The "normal" behavior of but, when coping from a not existing The problems with the current implementations are:
|
|
@leibale Indeed, after looking at the code of the other commands, your modification is correct. |
|
i see that SINTERSTORE (one of the oldest most mature commands that resembles ZRANGESTORE) returns 0 when the src key is missing, but it does still delete the key. (returning nil is certainly wrong too) |
|
@redis/core-team this is a braking-change fix for a new command we introduced in 6.2. |
|
@leibale thank you for reporting and fixing. |
|
Should be backported to 6.2.x imo. |
) mistakenly it used to return an empty array rather than 0. Co-authored-by: Oran Agra <oran@redislabs.com> (cherry picked from commit 95274f1)
…dis#9089) mistakenly it used to return an empty array rather than 0. Co-authored-by: Oran Agra <oran@redislabs.com>
Using
ZRANGESTOREand setting thesrcto an empty key will return an empty array and leave thedestkey as-is:the expected result is: