Skip to content

[FLINK-38049] Fix stateless job incorrectly using last-state restore when HA is enabled#1147

Draft
lucasgameiroborges wants to merge 1 commit into
apache:mainfrom
lucasgameiroborges:fix/flink-38049-stateless-ha-resubmit
Draft

[FLINK-38049] Fix stateless job incorrectly using last-state restore when HA is enabled#1147
lucasgameiroborges wants to merge 1 commit into
apache:mainfrom
lucasgameiroborges:fix/flink-38049-stateless-ha-resubmit

Conversation

@lucasgameiroborges

Copy link
Copy Markdown

What is the purpose of the change

When HA is enabled and a stateless job is resubmitted (e.g. due to an unhealthy cluster), resubmitJob unconditionally overrode the upgrade mode to LAST_STATE and passed requireHaMetadata=true to restoreJob, ignoring the user-configured STATELESS upgrade mode. This caused the job to attempt a last-state restore from HA metadata instead of starting fresh.

Brief change log

  • AbstractJobReconciler#resubmitJob: skip the LAST_STATE mode override and the requireHaMetadata flag when the spec's upgrade mode is STATELESS
  • Add ApplicationReconcilerTest#testRestartUnhealthyStatelessJobWithHaEnabled to reproduce the scenario: a stateless job with HA enabled is resubmitted after an unhealthy event with no HA metadata available — previously this would throw UpgradeFailureException, now it succeeds

Verifying this change

New unit test testRestartUnhealthyStatelessJobWithHaEnabled in ApplicationReconcilerTest covers the fix. Existing ApplicationReconcilerTest and ApplicationReconcilerUpgradeModeTest suites (109 tests total) continue to pass.

Does this pull request potentially affect one of the following areas

  • Job lifecycle/upgrade: yes — affects resubmit path for stateless jobs when HA is active

This is a fix for FLINK-38049.

@lucasgameiroborges
lucasgameiroborges force-pushed the fix/flink-38049-stateless-ha-resubmit branch 4 times, most recently from 52e18d6 to a92052b Compare June 23, 2026 13:51
…when HA is enabled

When HA is enabled and a stateless job is resubmitted due to being unhealthy,
resubmitJob unconditionally set the upgrade mode to LAST_STATE and required HA
metadata, ignoring the configured STATELESS upgrade mode. Now both the mode
override and the requireHaMetadata flag are skipped when the spec is STATELESS.
@lucasgameiroborges
lucasgameiroborges force-pushed the fix/flink-38049-stateless-ha-resubmit branch from a92052b to eb5241a Compare June 23, 2026 13:53
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.

1 participant