1

In redis integer increment commands, more specifically:

INCR / INCRBY
HINCRBY

what is the behavior when incrementing 1-past the maximum value (ie 64bit signed range)?

Lorah Attkins
  • 5,331
  • 3
  • 29
  • 63
  • 1
    Why don't you just try it? `SET ` and then `INCR `. – sazzad Jan 12 '22 at 12:56
  • @sazzad I wanted to know if this an "established" behavior or something that varies among versions. But your point is valid. I don't know if redis provides a `MAX_VALUE` but using python's `sys.maxsize` variable (which is 64 bits like in redis) I can confirm the answer. Thanks! – Lorah Attkins Jan 12 '22 at 20:33

1 Answers1

2

It would error saying that the increment would overflow:

127.0.0.1:6379> set foo 9223372036854775807
OK
127.0.0.1:6379> incr foo
(error) ERR increment or decrement would overflow
slorello
  • 901
  • 5
  • 6