Exclude superseded producer epochs from maintenance readiness - #669
Merged
Merged
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.
Why
After a producer partition restarts, the coordinator could still use its old barrier to report readiness and return both old and new epoch inputs in the same batch.
What
Select one active epoch per partition from both staged inputs and watermarks. Ready batches contain only that epoch, and newly arriving superseded-epoch inputs are rejected before checkpoint mutation.
How
Readiness and barrier completeness use the same epoch map. Observing a new staged epoch invalidates the prior epoch's readiness immediately; the new epoch must supply its own inputs and barriers. Existing identical retries remain idempotent. Historical metadata is retained.
Before this PR
Stage epoch 1 inputs and barriers, then stage epoch 2 inputs without barriers: the coordinator incorrectly returns ready, including stale contributions.
After this PR
That batch waits for both epoch 2 barriers and contains exactly the two epoch 2 inputs. Restart preserves the decision. A new epoch 1 input cannot mutate staged state after epoch 2 is observed.
Verification
78001618.Limits
This fixes the existing coordinator's readiness contract; it does not wire continuous ingestion or claim automatic maintenance completion. Superseded metadata is retained for audit/retry, not garbage-collected. Recovery of uncommitted older-epoch work needs an explicit valid completion/replay proof; this change does not infer one.