Skip to content
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

Fix ZMPOP/BZMPOP duplicate parameters #1543

Merged
merged 3 commits into from
Jul 5, 2023

Commits on Jul 5, 2023

  1. Fix ZMPOP/BZMPOP duplicate parameters

    We did not check for repeated parameters before, so the
    following code is executable:
    ```
    127.0.0.1:6666> zmpop 1 zset min max
    (nil)
    127.0.0.1:6666> zmpop 1 zset min count 10 count 100
    (nil)
    127.0.0.1:6666> zmpop 1 zset min min max max min
    (nil)
    127.0.0.1:6666> zmpop 1 zset min count 10 count 100 max
    (nil)
    127.0.0.1:6666> bzmpop 0.1 1 zset min max
    (nil)
    127.0.0.1:6666> bzmpop 0.1 1 zset min count 1 count 10
    (nil)
    ```
    
    Now we don't allow duplicate parameters (throw a syntax error):
    ```
    127.0.0.1:6666> zmpop 1 zset min max
    (error) ERR syntax error
    127.0.0.1:6666> zmpop 1 zset min count 10 count 100
    (error) ERR syntax error
    127.0.0.1:6666> zmpop 1 zset min min max max min
    (error) ERR syntax error
    127.0.0.1:6666> zmpop 1 zset min count 10 count 100 max
    (error) ERR syntax error
    127.0.0.1:6666> bzmpop 0.1 1 zset min max
    (error) ERR syntax error
    127.0.0.1:6666> bzmpop 0.1 1 zset min count 1 count 10
    (error) ERR syntax error
    ```
    
    Also added some tests to cover these wrong error paths.
    Refs: ZMPOP was added in apache#1468 and BZMPOP was added in apache#1490.
    enjoy-binbin committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    db436db View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    bbb6617 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    a6797c0 View commit details
    Browse the repository at this point in the history