redis icon indicating copy to clipboard operation
redis copied to clipboard

zrangeGenericCommand add negative offset check

Open enjoy-binbin opened this issue 2 years ago • 1 comments

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

enjoy-binbin avatar Jul 03 '23 06:07 enjoy-binbin

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Mar 24 '24 23:03 CLAassistant