Repository navigation
Fix sporadic PreconditionFailed in CREATE TABLE IF NOT EXISTS for Iceberg - #96121
Merged
alexey-milovidov merged 2 commits intoFeb 7, 2026
Merged
alexey-milovidov merged 2 commits into
alexey-milovidov merged 2 commits into
Conversation
… Iceberg `IcebergMetadata::createInitial` uses `If-None-Match: *` when writing `v1.metadata.json` to S3. This throws `PreconditionFailed` when the file already exists, e.g. due to leftover S3 data after a `DROP TABLE` (when `iceberg_delete_data_on_drop` is off) or a concurrent creation. The `listFiles` check before the write is not atomic with respect to the write itself, creating a TOCTOU race. The `writeMetadataFileAndVersionHint` function already handles this pattern by catching the exception. Now `createInitial` also catches the `PreconditionFailed` S3 error when `IF NOT EXISTS` was specified, treating it as "table already exists". Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
|
Workflow [PR], commit [0c7d17c] Summary: ❌
|
alexey-milovidov
deleted the
fix-iceberg-precondition-failed-on-create-if-not-exists
branch
February 7, 2026 01:48
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IcebergMetadata::createInitialusesIf-None-Match: *when writingv1.metadata.jsonto S3. This throwsPreconditionFailedwhen the file already exists, e.g. due to leftover S3 data after aDROP TABLE(wheniceberg_delete_data_on_dropis off) or a concurrent creation.The
listFilescheck before the write is not atomic with respect to the write itself, creating a TOCTOU race. ThewriteMetadataFileAndVersionHintfunction already handles this pattern by catching the exception.Now
createInitialalso catches thePreconditionFailedS3 error whenIF NOT EXISTSwas specified, treating it as "table already exists".Changelog category (leave one):
See https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=96111&sha=e7311fadca72f6ff8fd72f1e7a02f4e386282511&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29
#96111
Version info
26.2.1.355