-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
New KeyShared consumers will not get any messages until a consumer that did get messages disconnects or acks/nacks some messages #15705
Comments
It's expected behavior because the old consumer has unacked messages, the new messages after the Here is more context about the key-shared subscription ordering guarantee |
@codelipenghui if I'm reading that correctly, that's really concerning behavior. If a topic has no consumers, and a backlog of message index:key pairs Am I interpreting it correctly that: a new key shared consumer that connects to the topic when the newest message has position If that's the current behavior, it should be really prominently documented (potentially in a warning/highlighted way). |
Yes, it will not break the key shared semantics, but it's an implementation tradeoff, the current implementation doesn't need to maintain the state for each key since a topic might have a huge number of keys. The behavior you described is expected for the current implementation(maybe not the best solution for now).
Yes, correct.
Yes, make sense, we will add the document. |
Hi @momo-jun can you help add that note? Thanks |
@codelipenghui thank you for the explanation; that makes sense. Two clarifications:
|
C2 will joined and be marked that it can only receive messages dispatched from the moment it joins. In this example, a message nacked by c1, will still get redelivered to c1 (unless c1 disconnects), because the keys are not switched until everything that c1 has already received is acked. Otherwise, we could get a nack on one message and then on another and they could end up being out of order, eg: if c2 also goes away.
"each key which has messages that have been dispatched to a consumer." ... for which the worst case scenario is to track every key :) |
Your broker.conf file changed to: |
@merlimat that's not accurate; if I start a KeyShared consumer Is that not supposed to happen? The docs seem to indicate that this is expected:
Additionally, how does allowOutOfOrderDelivery work with the Python/C++ client? Is that on by default? Off by default? Lastly, how does the setting that @xuesongxs mentioned ( |
The issue had no activity for 30 days, mark with Stale label. |
Can outOfOrderDelivery mitigate issues with consumers getting stuck, because obviously we don't care about ordering at this case? |
Describe the bug
If a KeyShared consumer has any unacknowledged messages, new KeyShared consumers on the same subscription after that point will not get any new messages (even messages with brand new keys) until the original consumer either disconnects or acks/nacks some indeterminate number of messages.
This is a really bad bug!
Bug scenario 1
key1
, using a KeyBased batching strategy.Press a key to acknowledge messages
.Press a key to acknowledge messages
depending on whetherkey1
is assigned to it (but it will never print that if this bug is in effect).key1
; saykey2
,key3
, and so on. The goal here is to get a key that hashes to the second consumer's range.Bug scenario 2
key1
,key2
throughkey100
).Press a key to acknowledge messages
.Press a key to acknowledge messages
), even though hash range redistribution should have allocated at least some of the 100 keys to the new consumer.Consumer code
Expected behavior
In scenario 1, the second consumer should receive at least some messages in step 7.
In scenario 2, the second consumer should receive messages as soon as it starts in step 5.
In short, I think hash range redistribution is not working right, or is not triggering message re-routing: when new KeyShared consumers arrive, two things should happen:
In scenario 1, neither part is working.
In scenario 2, part 1 is working, but I think part 2 is not.
Environment:
Same environment as apache/pulsar-client-python#190
The text was updated successfully, but these errors were encountered: