Skip to content

Stream: Inconsistency between master and replica some XCLAIM case #6744

@valentinogeron

Description

@valentinogeron

When XCLAIM changes the ownership of an already pending message to the specified consumer, the consumer will be created if it does not exist.

However, the master propagates XCLAIM command only if at least one of the ids was claimed. So, if the consumer did not exist before, the consumer would be created only in master.

for example:
master

127.0.0.1:6379> XGROUP CREATE s g $ MKSTREAM
OK
127.0.0.1:6379> XADD s * f v
"1578330523265-0"
127.0.0.1:6379> XREADGROUP GROUP g c1 STREAMS s >
1) 1) "s"
   2) 1) 1) "1578330523265-0"
         2) 1) "f"
            2) "v"
127.0.0.1:6379> XINFO CONSUMERS s g
1) 1) "name"
   2) "c1"
   3) "pending"
   4) (integer) 1
   5) "idle"
   6) (integer) 35690
127.0.0.1:6379> XCLAIM s g c2 100000 1578330523265-0
(empty array)
127.0.0.1:6379> XINFO CONSUMERS s g
1) 1) "name"
   2) "c1"
   3) "pending"
   4) (integer) 1
   5) "idle"
   6) (integer) 77355
2) 1) "name"
   2) "c2"
   3) "pending"
   4) (integer) 0
   5) "idle"
   6) (integer) 5208

replica

127.0.0.1:6380> XINFO CONSUMERS s g
1) 1) "name"
   2) "c1"
   3) "pending"
   4) (integer) 1
   5) "idle"
   6) (integer) 91311

There are 2 available options:

  1. Creates the consumer only if there is at least one claimed id
  2. Send XCLAIM with no ids to the replica

I think that option 1 is more suited.
@antirez what do you think? I can implement it and PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions