redis
redis copied to clipboard
zrangeGenericCommand add negative offset check
Now we will check the offset in zrangeGenericCommand. With a negative offset, we will throw an error and return.
This also resolve the issue of zeroing the destination key in case of the "store" variant when we input a negative offset.
127.0.0.1:6379> set key value
OK
127.0.0.1:6379> zrangestore key myzset 0 10 byscore limit -1 10
(integer) 0
127.0.0.1:6379> exists key
(integer) 0
This change affects the following commands:
- ZRANGE / ZRANGESTORE / ZRANGEBYLEX / ZRANGEBYSCORE
- ZREVRANGE / ZREVRANGEBYSCORE / ZREVRANGEBYLEX
This PR is actually #9052, which was reverted in #12377, which is now re-introduced in 8.0