Skip to content

[FLINK-36973][config] Skip options not explicitly set when converting SavepointRestoreSettings to Configuration#28295

Open
AlexYinHan wants to merge 1 commit into
apache:masterfrom
AlexYinHan:yh/dev_39673
Open

[FLINK-36973][config] Skip options not explicitly set when converting SavepointRestoreSettings to Configuration#28295
AlexYinHan wants to merge 1 commit into
apache:masterfrom
AlexYinHan:yh/dev_39673

Conversation

@AlexYinHan

Copy link
Copy Markdown
Contributor

What is the purpose of the change

This PR fixes the issue in FLINK-39673. It skips writing RESTORE_MODE and SAVEPOINT_IGNORE_UNCLAIMED_STATE from SavepointRestoreSettings into Configuration when they were not explicitly provided. If the user uses deprecated configuration keys for these options, this prevents the configurations from being overridden by default values.

Brief change log

  • In SavepointRestoreSettings, change the allowNonRestoredState and recoveryClaimMode from NonNull to Nullable, to tell whether they are explicitly provided.
  • Modify SavepointRestoreSettings.toConfiguration() to skip writing RESTORE_MODE and
    SAVEPOINT_IGNORE_UNCLAIMED_STATE when they were not explicitly provided by the user.

Verifying this change

This change added tests and can be verified as follows:

  • SavepointRestoreSettingsTest.java Added test that validates that default/null values of SavepointRestoreSettings are correctly handled

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: [Claude-4.6-Opus]

@flinkbot

flinkbot commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@AlexYinHan AlexYinHan force-pushed the yh/dev_39673 branch 5 times, most recently from e128b73 to 6fa1a89 Compare June 8, 2026 09:30

@lincoln-lil lincoln-lil left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlexYinHan Thanks for fixing this! I've left two comments there, PTAL.

* operator that is not part of the job.
*/
private final boolean allowNonRestoredState;
private final @Nullable Boolean allowNonRestoredState;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the boolean → Boolean change necessary? This may produces incompatible Java serialization. Since SavepointRestoreSettings is embedded in JobGraph and Java-serialized occurs during e.g., session cluster submission, this may silently drops field values in mixed-version clusters (e.g., new cli → old server). The unchanged serialVersionUID suppresses InvalidClassException, making the failure silent.
So could we either update the UID or keep primitive fields and track explicitly set separately?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing it out. I forgot to consider the serialization problem here. I keep the primitive boolean field and add a allowNonRestoredStateExplicitlySet to track it separately.

allowNonRestoredState,
StateRecoveryOptions.RESTORE_MODE.defaultValue());
String savepointPath, @Nullable Boolean allowNonRestoredState) {
return new SavepointRestoreSettings(savepointPath, allowNonRestoredState, null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since checkNotNull was removed, the savepointPath should also add @Nullable annotation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. All forPath methods now either call checkNotNull or add @Nullable annotation.

@AlexYinHan

Copy link
Copy Markdown
Contributor Author

@lincoln-lil Thanks for your comments. I have modified the code accordingly. PTAL :)

@lincoln-lil

Copy link
Copy Markdown
Contributor

LGTM from my side. Could you also have a look when you get a chance? cc @kl0u

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants