-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Closed
Description
Describe
When the stream is trimmed and the consumer group's last_id is behind
the first entry, the consumer group's lag is reported as the remaining
elements in the stream. (#13473)
But after the next read in the group the lag goes back to be incorrect
because the entries_read
Reproduce
127.0.0.1:6379> DEL x
127.0.0.1:6379> XADD x 1-0 data a
127.0.0.1:6379> XADD x 2-0 data b
127.0.0.1:6379> XADD x 3-0 data c
127.0.0.1:6379> XADD x 4-0 data d
127.0.0.1:6379> XADD x 5-0 data e
127.0.0.1:6379> XGROUP CREATE x g1 0
127.0.0.1:6379> XREADGROUP GROUP g1 c11 COUNT 1 STREAMS x >
127.0.0.1:6379> XTRIM x MAXLEN 1
127.0.0.1:6379> XINFO GROUPS x
1) 1) "name"
2) "g1"
3) "consumers"
4) (integer) 1
5) "pending"
6) (integer) 1
7) "last-delivered-id"
8) "1-0"
9) "entries-read"
10) (integer) 1
11) "lag"
12) (integer) 1
127.0.0.1:6379> XREADGROUP GROUP g1 c11 COUNT 1 STREAMS x >
1) 1) "x"
2) 1) 1) "5-0"
2) 1) "data"
2) "e"
127.0.0.1:6379> XINFO GROUPS x
1) 1) "name"
2) "g1"
3) "consumers"
4) (integer) 1
5) "pending"
6) (integer) 2
7) "last-delivered-id"
8) "5-0"
9) "entries-read"
10) (integer) 2
11) "lag"
12) (integer) 3 # it should be 0 there are not new messages
127.0.0.1:6379> XREADGROUP GROUP g1 c11 COUNT 1 STREAMS x >
(nil)Metadata
Metadata
Assignees
Labels
No labels