Repository navigation
[fix][broker] Prevent stale consumer removal from removing replacements - #26652
Conversation
lhotari
left a comment
There was a problem hiding this comment.
Thanks for protecting replacement consumers across both dispatcher implementations. The identity checks look sound for completed additions, but the new Key_Shared early return drops cleanup for a STICKY addition that completes after removal. Please preserve that cleanup and cover the delayed-add case.
…elector removal uses identity.
lhotari
left a comment
There was a problem hiding this comment.
LGTM. The one open point is handled in cc0311f. STICKY consumers now run the full removal path even when they are no longer registered, so a late selector addition is cleaned up on the repeated close. The selector and the Classic recently-joined map remove by identity, so an equal replacement keeps its range. The new test covers the late addition and the repeated close.
The branch now conflicts with master, so it needs a merge of master before it can go in.
Okay, conflict processed. |
lhotari
left a comment
There was a problem hiding this comment.
LGTM. Thanks for merging master. The merge dropped the Classic dispatcher edits because master removed those classes, and nothing in the tree refers to them any more. The remaining fix is unchanged: the STICKY removal path in PersistentStickyKeyDispatcherMultipleConsumers.java:345-356 and the identity-based selector removal still cover the late addition and the repeated close, and the new tests are intact.
…ts (apache#26652) (cherry picked from commit 668c16d)
…ts (apache#26652) (cherry picked from commit 668c16d)
Follow-up to #26422.
Related to #26289.
Motivation
A delayed removal of an old consumer can match a replacement consumer through
Consumer.equals(), even though they are different instances. This can remove the replacement from dispatcher membership and debit the old consumer's unacknowledged messages again. For Key_Shared subscriptions, the stale removal can also remove the replacement from the selector and prevent further delivery.Modifications
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes