[FLINK-39967] Fix backoffLimit=-1 to mean unlimited retries in FlinkStateSnapshot#1084
Merged
Merged
Conversation
d25b9df to
8e18ecb
Compare
Contributor
|
Can you please attach a JIRA to this PR? |
…eSnapshot The default backoffLimit of -1 (documented as "unlimited retries") causes snapshots to immediately fail after the first error. The check `failures > backoffLimit` evaluates to `1 > -1` which is always true, so no retries ever happen with the default configuration. This test is expected to fail until the bug is fixed.
The spec documents backoffLimit=-1 (the default) as "unlimited retries", but the controller compared `failures > backoffLimit` without handling the -1 sentinel. After the first failure (failures=1), `1 > -1` was true, so the snapshot was marked FAILED with withNoRetry() -- the opposite of unlimited. Guard the no-retry branch with `backoffLimit >= 0` so: -1 -> retries indefinitely (default) 0 -> no retries N -> retries up to N times Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
cfdf159 to
91654f3
Compare
backoffLimit=-1 to mean unlimited retries in FlinkStateSnapshot
gyfora
approved these changes
Jun 22, 2026
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
FlinkStateSnapshotSpec.backoffLimitdefaults to-1, documented as meaning "unlimited" retries. However, the retry decision inFlinkStateSnapshotControllerdid a plain numeric comparisonfailures > backoffLimit. With the default-1, after the first failurefailuresis1, so1 > -1is alwaystrueand the snapshot was immediately marked failed with no retry - the exact opposite of the documented behavior.This PR fixes the comparison so that a negative
backoffLimit(the-1sentinel) correctly means "retry indefinitely", while0means no retries andNmeans up toNretries.Brief change log
backoffLimit < 0as "unlimited retries" inFlinkStateSnapshotController, so the documented-1default actually retries indefinitely instead of failing on the first error.backoffLimit=-1is retried after a failure rather than immediately failing).Verifying this change
This change added tests and can be verified as follows:
FlinkStateSnapshotControllerTestcovers a snapshot failure with the defaultbackoffLimit=-1and asserts the snapshot is rescheduled for retry (with exponential backoff) instead of being marked failed with no retry.Does this pull request potentially affect one of the following parts:
CustomResourceDescriptors: noDocumentation