LPOP/RPOP with count against non existing list return null array#10095
LPOP/RPOP with count against non existing list return null array#10095oranagra merged 3 commits intoredis:unstablefrom
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 |
|
@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