fix ZRANGESTORE - should return 0 when src points to an empty key#9089
fix ZRANGESTORE - should return 0 when src points to an empty key#9089oranagra merged 5 commits intoredis:unstablefrom
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 <[email protected]> (cherry picked from commit 95274f1)
…dis#9089) mistakenly it used to return an empty array rather than 0. Co-authored-by: Oran Agra <[email protected]>
Using
ZRANGESTOREand setting thesrcto an empty key will return an empty array and leave thedestkey as-is:the expected result is: