Repository navigation
Conversation
`Iceberg::writeMetadataFile` is the commit point of every storage-side Iceberg commit (INSERT, DELETE/UPDATE, ALTER, OPTIMIZE [MANIFEST], DROP PARTITION, expire_snapshots). It returned `false` for every failure except a short list of refused writes (ClickHouse#125406), and every caller reads `false` as a lost commit race and retries. Any other error that repeats on every attempt was therefore retried up to the limit and then reported as something else, with the real error only in the log, once per attempt. In ClickHouse#126287 gzip metadata with `output_format_compression_level = 18` makes zlib reject the level before anything is written: `OPTIMIZE ... MANIFEST` ended in `LOGICAL_ERROR` after 100 attempts, INSERT in `DATALAKE_DATABASE_ERROR`, `ALTER ... DELETE` in `LIMIT_EXCEEDED`. Decide a lost race by the state that defines it, a file at the target path: after a failed write, the error propagates while the file is absent, and the commit is retried (as before) when it is present or the check itself fails. An error of the existence check before the write propagates too, since nothing was written. The per-backend refused-write list is no longer needed: every refused write leaves the file absent. No backend's conflict error has to be recognised, because a lost race on local storage, S3/GCS (412) or Azure leaves the competing commit's file there. A file that is present because our own write landed before the response was lost keeps master's behaviour (ClickHouse#115390 handles that case). `compactIcebergManifests` reported running out of retries as `LOGICAL_ERROR`; it is reachable with enough concurrent commits, so report it as `LIMIT_EXCEEDED` like the other commit loops. `tryWriteVersionHintFile` keeps retrying everything: it runs after the commit landed, so propagating its errors would reach the callers' cleanup after the new snapshot became current. Related: ClickHouse#126287 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…etadataFile comments The test now has an arm for each commit caller the changelog entry names: ALTER TABLE ... UPDATE, ALTER TABLE ... ADD COLUMN and DROP PARTITION (on a partitioned table) next to the issue's OPTIMIZE ... MANIFEST, INSERT and DELETE. On master each of the three new statements fails with LIMIT_EXCEEDED after about 100 retries; with the fix each fails with ZLIB_DEFLATE_FAILED on the first attempt. The writeMetadataFile comments no longer say that false means another commit took the version: the file present after a failed write can also be this commit's own write, as on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…mmit's in the tests Three test comments (the ThrowingObjectStorage class comment and the LostRaceStaysRetryable comment in gtest_iceberg_commit_propagation.cpp, and the header of 05508_iceberg_commit_non_race_write_error.sh) still described the file present after a failed write as another commit's. It can also be this commit's own write, and a failed check after the write is retried too, so they now say what the code checks: whether a file holds the target version afterwards. Comment-only change. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 4 findings over 3 rounds, none in the last) plus my own review.
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261105-160600 |
|
cc @PedroTadim @SmitaRKulkarni, could you review this and add the |
|
Workflow [PR], commit [3726d65] Summary: ✅
AI ReviewSummaryReviewed head Missing context / blind spots
Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units8 translation units recompiled, 26 s compile time in total, 8 of them have a recent master baseline. |
CI finish ledger - 088fc9aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261105-223008 |
…y-only-lost-race Resolve the conflict with ClickHouse#125026 in `writeMetadataFile`: keep its Debug log for a conditional write conflict, and rethrow from both catch arms while the metadata file is absent instead of only for the refused-write list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #126287
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
An Iceberg write (
INSERT,ALTER TABLE ... DELETE/UPDATE,ALTER TABLE ... ADD COLUMN,DROP PARTITION,OPTIMIZE TABLE ... MANIFEST) whose metadata file cannot be written now fails with the write's own error right away, instead of retrying the commit up to 100 times as if it had lost a race and then failing withLIMIT_EXCEEDED,DATALAKE_DATABASE_ERRORorLOGICAL_ERROR. Running out of retries inOPTIMIZE TABLE ... MANIFESTis now reported asLIMIT_EXCEEDEDinstead ofLOGICAL_ERROR.Description
Iceberg::writeMetadataFilereturnedfalsefor every write error except a list of refused writes (#125406), and every caller readsfalseas a lost commit race and retries. In #126287 (gzip metadata,output_format_compression_level = 18) zlib rejects the level before anything is written, soOPTIMIZE TABLE ... MANIFESTended inLOGICAL_ERRORafter 100 attempts (an abort in debug builds),INSERTinDATALAKE_DATABASE_ERRORandALTER TABLE ... DELETEinLIMIT_EXCEEDED.A failed write now counts as a lost race only when a file holds the target version afterwards: the error propagates while the file is absent, and the commit is retried, as before, when the file is present or the check cannot tell. An error of the existence check before the write also propagates. This replaces the refused-write list: lost races on local storage, S3 (412) and Azure (409) all leave the competing commit's file. The MANIFEST compaction loop now reports exhaustion as
LIMIT_EXCEEDED, like the other commit loops.Behaviour change: an error that the storage returns (after the client's own retries) now fails the statement instead of restarting the commit. Unchanged: the version-hint write (it runs after the commit has landed), and a file present because this commit's own write landed before the error. That case, and a write that lands only after the check, are the unknown-outcome case of my open #115390, which reads the file back. My open #125026 only changes the log level in the same catch arm.
Validation: the new test runs the issue's three statements plus
UPDATE,ADD COLUMNandDROP PARTITION, and fails on master. The concurrent-writer integration tests pass on local, S3 and Azure, and their logs show real 412/409 conflicts being retried.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/129555]