-
Notifications
You must be signed in to change notification settings - Fork 24.4k
LPOP/RPOP with count against non existing list return null array #10095
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
It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in redis#8179. Fix redis#10089.
|
@enjoy-binbin can you scan other places where COUNT was added in 6.2 and other early exists of these commands to see if we don't have similar issues in other places. |
|
sure, i can take a look tomorrow |
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.
+1 to verifying the other locations don't introduce weird changes. We should backport this to 6.2 as well.
|
@madolson it does match 6.0 already. |
|
@oranagra For some reason I thought this broke from 6.0->6.2, but I understand now, it doesn't change my opinion. |
|
base on this branch (this PR)
shared.emptyarray = createObject(OBJ_STRING,sdsnew("*0\r\n"));
shared.null[2] = createObject(OBJ_STRING,sdsnew("$-1\r\n"));
shared.null[3] = createObject(OBJ_STRING,sdsnew("_\r\n"));
shared.nullarray[2] = createObject(OBJ_STRING,sdsnew("*-1\r\n"));
shared.nullarray[3] = createObject(OBJ_STRING,sdsnew("_\r\n"));
shared.emptymap[2] = createObject(OBJ_STRING,sdsnew("*0\r\n"));
shared.emptymap[3] = createObject(OBJ_STRING,sdsnew("%0\r\n"));
shared.emptyset[2] = createObject(OBJ_STRING,sdsnew("*0\r\n"));
shared.emptyset[3] = createObject(OBJ_STRING,sdsnew("~0\r\n"));list: LPOP/RPOP key [count] (count added in 6.2)
set: SPOP key [count] (count added in 3.2)
SRANDMEMBER
zset: ZPOPMIN/ZPOPMAX key [count]
ZRANDMEMBER
hash: HGETALL key HRANDFIELD
geo: georadius*
|
) It used to return `$-1` in RESP2, now we will return `*-1`. This is a bug in redis 6.2 when COUNT was added, the `COUNT` option was introduced in #8179. Fix #10089. the documentation of [LPOP](https://redis.io/commands/lpop) says ``` When called without the count argument: Bulk string reply: the value of the first element, or nil when key does not exist. When called with the count argument: Array reply: list of popped elements, or nil when key does not exist. ``` (cherry picked from commit 39feee8)
It used to return
$-1in RESP2, now we will return*-1.This is a bug in redis 6.2 when COUNT was added, the
COUNToption was introduced in #8179. Fix #10089.
the documentation of LPOP says