Repository navigation
Log a lost Iceberg metadata commit race at Debug, not Error - #125026
alexey-milovidov merged 6 commits into
Conversation
Each sink of a parallel INSERT into an Iceberg table commits its own
snapshot, so with max_insert_threads > 1 the sinks race for the same
metadata version. The loser's conditional write fails with
FILE_ALREADY_EXISTS (local, If-None-Match), STALE_VERSION (local,
If-Match) or an S3 412 PreconditionFailed, and the caller retries on
the next version. writeMetadataFile and tryWriteVersionHintFile logged
that expected outcome with tryLogCurrentException, i.e. at Error with a
stack trace, which reaches the client's stderr with
send_logs_level=warning and fails stateless tests such as
05325_iceberg_mixed_format_top_k_dynamic_filtering ("having stderror"),
although the INSERT succeeds and the data is correct.
Classify such a failure with one helper, isConditionalWriteConflict,
and log only that case at Debug, keeping every other failure at Error.
This matches the REST catalog commit path (409 is logged at Debug) and
the S3 layer, which already logs a 412 at Info (ClickHouse#99371). Control flow
is unchanged. IcebergMetadata::createInitial reuses the helper for its
CREATE ... IF NOT EXISTS race; its behaviour is identical because that
write is If-None-Match only.
The new test runs parallel INSERTs (8 sinks, 10 INSERTs, version hint
off and on) and fails on every run without the 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; 2 findings) plus my own review (3 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-9:20261010-014200 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261010-004400 |
|
Workflow [PR], commit [b079659] Summary: ✅
AI ReviewSummaryPR #125026 logs expected Iceberg conditional-write conflicts at Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; current-head CI validation remains pending. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units43 translation units recompiled, 470 s compile time in total, 43 of them have a recent master baseline. |
CI finish ledger - b83c52fEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261010-073010 |
…-cas-debug-log # Conflicts: # src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
CI finish ledger - d900a59Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
CIDB has no other Session id: cron:our-pr-ci-monitor:20261024-160007 |
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125026&sha=c14a3e04ad956b20882499f343c6aa8681add106&name_0=PR&name_1=Build%20profile%20diff ( |
|
The fix is #129675 (open, CI green). In this run all 8 readiness probes connected and then got |
The check SELECT over the 80 Iceberg data files pins no settings, so it gets the runner's random max_threads, which is 1-3 in 97% of runs. Late in an MSan stateless job that read costs about 220-300 s of CPU, almost all in IcebergIterator::next, whatever the thread count, so one thread makes each of the two checks take 250-272 s and the test passes the 600 s limit. The failing job's own query_log on the same server: 604-631 s with max_threads = 1, 136-139 s without randomization. Raise the floor of the random max_threads to 8 with a Random settings limits line. The 32 draw and every other random setting stay; the INSERTs already pin max_threads = 8 and max_insert_threads = 8 in their own SETTINGS, so the commit race they create does not change. Locally the test still fails 10/10 without ClickHouse#125026 and passes 50/50 with it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…state-unknown-cleanup Conflicts in Iceberg/Utils.h and Utils.cpp, both against master's `isConditionalWriteConflict` (ClickHouse#125026), which logs a lost metadata commit race at Debug instead of Error. Utils.h: declare both `isCommitStateUnknown` and master's `isConditionalWriteConflict`; keep this branch's `writeMetadataFile` contract (false only for a known-lost commit). Utils.cpp: union of the error codes and failpoints. In the catch arm the refusal check stays first, master's Debug/Error log split follows, and every failure after the write was sent is still reconciled against the stored bytes instead of returning false. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolve the conflict in Iceberg/Utils.cpp: both regions came from #125406 (`READONLY`, `isRefusedWrite`, `isKnownAbsent`), which is not on 26.10. Keep the 26.10 side and add only #125026's own lines (the three error codes and `isConditionalWriteConflict`). Per file, the change against 26.10 is the same set of added and removed lines as #125026's diff against master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Cherry pick #125026 to 26.10: Log a lost Iceberg metadata commit race at Debug, not Error
Backport #125026 to 26.10: Log a lost Iceberg metadata commit race at Debug, not Error
…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: #99371
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
05325_iceberg_mixed_format_top_k_dynamic_filteringfails withhaving stderrorwhile its output is correct, in 3 unrelated PRs on 2026-10-09 (1, 2, 3). The stderr line is<Error> bool DB::Iceberg::writeMetadataFile(...): ... v3.metadata.json already exists, PreconditionFailed for If-None-Match. (FILE_ALREADY_EXISTS).Each sink of a parallel
INSERT(max_insert_threads > 1) commits its own snapshot, so the sinks race for the same metadata version. The server logs of two of the failed jobs show two sink threads of one query startingv3.metadata.jsonwithin 30 us; the loser's conditional write fails, it retries and writesv4. That lost race is the expected outcome of the commit's compare-and-swap, butwriteMetadataFilelogged it withtryLogCurrentException, i.e. atErrorwith a stack trace.05255_object_storage_top_k_dynamic_filteringpinsmax_insert_threads = 1only to avoid this line.Change: a helper
Iceberg::isConditionalWriteConflictrecognizes a failed conditional write (FILE_ALREADY_EXISTS,STALE_VERSION, or S3PreconditionFailed).writeMetadataFileandtryWriteVersionHintFilelog that case atDebug; every other failure stays atError.IcebergMetadata::createInitialreuses the helper. This matches the REST catalog commit (409 atDebug) and the S3 layer (412 atInfo, #99371). Azure reports a lost condition as an SDK exception and still logs it atError.Validation: the new test
05355_iceberg_parallel_insert_commit_conflict(8 sinks, 10 INSERTs, version hint off and on) fails 20/20 without the change and passes 50/50 with it. 05325 passes 50/50.Workflow [PR]
Sync PR [sync-upstream/pr/125026]
Version info
26.11.1.1648-master(included in26.11and later)