GeezerVison is showing github.com — [fix][broker] Prevent stale consumer removal from removing replacements by Denovo1998 · Pull Request #26652 · apache/pulsar
Conversation
Denovo1998
commented
Sep 19, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
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
- Require the exact registered consumer instance before removing dispatcher membership or debiting its unacknowledged messages.
- Remove consumer list entries by identity while maintaining priority counts, including defensive cleanup and failed-add cleanup.
- Protect replacement consumers from stale AUTO_SPLIT removals.
- Preserve cleanup for STICKY additions that complete after dispatcher removal. Remove selector ranges and classic recently-joined records by identity.
- Apply the changes to both classic and newer persistent dispatchers.
Verifying this change
- Make sure that the change passes the CI checks.
(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:)
- Added integration tests for end-to-end deployment with large payloads (10MB)
- Extended integration test for recovery after broker failure
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
- Dependencies (add or upgrade a dependency)
- The public API
- The schema
- The default values of configurations
- The threading model
- The binary protocol
- The REST endpoints
- The admin CLI options
- The metrics
- Anything that affects deployment
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…elector removal uses identity.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 22, 2026
nodece
pushed a commit
to ascentstream/pulsar
that referenced
this pull request
Nov 16, 2026
Reviewers
lhotari
lhotari approved these changes
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|