Skip to content

Fix multiple COUNT in LMPOP/BLMPOP/ZMPOP/BZMPOP#9701

Merged
oranagra merged 3 commits intoredis:unstablefrom
enjoy-binbin:fix_multiple_count
Oct 31, 2021
Merged

Fix multiple COUNT in LMPOP/BLMPOP/ZMPOP/BZMPOP#9701
oranagra merged 3 commits intoredis:unstablefrom
enjoy-binbin:fix_multiple_count

Conversation

@enjoy-binbin
Copy link
Contributor

@enjoy-binbin enjoy-binbin commented Oct 31, 2021

The previous code did not check whether COUNT is set.
So we can use lmpop 2 key1 key2 left count 1 count 2.

This situation can occur in LMPOP/BLMPOP/ZMPOP/BZMPOP commands.
LMPOP/BLMPOP introduced in #9373, ZMPOP/BZMPOP introduced in #9484.

before:

127.0.0.1:6379> lmpop 2 key1 key2 left count 1
(nil)
127.0.0.1:6379> lmpop 2 key1 key2 left count 1 count 2
(nil)
127.0.0.1:6379> lmpop 2 key1 key2 left count 1 count 2 count 3
(nil)

127.0.0.1:6379> zmpop 2 key1 key2 min count 1
(nil)
127.0.0.1:6379> zmpop 2 key1 key2 min count 1 count 2
(nil)
127.0.0.1:6379> zmpop 2 key1 key2 min count 1 count 2 count 3
(nil)

after:

127.0.0.1:6379> lmpop 2 key1 key2 left count 1 count 2 count 3
(error) ERR syntax error
127.0.0.1:6379> zmpop 2 key1 key2 min count 2 count 2 count 3
(error) ERR syntax error

The previous code did not check whether COUNT is set.
So we can use `lmpop 2 key1 key2 left count 1 count 2`.

This situation can occur in LMPOP/BLMPOP/ZMPOP/BZMPOP commands.
LMPOP/BLMPOP introduced in redis#9373, ZMPOP/BZMPOP introduced in redis#9484.
@oranagra oranagra merged commit 0335788 into redis:unstable Oct 31, 2021
@enjoy-binbin enjoy-binbin deleted the fix_multiple_count branch November 1, 2021 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants