[FLINK-40113][checkpoint] Reject restore when operators on a keyed vertex disagree on max parallelism#28714
Open
rionmonster wants to merge 2 commits into
Open
[FLINK-40113][checkpoint] Reject restore when operators on a keyed vertex disagree on max parallelism#28714rionmonster wants to merge 2 commits into
rionmonster wants to merge 2 commits into
Conversation
…ined operators disagree on max parallelism
…rtex disagree on max parallelism
Collaborator
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.
What is the purpose of the change
When operators are chained into a single vertex, each operator's recorded maximum parallelism is reconciled onto that shared vertex individually during state restore. Since FLINK-31996 relaxed chaining to allow operators with differing maximum parallelism to share a vertex, a keyed operator can be silently restored under a key-group count that is not its own if the chaining topology has changed since the checkpoint — its keyed state is then remapped through an incompatible
hash % maxParallelismlayout.Flink already rejects a single operator's incompatible maximum-parallelism change on restore, but never validates that operators sharing a vertex agree with each other, so the per-vertex reconciliation silently adopts whichever value is applied last. This change closes that consistency gap by rejecting such a restore with a clear error instead of restoring keyed state improperly.
Brief change log
checkMaxParallelismAgreementinStateAssignmentOperation, invoked before the per-operator reconciliation incheckParallelismPreconditions.IllegalStateExceptionwhen its operators recorded differing maximum parallelism; the comparison spans all chained operators, since a non-keyed operator's recorded value can win the reconciliation and misroute a keyed operator's state.ChainingMaxParallelismStateLossITCasecovering both directions (explicit value below and above the chain head's) on the HashMap and RocksDB backends.Verifying this change
This change added tests and can be verified as follows:
ChainingMaxParallelismStateLossITCasetakes a canonical savepoint with operator chaining disabled (the keyed operator is its own vertex at an explicit maximum parallelism), then restores with chaining enabled (the keyed operator chains under the source head, whose derived maximum parallelism differs). It asserts the restore is rejected with the new error for both directions and both state backends.StateAssignmentOperationTestandCheckpointCoordinatorRestoringTestcontinue to pass, confirming the new check is additive and runs only on restore.Does this pull request potentially affect one of the following parts:
@Public(Evolving): noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 4.8 (1M context)