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

[5.0.3] [Stream] message stays in PEL after deleting #5718

Closed
bagbag opened this issue Dec 22, 2018 · 2 comments
Closed

[5.0.3] [Stream] message stays in PEL after deleting #5718

bagbag opened this issue Dec 22, 2018 · 2 comments

Comments

@bagbag
Copy link

bagbag commented Dec 22, 2018

I'm not sure wether this behavior is wanted or not, but I did not expected that a message is returned with xpending after deleting it. I did not found any statement about the desired behavior in the documentation.

Reproduction

127.0.0.1:6379> xgroup CREATE stream group $ MKSTREAM
OK
127.0.0.1:6379> xadd stream * foo bar
"1545511203225-0"
127.0.0.1:6379> xreadgroup GROUP group consumer STREAMS stream >
1) 1) "stream"
   2) 1) 1) "1545511203225-0"
         2) 1) "foo"
            2) "bar"
127.0.0.1:6379> xdel stream 1545511203225-0
(integer) 1
127.0.0.1:6379> xpending stream group - + 10
1) 1) "1545511203225-0"
   2) "consumer"
   3) (integer) 46208
   4) (integer) 1
127.0.0.1:6379> xrange stream - +
(empty list or set)
Off Topic (question)

My goal is to create a queue. When I've get long pending entries (for whatever reason), I obviously want consumers to retry it. But I dont want to manually select the new consumer, but rather something like "give it the next free consumer (using XREADGROUP)". Thats why I just delete the entries and add them again with an transaction to let redis take care of consumer selection. Something like an "automated" XCLAIM on XREADGROUP for that consumer would be nice to be able to use the delivery counter and keep the same ID (but probably doesn't fit well into the API design, at least I didn't come up with something nice). With my method I have to alter the entry (with an in-data delivery counter) and must accept a new ID.

Am I missing something or is that the only way of achieving that?

@soloestoy
Copy link
Collaborator

It seems by designed, the pending entry list just contains entries have not received ACK, PEL doesn't care about the entry is existed or not, but I'm not sure, ping @antirez here. BTW XTRIM could lead to the issue too.

@soloestoy
Copy link
Collaborator

Related to #5754, it's by designed.

@bagbag bagbag closed this as completed Mar 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants