127.0.0.1:6379> xgroup create testStream testGroup 0 mkstream
OK
127.0.0.1:6379> xadd testStream * testField testValue
"1573835574408-0"
127.0.0.1:6379> xclaim testStream testGroup testConsumer 0 1573835574408-0 force justid
1) "1573835574408-0"
127.0.0.1:6379> xack testStream testGroup 1573835574408-0
(integer) 1
127.0.0.1:6379> xreadgroup group testGroup testConsumer streams testStream >
1) 1) "testStream"
2) 1) 1) "1573835574408-0"
2) 1) "testField"
2) "testValue"
According to the docs I would expect XREADGROUP call to not return 1573835574408-0, since it is ACKed already.
I observe the same behavior without justid
redis_version:5.0.6
Comment From: leomurillo
I think redis gives precedence to the "last-delivered-id", you can inspect this value with XINFO GROUPS keyname. Consumer groups are intended for "at-least-once" delivery, so when you use > for the ID, it goes by "last-delivered-id".
XCLAIM doesn't affect the "last-delivered-id". What you are seeing is a consequence of using the FORCE option in XCLAIM.
The XACK command doc states that "XACK command removes one or multiple messages from the pending entries list (PEL) of a stream consumer group." It only acts on the PEL.
The XACK and XCLAIM documentation could be improved to better explain this situation.
Comment From: itamarhaber
As this appears to be a documentation issue, please feel free to move this (and perhaps add a PR) to https://github.com/antirez/redis-doc :)
Comment From: codenet
We just ran into this issue too. Is there a possibility to fix this behaviour?
Similar to this issue, we also observed that we are able to xack an already xacked row after we force-claimed it:
127.0.0.1:6379> xadd test * word hello
"1673081722149-0"
127.0.0.1:6379> XGROUP CREATE test mygroup 0
OK
127.0.0.1:6379> xreadgroup GROUP mygroup reader STREAMS test >
1) 1) "test"
2) 1) 1) "1673081722149-0"
2) 1) "word"
2) "hello"
127.0.0.1:6379> xack test mygroup 1673081722149-0
(integer) 1
127.0.0.1:6379> xclaim test mygroup deleter-3 0 1673081722149-0 FORCE
1) 1) "1673081722149-0"
2) 1) "word"
2) "hello"
127.0.0.1:6379> xack test mygroup 1673081722149-0
(integer) 1
The last command should have returned a 0!