Skip to content

Core: do not delete files on a failed SnapshotProducer commit (LAKE-7128) - #23

Draft
rayhondo wants to merge 2 commits into
1.11.0-affirm-patchfrom
raykim/cleanall-nb
Draft

rayhondo wants to merge 2 commits into
1.11.0-affirm-patchfrom
raykim/cleanall-nb

Conversation

@rayhondo

@rayhondo rayhondo commented Oct 7, 2026

Copy link
Copy Markdown

Problem

SnapshotProducer.commit() calls cleanAll() when the commit fails with a CleanableFailure (or with strict cleanup). If the catalog has already applied the commit but answered 409 (CommitFailedException), the client retries, a validator throws on the retry, and cleanAll() deletes the manifest list and manifests of the snapshot the catalog committed. The table then points at files that no longer exist.

This took the prod UK job lake-log-prod-users-1-schedule down for about 4h17m on 2026-10-04 (LAKE-7128). It was restored from S3 object versions.

Change

  • Remove the cleanAll() call from the failure path of commit(). The failure is logged at WARN with the manifest lists left in place, and then rethrown unchanged.
  • Remove the now-unused CleanableFailure / Exceptions imports and the strictCleanup field.
  • Cleanup after a successful commit and cleanup of discarded attempts inside the apply retry loop are not changed.

Cost: files from a commit that really failed are no longer deleted at failure time. They become orphans that orphan-file removal has to collect.

Tests

  • New repro in TestSnapshotProducer: committedSnapshotFilesKeptWhenRetryValidationFailsAfterAppliedCommit (format versions 1-4). It fails on the base branch and passes with this change. A control test (uncommittedFilesCleanedUpWhenRetryValidationFailsAfterConcurrentCommit) is kept.
  • Existing tests that asserted cleanup on failure are changed to assert the files are left in place: TestFastAppend, TestMergeAppend, TestRewriteFiles, TestRowDelta, TestRESTCatalog.
  • Ran on Java 21: TestSnapshotProducer, TestFastAppend, TestMergeAppend, TestRewriteFiles, TestRowDelta, TestRESTCatalog. 1,049 tests, 0 failures, 0 errors, 85 skipped (not inspected). Other modules were not run.

Open before merge

  • Does orphan-file removal run on every table this affects? Failed commits will now leave files behind.
  • How often do commits fail in production? That sets how many orphans to expect.
  • Other modules' tests (Flink, Spark) were not run. requireStrictCleanup() is no longer read by SnapshotProducer.

An alternative that keeps cleanup but checks whether the commit actually landed is in a separate local branch and is not part of this PR.

Jira: LAKE-7128

🤖 Generated with Claude Code

rayhondo and others added 2 commits October 7, 2026 15:35
A commit that is applied by the catalog but reported as CommitFailedException is
retried; on retry a validator rejects the already-committed checkpoint, and the
CleanableFailure makes SnapshotProducer.cleanAll delete the committed snapshot's
manifest list and manifests. The first test fails today; the second is a control
that a genuine concurrent-commit failure still cleans up.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
SnapshotProducer.commit() called cleanAll() when a commit failed with a
CleanableFailure (or always, when strict cleanup is off). A catalog can apply
a commit and still report failure, e.g. a 409 for a lost or replayed request.
The retry then refreshes, sees its own snapshot, and a validator (such as
DynamicCommitter's checkpoint validator) rejects it with a ValidationException,
which is a CleanableFailure. cleanAll() then deleted the manifest list and
manifests of a snapshot the catalog had already committed, leaving the table
pointing at missing files.

On failure, rethrow without deleting anything and log the manifest list paths
that are left in place so leaked files can be traced. Files from a genuinely
failed attempt now leak until orphan file removal. The success-path cleanup,
cleanAll() and cleanUncommitted() are unchanged. The now-unused strictCleanup
field is removed.

Tests that asserted failure-path cleanup now assert the files remain:
TestSnapshotProducer (control test inverted), TestFastAppend, TestMergeAppend,
TestRewriteFiles, TestRowDelta and TestRESTCatalog.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the CORE label Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant