Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Balance and retain consensus subscription ownership
Consensus subscription previously selected each Region owner with
floorMod(regionId.hashCode(), activeConsumerCount). Hash collisions can leave consumers withoutany Region even when the consumer count does not exceed the Region count. For example, the
reproduced 40-Region/40-consumer topology assigned no Region to 9 consumers. When those consumers
stopped polling, each membership change also rehashed every Region and caused cascading ownership
churn.
This change builds a balanced, sticky ownership snapshot:
Region is removed.
As a result, every consumer owns at least one Region whenever the consumer count is no greater than
the Region count, while joins, leaves, and Region changes move only the assignments required to
restore balance.
Report the unread WAL backlog in lag
The queue lag previously collapsed any unread WAL backlog to one extra unit. A queue with hundreds
of thousands of unread WAL search indexes could therefore report
lag=1.The updated lag adds already materialized lifecycle stages separately and uses the larger of the
pending-entry count and raw WAL search-index gap for the unmaterialized stage. Pending local entries
overlap the raw WAL gap until they advance the cursor, so this avoids double-counting while
preserving the actual backlog magnitude.
This PR deliberately does not change the global prefetch executor size or shared subscription
memory limits; those are separate scheduling and admission-policy decisions.
Verification
Tests run: 8, failures: 0, errors: 0, skipped: 0.
This PR has:
Key changed/added classes
ConsensusSubscriptionBrokerConsensusPrefetchingQueueConsensusSubscriptionBrokerOwnershipTestConsensusPrefetchingQueueTest