• Binbin's avatar
    Fixes ZPOPMIN/ZPOPMAX wrong replies when count is 0 with non-zset (#9711) · 91e77a0c
    Binbin authored
    Moves ZPOP ... 0 fast exit path after type check to reply with
    WRONGTYPE. In the past it will return an empty array.
    
    Also now count is not allowed to be negative.
    
    see #9680
    
    before:
    ```
    127.0.0.1:6379> set zset str
    OK
    127.0.0.1:6379> zpopmin zset 0
    (empty array)
    127.0.0.1:6379> zpopmin zset -1
    (empty array)
    ```
    
    after:
    ```
    127.0.0.1:6379> set zset str
    OK
    127.0.0.1:6379> zpopmin zset 0
    (error) WRONGTYPE Operation against a key holding the wrong kind of value
    127.0.0.1:6379> zpopmin zset -1
    (error) ERR value is out of range, must be positive
    ```
    91e77a0c
blocked.c 33.2 KB