Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XINFO GROUPS fails to deduplicate; returns invalid pending #2568

Open
1 of 2 tasks
nathanlo-hrt opened this issue Oct 1, 2024 · 2 comments
Open
1 of 2 tasks

XINFO GROUPS fails to deduplicate; returns invalid pending #2568

nathanlo-hrt opened this issue Oct 1, 2024 · 2 comments
Labels
bug type bug

Comments

@nathanlo-hrt
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Version

unstable commit b8cf118

Minimal reproduce step

127.0.0.1:3847> FLUSHALL
OK
127.0.0.1:3847> XGROUP CREATE stream1 group 0 MKSTREAM
OK
127.0.0.1:3847> XGROUP CREATE stream2 group 0 MKSTREAM
OK
127.0.0.1:3847> XREADGROUP GROUP group consumer STREAMS stream1 stream2 0 0
(nil)
127.0.0.1:3847> XINFO GROUPS stream2
1)  1) "name"
    2) "group"
    3) "consumers"
    4) (integer) 1
    5) "pending"
    6) (integer) 0
    7) "last-delivered-id"
    8) "0-0"
    9) "entries-read"
   10) (nil)
   11) "lag"
   12) (integer) 0
2)  1) "name"
    2) "group"
    3) "consumers"
    4) (integer) 0
    5) "pending"
    6) (integer) 1727818077688
    7) "last-delivered-id"
    8) "1727818077688-0"
    9) "entries-read"
   10) (integer) 0
   11) "lag"
   12) (integer) 0

What did you expect to see?

The following output comes from Redis:

127.0.0.1:6379> FLUSHALL
OK
127.0.0.1:6379> XGROUP CREATE stream1 group 0 MKSTREAM
OK
127.0.0.1:6379> XGROUP CREATE stream2 group 0 MKSTREAM
OK
127.0.0.1:6379> XREADGROUP GROUP group consumer STREAMS stream1 stream2 0 0
1) 1) "stream1"
   2) (empty array)
2) 1) "stream2"
   2) (empty array)
127.0.0.1:6379> XINFO GROUPS stream2
1) 1) "name"
   2) "group"
   3) "consumers"
   4) (integer) 1
   5) "pending"
   6) (integer) 0
   7) "last-delivered-id"
   8) "0-0"

There are a few notable differences here:

  1. XREADGROUP GROUP returns stream1 and stream2 as empty arrays instead of returning nil for the entire request
  2. XINFO GROUPS stream2 doesn't return a duplicated consumer group
  3. XINFO GROUPS stream2 correctly returns pending = 0

What did you see instead?

XINFO GROUPS returns duplicated consumer groups, and returns an incorrect value for pending.

Anything Else?

No response

Are you willing to submit a PR?

  • I'm willing to submit a PR!
@jonathanc-n
Copy link
Contributor

@Yangsx-1 I didn't deal with the second part of that bug, as it was a logical error in the code and I wasn't too familiar with the implementation of the stream functions. As for directions, I believe the conflict arises due to how consumer groups are managed for different streams. The problem persists when more streams are added.

@LindaSummer
Copy link
Contributor

@Yangsx-1 I didn't deal with the second part of that bug, as it was a logical error in the code and I wasn't too familiar with the implementation of the stream functions. As for directions, I believe the conflict arises due to how consumer groups are managed for different streams. The problem persists when more streams are added.

Hi @jonathanc-n ,

I'd like to try to solve the rest part of this issue if you don't mind. 😊

Best Regards,
Edward

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug type bug
Projects
None yet
Development

No branches or pull requests

3 participants