Skip to content

[FLINK-40384][snapshot] Only clean up terminal snapshots - #1185

Open
litiliu wants to merge 1 commit into
apache:mainfrom
litiliu:FLINK-40384
Open

litiliu wants to merge 1 commit into
apache:mainfrom
litiliu:FLINK-40384

Conversation

@litiliu

@litiliu litiliu commented Aug 19, 2026 •

Copy link
Copy Markdown

What is the purpose of the change

This pull request fixes FLINK-40384 by preventing periodic FlinkStateSnapshot history cleanup from deleting snapshot resources that are still active or have not initialized their status yet.

Previously, snapshots with a null status or in TRIGGER_PENDING / IN_PROGRESS state could be selected for cleanup. Deleting such snapshots can race with status reconciliation, resulting in Kubernetes 409 Conflict errors and repeated SavepointError events. With this change, only snapshots in terminal states are eligible for cleanup.

Brief change log

  • Restrict FlinkStateSnapshot cleanup to the terminal states COMPLETED, FAILED, and ABANDONED.
  • Preserve snapshots with a null status or an active TRIGGER_PENDING / IN_PROGRESS state.
  • Add regression tests covering snapshots without status and active snapshots.

Verifying this change

This change added tests and was verified as follows:

  • Ran SnapshotObserverTest; all 11 tests passed:
    mvn -pl flink-kubernetes-operator -am -Dtest=SnapshotObserverTest -Dsurefire.failIfNoSpecifiedTests=false test
  • Verified Spotless and Checkstyle checks pass.
  • Verified git diff --check passes.
  • Manually verified the change on a Kubernetes cluster.

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 changes to the CustomResourceDescriptors: no
  • Core observer or reconciler logic that is regularly executed: yes

Documentation

  • Does this pull request introduce a new feature? no
  • If yes, how is the feature documented? not applicable

Was generative AI tooling used to co-author this PR?
  • Yes (OpenAI Codex)

Generated-by: OpenAI Codex Reviewed by human and verified on k8s cluster.

@litiliu
litiliu marked this pull request as ready for review August 19, 2026 07:20
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