Repository navigation
Conversation
…write `Iceberg::writeMetadataFile` is the single storage-side commit point (an `If-None-Match: *` create of `vN.metadata.json`). It turned every write failure except `UNSUPPORTED_METHOD` into `false`, and every caller (expire_snapshots, INSERT, DELETE/UPDATE, ALTER, DROP PARTITION, OPTIMIZE) reads `false` as a lost commit race and retries. A write the storage refused (no permission) is refused again on every round, so the loop ended in `LIMIT_EXCEEDED` and the real error was only logged (ClickHouse#125343). Propagate a refused write, extending the `UNSUPPORTED_METHOD` carve-out: `READONLY` (a read-only disk refuses every write before sending it), `ErrnoException` with EACCES/EPERM/EROFS (local storage; the temporary file is opened, and the target linked, before anything is published) and `S3Exception` with the codes `S3::isAuthenticationError` recognises (ACCESS_DENIED, INVALID_ACCESS_KEY_ID, INVALID_SIGNATURE) plus SIGNATURE_DOES_NOT_MATCH (a 403/401 is answered before the request is applied). A refusal that comes after the write was sent, e.g. of the `s3_check_objects_after_upload` request, may follow a PUT that landed, so it propagates only when the file is absent; a refused pre-write existence check propagates directly. Every other failure stays retryable: - S3 reports a lost race (412 PreconditionFailed) as an untyped `UNKNOWN` error, so "retry only on a recognised conflict" would fail the parallel sinks of a multi-threaded INSERT. - A timeout or 5xx after the PUT may have committed; that case is ClickHouse#115390's. - Azure's layer classifies 403 as retryable on purpose (RBAC propagation lag), so Azure is unchanged. `S3Exception::isRetryableError` is not reused: its non-retryable set includes NO_SUCH_KEY/NO_SUCH_UPLOAD, which can follow a PUT that landed. The callers' exception paths clean up only this attempt's uncommitted staged files and rethrow, which is correct for a write that did not happen. The gtest stub now takes the error to throw and the answers of `exists`. The `UNSUPPORTED_METHOD` test also covers READONLY. New tests cover the errno and S3 refusals, a refusal of a write that may have landed (the file is there afterwards, or the check fails), and a refused pre-write existence check. The retryable control gains the local lost race (FILE_ALREADY_EXISTS), an I/O error (EIO) and the S3 lost race (412), so a classifier that propagated every ErrnoException or S3Exception fails it. Closes ClickHouse#125343 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; round 0: 2 findings, round 1: 0, round 2: 0) plus my own review (round 0: 2, round 1: 2, round 2: 1).
Severity: ❌ blocker / |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20261012-114200 |
|
Workflow [PR], commit [e5e789b] Summary: ✅
AI ReviewSummaryThis PR fixes the main bug well: stable Iceberg metadata-write refusals now propagate instead of being misreported as commit conflicts, and the new gtests cover the local/S3 cases and the "write may already have landed" cleanup hazard. I found one remaining local-object-storage gap, though: permission failures that surface as Findings
Final Verdict
|
| if (e.code() == ErrorCodes::UNSUPPORTED_METHOD) | ||
| /// A refused write is not a lost race, and retrying the commit cannot get past it. Once the write was sent, | ||
| /// a refusal (e.g. of the check after an upload) proves nothing was written only while the file is absent. | ||
| if (isRefusedWrite(e) && (!write_attempted || isKnownAbsent(object_storage, storage_metadata_path))) |
There was a problem hiding this comment.
LocalObjectStorage::exists still makes this incomplete on the local-permission path. That method calls throwing std::filesystem::exists (src/Disks/DiskObjectStorage/ObjectStorages/Local/LocalObjectStorage.cpp:180), so an unsearchable metadata/ directory (chmod 000) raises std::filesystem::filesystem_error, not DB::Exception. In that case we never reach isRefusedWrite, we fall through catch (...), and the commit is still retried 1000 times until LIMIT_EXCEEDED instead of surfacing the permission error.
Could you classify the local std::filesystem permission-denied case here as a refused pre-check too, or translate it to a DB::Exception before this helper sees it?
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 18 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - e5e789bEvery 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:20261013-000014 |
1f26f7d
…state-unknown-cleanup Conflicts in Iceberg/Utils.cpp and the commit-propagation gtest, both against master's refused-write propagation (ClickHouse#125406). Utils.cpp: keep master's `isRefusedWrite`/`isKnownAbsent` and its `write_attempted` flag, which replaces this branch's `put_started` (same meaning). The refusal check stays the first statement of the catch arm, so a refused write whose target is absent still propagates as itself; every other failure after the write was sent is reconciled. gtest: port master's refusal cases onto the reconciling stub (the write failure is now a thrower, and the target's existence probe can be answered per call). Two of master's expectations encoded "an ambiguous outcome returns false" and change with this branch: a non-refused failure with an absent target, or a failing check after a refusal, is now UNKNOWN_STATUS_OF_TRANSACTION; a refusal after an upload whose bytes landed is committed. 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]>
Closes: #125343
Related: #115390
Related: #125026
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
An Iceberg commit (for example
ALTER TABLE ... EXECUTE expire_snapshots) whose new metadata file the storage refuses to write, such asPermission deniedon a local directory or S3AccessDenied, now fails at once with that error instead of being retried as a commit conflict untilLIMIT_EXCEEDED.Description
ALTER TABLE ... EXECUTE expire_snapshotson an Iceberg table whosemetadata/the writer cannot write fails withLIMIT_EXCEEDED, and the real error is only logged.Iceberg::writeMetadataFileis the commit point of every storage-side Iceberg commit. It turned every write failure exceptUNSUPPORTED_METHODintofalse, which all callers read as a lost commit race and retry. A refused write is refused again on every round. ALTER, DELETE/UPDATE, INSERT and OPTIMIZE share this commit point.Change: a refused write now propagates, as
UNSUPPORTED_METHODalready does:READONLY(a read-only disk),ErrnoExceptionwithEACCES,EPERMorEROFS, andS3ExceptionwithACCESS_DENIED,INVALID_ACCESS_KEY_ID,INVALID_SIGNATUREorSIGNATURE_DOES_NOT_MATCH. Everything else stays retryable. A refusal after the write was sent (thes3_check_objects_after_uploadcheck) propagates only while the file is absent. I did not switch to "retry only on a conflict": S3 reports a lost race (412) as an untyped error, so parallel INSERT sinks would fail, and a timeout after the PUT may have committed (#115390). Azure is unchanged: its layer retries 403 on purpose. #125026 only lowers the log level in thiscatcharm.This is an Improvement, not a Bug Fix: a misleading error, not a wrong result.
Validation:
gtest_iceberg_commit_propagationgains errno and S3 refusal tests, which fail on master, plus lost-race controls that must stay retryable. The issue's repro (non-root,chmod 555) givesLIMIT_EXCEEDEDafter 999 logged attempts on master, andPermission deniedat once with the fix.ALTER ADD COLUMN, an anonymous read-only MinIO bucket and a read-only disk behave the same way. Parallel INSERTs still retry lost races on local and MinIO. No SQL test: stateless CI runs as root, with no read-only disk or S3 identity.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125406]
Version info
26.11.1.80-master(included in26.11and later)