• Guy Benoish's avatar
    Blocking XREAD[GROUP] should always reply with valid data (or timeout) · 7f3fcedb
    Guy Benoish authored
    This commit solves the following bug:
    127.0.0.1:6379> XGROUP CREATE x grp $ MKSTREAM
    OK
    127.0.0.1:6379> XADD x 666 f v
    "666-0"
    127.0.0.1:6379> XREADGROUP GROUP grp Alice BLOCK 0 STREAMS x >
    1) 1) "x"
       2) 1) 1) "666-0"
             2) 1) "f"
                2) "v"
    127.0.0.1:6379> XADD x 667 f v
    "667-0"
    127.0.0.1:6379> XDEL x 667
    (integer) 1
    127.0.0.1:6379> XREADGROUP GROUP grp Alice BLOCK 0 STREAMS x >
    1) 1) "x"
       2) (empty array)
    
    The root cause is that we use s->last_id in streamCompareID
    while we should use the last *valid* ID
    7f3fcedb
t_stream.c 102 KB