Skip to content

Remove Iceberg orphan files on failure - #127275

Merged
SmitaRKulkarni merged 7 commits into
masterfrom
iceberg_clean_on_fail
Oct 26, 2026
Merged

SmitaRKulkarni merged 7 commits into
masterfrom
iceberg_clean_on_fail

Conversation

@SmitaRKulkarni

@SmitaRKulkarni SmitaRKulkarni commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Remove Iceberg orphan files on failure


Workflow [PR]
Sync PR [sync-upstream/pr/127275]

Version info

  • Merged into: 26.11.1.785-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fdba827]

Summary: ✅


AI Review

Summary

The PR removes uncommitted Iceberg data files and manifests when IcebergStorageSink is destroyed, including after pipeline cancellation, while preserving files after a successful commit. The prior cancellation finding is addressed, and there are no remaining actionable findings. The added regression passed 50 targeted ASan runs and bugfix validation on 3fdc72c307b04b115981e7886ad51452b6feca13; the reviewed source and test files are unchanged at head fdba827eb61021155ab9ea82079302c3916a4b72.

Missing context / blind spots
  • ⚠️ Current-head targeted test results were still pending during review. Confirm their result in the Praktika report. No local build or runtime tests were run.
Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 21, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. label Oct 21, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing fdba827eb with master 3954b49bc (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 681c21c36; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

16 translation units recompiled, 136 s compile time in total, 16 of them have a recent master baseline.

Job report

@SmitaRKulkarni
SmitaRKulkarni added this pull request to the merge queue Oct 26, 2026
Merged via the queue into master with commit 13b175c Oct 26, 2026
179 checks passed
@SmitaRKulkarni
SmitaRKulkarni deleted the iceberg_clean_on_fail branch October 26, 2026 10:11
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 26, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 8, 2026
Master's ClickHouse#127275 made `~IcebergStorageSink` remove the written data files
and manifests whenever the insert did not commit. When the catalog commit
fails with an unknown outcome, `initializeMetadata` already skips its own
cleanup, but the exception leaves `committed` false, so the destructor then
deleted the files of a snapshot that may be the table's current one.

Measured on the merged tree: the Glue arms `test_glue_commit_unknown_keeps_files`
and `test_glue_commit_read_back_raising_keeps_files` failed with
`S3_ERROR ... key does not exist ... metadata/<uuid>.avro`. The REST arms
stayed green only because they asserted `count()`, which Iceberg answers from
the snapshot summary without opening the manifests or data files. They now
count through `WHERE NOT ignore(*)`, and on the unfixed binary the four INSERT
unknown-outcome arms fail with the same missing-manifest error; DELETE,
OPTIMIZE and DROP PARTITION have no such destructor and stayed green.

The unknown branch now sets `committed`, whose meaning becomes "is, or may
be, committed".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Nov 9, 2026
Master's ClickHouse#127275 made `~IcebergStorageSink` remove the written data
files and manifests whenever the insert did not commit. An
`UNKNOWN_STATUS_OF_TRANSACTION` from `initializeMetadata` leaves
`committed` false, so the destructor deleted the files of a snapshot
the table may already point at, after the commit path had deliberately
kept them. 04929's unknown-outcome INSERT case caught it after the
master merge: a data file and a manifest gone, `SELECT sum(c0)` failing
FILE_DOESNT_EXIST on the manifest.

Record the unknown outcome and skip the destructor's cleanup for it.
Inserts that fail any other way still remove their files (05441 passes).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... and removed comp-datalake Data lake table formats (Iceberg/Delta/Hudi) integration. labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-iceberg Apache Iceberg tables: reading and writing Iceberg metadata (snapshots, manifests, schema evoluti... pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants