Repository navigation
Harden the consumers of ETag (Iceberg version hint, ObjectStorageQueue deduplication) against a missing tag - #120908
alexey-milovidov wants to merge 67 commits into
Conversation
`ETag` is an optional response header, and `Azure::ETag::ToString` aborts the process when the tag is absent - in release builds too, because `AZURE_ASSERT_MSG` expands to a bare `std::abort` under `NDEBUG`. Four call sites converted it unconditionally on a value taken straight from a response: `ReadBufferFromAzureBlobStorage::setMetadataFromResponse` on the details of every `Download` (on the sequential path and in `readBigAt`), `AzureObjectStorage::getObjectMetadata` on the answer to `GetProperties`, and both listing paths (`listObjects` and the async iterator) on the `Etag` element of every blob in the answer to `ListBlobs`. All of them are reachable by an Azure-compatible endpoint that simply omits the header. Put the guard in one place, `AzureBlobStorage::getETagOrEmpty`, and route every call site through it. There is no unguarded `Azure::ETag::ToString` left in the tree. `src/Disks/tests/gtest_azure_object_storage_metadata.cpp` drives `getObjectMetadata`, `listObjects`, `iterate`, a sequential read and `readBigAt` against a fake Azure HTTP transport that answers without an `ETag`. Without the change, the unit test binary dies with `SIGABRT`. This is one of the independent parts of #115706, which was reverted in #120419.
|
Workflow [PR], commit [2ba448c] Summary: ❌
AI ReviewSummaryThe PR hardens Iceberg version hints and Findings❌ Blockers
Missing context / blind spots
Tests
Final VerdictStatus: ❌ Block Preserve queue token identity throughout mixed-version consumption and metadata rewrites, with regression coverage. The retained hint-deletion race and S3 request overhead also need a maintainer decision; they have not been reposted to the existing discussions. |
…he version hint CAS Two consumers of `ObjectMetadata::etag` treated the tag as always present, so turning the abort into an empty string would have made them silently do the wrong thing. `ObjectStorageQueueSource` builds a per-chunk deduplication token as `<etag>:<row offset>` and passes it to `setUserToken`. Against an endpoint that omits `ETag` the first chunk of every file gets the same token `:0`, the second `:<rows in the first chunk>`, and so on, and `DeduplicationInfo::getBlockUnifiedHash` uses a non-empty user token verbatim - distinct files would deduplicate against each other and their rows would disappear from the dependent materialized views. Leave the token empty when the tag is absent: an empty user token is the documented "no token" value, and the unified hash is then computed from the data, which deduplicates on content. `Iceberg::writeMetadataFileAndVersionHint` keeps `version-hint.text` monotonic by reading the current hint, remembering its tag and replaying it as `write_if_match` on the rewrite. An empty tag means no `IfMatch` access condition at all, so the update degrades into an unconditional overwrite and concurrent `icebergAzure` writers can move the hint backwards, which makes a reader with `iceberg_use_version_hint = 1` resolve a stale snapshot. Fail close and leave the hint alone instead: the metadata file itself is already committed, and a hint that lags is the state this code path already tolerates. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…ession tests `IcebergCommitPropagation.VersionHintWithoutETagIsNotOverwritten` drives the real `writeMetadataFileAndVersionHint` against a stub backend whose existing `version-hint.text` is read back without an `ETag`, and asserts that only the metadata file is written - the hint is left alone rather than overwritten without its compare-and-swap. `IcebergCommitPropagation.VersionHintIsRewrittenUnderItsETag` is the control: with a tag the hint is advanced and the rewrite carries that tag as `write_if_match`. Without the guard the first test fails with two writes instead of one, which was verified against a control binary. The deduplication token of `ObjectStorageQueueSource` moved into `ObjectStorageQueueSource::makeDeduplicationToken` so the decision it encodes is testable on its own. `ObjectStorageQueueDeduplicationToken` pins both halves: an `ETag` identifies the chunk by its file and offset and two files never collide, and an absent tag yields no token at all, which is what makes `DeduplicationInfo` fall back to the hash of the data. The quote stripping now also handles a tag that is nothing but the two quotes: it strips to empty and is then treated as absent, instead of becoming the token `"":<row offset>` shared by every file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🕵 Both AI Review blockers are adopted, plus the test gap it called out.
New regression tests, all passing locally:
Also merged |
|
🕵 @groeneai, investigate the failure: AST fuzzer (amd_debug, targeted) and provide a fix in a separate PR. If the fix is already in progress, link it here.
The other red, |
|
Fix in progress: #110020 ("Decide parallel replicas eligibility with the subquery's own context"), open since 2026-07-10. I verified it covers this shape instead of assuming it. Reproduced on master CREATE TABLE t_pr (key BFloat16) ENGINE = MergeTree ORDER BY key;
INSERT INTO t_pr SELECT number FROM numbers(10);
SET enable_analyzer = 1, enable_parallel_replicas = 1, max_parallel_replicas = 3,
cluster_for_parallel_replicas = 'parallel_replicas',
parallel_replicas_for_non_replicated_merge_tree = 1, automatic_parallel_replicas_mode = 0;
SELECT count() FROM (
SELECT key FROM (SELECT key FROM t_pr) AS r SETTINGS parallel_replicas_for_non_replicated_merge_tree = 0
INTERSECT ALL
SELECT key FROM (SELECT key FROM t_pr) AS r SETTINGS parallel_replicas_for_non_replicated_merge_tree = 0
);Same base, with and without #110020's two source files:
Mechanism: On the tracking issue: there is none open, and #110020 is what tracks this STID. Its description cites 3634-4123, and I record each new occurrence there, the previous one on 2026-09-14 from #119846. |
|
🕵 Thank you, that is exactly the answer I needed - the minimised repro pins the mechanism ( Status of this pull request: both reds are unrelated and tracked - the fuzzer one by #110020 above, and |
…the commit rather than the hint Both findings of the AI review on the previous head are adopted. `ObjectStorageQueueSource::makeDeduplicationToken` returned an empty token when the endpoint reports no `ETag`. An empty user token is not neutral: `DeduplicationInfo::getBlockUnifiedHash` then derives the block hash from the data, so two different files holding an identical chunk deduplicate against each other and one file's rows disappear from the dependent materialized views - the same wrong-results class the token exists to prevent. The path of the object takes the place of the missing tag instead, which is what the queue itself identifies a file by, so the token stays distinct per file at every offset. `Iceberg::writeMetadataFileAndVersionHint` skipped the rewrite of `version-hint.text` when the existing hint read back without an `ETag`, and still returned `true`. The metadata file was published while the hint kept pointing at the previous snapshot, and `getLatestOrExplicitMetadataFileAndVersion` trusts the hint outright under `iceberg_use_version_hint = 1`, so a successful commit left hint-based readers pinned to stale metadata. It now throws `UNSUPPORTED_METHOD`, the same way the commit of the metadata file already propagates a compare-and-swap the backend cannot express, and only when the hint would actually have to be advanced - a hint that is already at or ahead of this version needs no write and no error. The caller's `catch (...)` cleans up and the failure reaches the user. Tests: `ObjectStorageQueueDeduplicationToken.EqualChunksOfDifferentFilesDoNotCollideWithoutETag` pins the collision the review described, `NoETagFallsBackToThePath` pins the new token shape, and `IcebergCommitPropagation.VersionHintWithoutETagFailsTheCommit` now asserts the refusal and that the hint is left untouched, with `VersionHintIsRewrittenUnderItsETag` as the control. 7/7 pass locally (70/70 in the whole Azure, Iceberg and queue selection). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes35 object files changed (+45.11 KiB total), 0 added.
711 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Slowest function optimization changes (ThinLTO)Median per-function time ratio to the master baseline:
Compile time of recompiled translation units388 translation units recompiled, 2821 s compile time in total, 388 of them have a recent master baseline. |
…e queue token on the file generation Two correctness gaps left at the previous head. `writeMetadataFileAndVersionHint` refused to advance `version-hint.text` without an `ETag`, but only after it had already written the new `v<N>.metadata.json`. `expireSnapshots` and the schema-alter path in `Mutations.cpp` do not remove that file when the commit throws, so the command failed while readers that resolve the table by listing already saw the new snapshot and readers with `iceberg_use_version_hint = 1` stayed on the old one. The hint is now read, and the refusal decided, before anything is written - the state that was read is handed to the first attempt of the retry loop, so this costs no extra request. A hint that appears in between, after the exclusive create of it loses the race, is still possible; there the metadata file is removed again before the refusal is raised. The `ObjectStorageQueue` deduplication token fell back to `<path>:<row offset>` when the endpoint reported no `ETag`. `tracked_file_ttl_sec` and `tracked_files_limit` let the queue re-import a path it has already processed, and by then the path can hold a different blob, whose rows `DeduplicationInfo` would then drop as duplicates of the first generation. The fallback now also carries the size and the modification time of the object, and fails with `UNSUPPORTED_METHOD` when the storage reports neither those nor a tag, rather than silently losing rows. `makeDeduplicationToken` takes the whole `std::optional<ObjectMetadata>` now, which also removes the unchecked dereference at its call site. Both guards are control-proved: with the pre-check and the rollback removed, `VersionHintWithoutETagFailsTheCommitBeforeAnythingIsPublished` and `VersionHintAppearingMidCommitTakesTheMetadataFileBack` fail. 170/170 of the Iceberg, `ObjectStorageQueue` and Azure unit tests pass locally. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
🕵 Both AI Review blockers at
Both guards are control-proved (removing them fails the new tests), and 170/170 of the Iceberg, The two reds at
|
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120908&sha=b8dcc94e36283ba9aa89acb988468c8a491fd46e&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. It is It looks fleet-wide and freshly introduced. CIDB: SELECT toStartOfDay(check_start_time) AS day, count() AS failures, groupUniqArray(pull_request_number) AS prs
FROM checks
WHERE check_start_time >= now() - INTERVAL 14 DAY
AND test_name = 'The mutation submitted before the upgrade was not finished by the new server (see mutation_across_upgrade.txt)'
AND test_status IN ('FAIL', 'ERROR')
AND (pull_request_number = 0 OR base_ref IN ('master'))
GROUP BY day ORDER BY day DESCgives only two days: 2026-09-21 with 6 failures (#120908, #115168, #118585, #120980, #120690, #119090) and 2026-09-20 with 2 (#120906, #121099). Nothing in the twelve days before that, which suggests a regression landed on |
|
Both rows in that job are the same root cause, and it is already fixed and merged: #120932 (merged 2026-09-21 01:07:44 UTC).
The mutation itself was finished. The new server started at 03:23:15, loaded the entry at 03:23:17.201 ( Across your list it is the same story: in the four failing
One residual, diagnostics only: the check reports "the mutation submitted before the upgrade was not finished" when it is its own probe query that failed, so any table that cannot attach turns into a second, misleading red. I can send that as a separate PR if you want it. |
… `ETag` The tagless fallback of `ObjectStorageQueueSource::makeDeduplicationToken` keyed the token on `<path>:<size>:<last modified>:<row offset>`, but that is not a per-generation identifier. Listings report the modification time with a one-second resolution - `AzureObjectStorage::iterate` truncates `blob.Details.LastModified` to whole seconds and `StorageObjectStorageSource` keeps the listing metadata instead of re-fetching it - so two generations of one path that have the same length and are rewritten within one second get the same non-empty user token. `DeduplicationInfo::getBlockUnifiedHash` takes a non-empty user token as exact identity, so the rows of the newer generation would disappear from the dependent materialized views. There is no surrogate left that is strong enough, so the token is now built only from a strong `ETag`, and anything else - an absent tag, a tag that is nothing but the quotes, missing metadata, or a tag the storage itself reports as weak via `ObjectMetadata::etag_is_strong` (the second-precision `(mtime, size)` token of HDFS) - throws `UNSUPPORTED_METHOD` naming the file and pointing at `deduplication_v2 = 0`. Failing the read is the only alternative to silently dropping rows, and it only affects tables that asked for deduplication. `ObjectStorageQueueDeduplicationToken` covers it: the strong-tag token ignores the size and the modification time so a retried chunk still deduplicates, and both the tagless and the weak-tag cases fail closed. The `etag_is_strong` guard is control-proved - dropping it fails `WeakGenerationSurrogateFailsClosed` and nothing else. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…s report an `ETag` `writeMetadataFileAndVersionHint` reads the hint before publishing the metadata file, only to refuse a commit whose hint exists without an `ETag`. When the hint is absent, the read after the publish still has to happen, so every commit paid for one extra `exists` request. A storage whose metadata always carries a tag can never fail that check, so add `IObjectStorage::alwaysReportsETag` (true for `LocalObjectStorage`, forwarded by `CachedObjectStorage`) and skip the check there. Remote storages keep it, because `ETag` is an optional response header. Related CI report (`iceberg_suite_local_synthio_rw_features` query #10, `ALTER TABLE ... MODIFY COLUMN`, +20 ms = one simulated request): https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120908&sha=latest&name_0=PR&name_1=Performance%20Comparison%20(arm_release%2C%20master_head%2C%204%2F6) PR: #120908 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120908&sha=9966bff59710e0b96acb5855b682ad2b7ca5dbc8&name_0=PR&name_1=Stateless%20tests%20(arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel) ( The Performance Comparison regression ( |
|
Acknowledged. The 2 rows are not from the web terminal. Both are I'll send a separate PR that makes this check parallel-safe and link it here. |
|
The fix is in #128545: the check now counts only the |
…nal_close_during_insert` The last check of the test counted every `Error` record of the whole server containing `Cannot write to canceled buffer` since the test started. The same text is used by the ordinary `CANNOT_WRITE_AFTER_BUFFER_CANCELED` (734) that `WriteBuffer::writeSlow(const char *, size_t)` throws, so a concurrent test getting a legitimate Code 734 failed this test. On PR ClickHouse#120908 the two counted rows came from `01513_optimize_aggregation_in_order_memory_long` (a parallel replicas follower writing into a canceled connection buffer). Count only the `LOGICAL_ERROR` form of the message, the bug the test guards. The error may be logged with context (`While executing ValuesBlockInputFormat`) between the text and the error code name, so the pattern allows anything in between. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he `ETag` `Azure::ETag::ToString` aborts the process when the tag is absent, also in release builds. `ETag` is an optional header, so an Azure-compatible endpoint that omits it could take the server down on `GetProperties`, `ListBlobs` or `Download`. Use `AzureBlobStorage::getETag`, which throws `AZURE_BLOB_STORAGE_ERROR` instead. Related: ClickHouse#120908 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Master merged #127673, a minimal alternative to this PR: `AzureBlobStorage::getETag` throws `AZURE_BLOB_STORAGE_ERROR` when the endpoint omits the `ETag`. This PR instead reports an absent tag as an empty string (`AzureBlobStorage::getETagOrEmpty`) and hardens the consumers that rely on it, so the conflicts at the four call sites are resolved in favor of this PR. `getETag` has no callers left and is removed, together with `gtest_azure_read_buffer_missing_etag.cpp`, which pinned the exception; `gtest_azure_object_storage_metadata.cpp` covers the same download paths (sequential read and `readBigAt`) with the new behavior. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…yers `CachedObjectStorage::removeObjectIfExists` only drops the cached copy, because a disk removes the underlying object through its metadata storage. An Iceberg table on a disk with a cache works on that decorator directly, so taking back a created `version-hint.text` without an `ETag` reported success while the hint stayed, and every later commit then refused to advance it. `removeObjectAndReconcile` now removes the object from the storage under every cache layer (exposed by the new `CachedObjectStorage::getWrappedObjectStorage`) and then from the cache of each layer. The regression test commits through two cache layers and checks that the hint is actually gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged
|
# Conflicts: # src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
# Conflicts: # src/Common/FailPoint.cpp # src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp # src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.h
|
🕵 This PR is in conflict with master, and the conflict is about design, not just text. I did not push a merge. The core defect of this PR, the abort in So merging master would mean one of these:
Either way a human has to decide. The options are to close this PR as superseded by #130519, or to cut it down to the consumer hardening that is still wanted. The open review thread about adding the object path to the |
Conflicts are with #130519 and its follow-ups on master, which fixed the abort in `Azure::ETag::ToString` the other way: `AzureBlobStorage::getETag` throws `LOGICAL_ERROR` when the endpoint omits the `ETag`, and the read path now pins a download to the listed `ETag`. Resolution: master's design is kept for the Azure code. `AzureBlobStorageCommon`, `AzureObjectStorage.cpp` and `ReadBufferFromAzureBlobStorage.cpp` are taken from master, so `getETagOrEmpty` is gone, and `gtest_azure_object_storage_metadata.cpp`, which pinned an empty tag from an Azure answer, is removed. What remains of this change is the hardening of the consumers of an `ETag` (Iceberg `version-hint.text`, `ObjectStorageQueue` deduplication token), which still applies to storages that may not report a tag. Other conflicts are textual: `CachedObjectStorage.h` (`[[nodiscard]]`), `gtest_metadata_plain_rewritable_disk.cpp` (both tests kept), `AlterDropPartitionExecutor.cpp` (statistics file is written before the guarded commit), `StorageObjectStorageQueue.cpp` (log line). Co-Authored-By: Claude Fable 5.2 <[email protected]>
…eduplication token An `ETag` identifies the content of an object, not the object. For an ordinary single-part S3 upload it is the MD5 of the bytes, so two files with identical bytes at different paths have the same tag, and `makeDeduplicationToken` gave their chunks the same `<etag>:<offset>` token: a deduplicating dependent target silently discarded the rows of the second file. The token is now `<path length>:<path>:<etag>:<offset>`. The path is prefixed with its length and the offset is what follows the last `:`, so the parts cannot be confused. The token format changes, so a batch that was partially inserted by the previous version and is replayed after an upgrade is not deduplicated against the blocks inserted before the upgrade. Co-Authored-By: Claude Fable 5.2 <[email protected]>
After the merge with master, `AzureBlobStorage::getETag` refuses an answer without a non-empty `ETag`, so every `ObjectMetadata` that `AzureObjectStorage` returns carries one. Say so in `alwaysReportsETag`, so that an Iceberg commit does not pay for the extra request that checks whether `version-hint.text` can be advanced. Also mark `alwaysReportsETag` as `[[nodiscard]]`, like the neighbouring methods. Co-Authored-By: Claude Fable 5.2 <[email protected]>
ETag headerETag (Iceberg version hint, ObjectStorageQueue deduplication) against a missing tag
|
🕵 Merged
|
| /// the path the rows of the second file would be deduplicated away. The path is prefixed with its | ||
| /// length, and the offset is what follows the last `:`, so the three parts cannot be confused. | ||
| if (hasStrongETag(object_metadata)) | ||
| return fmt::format("{}:{}:{}:{}", path.size(), path, unquoteETag(object_metadata->etag), row_offset); |
There was a problem hiding this comment.
[Blocker] Version the token change for files replayed across an upgrade
Adding the path fixes collisions between different files, but it also changes the identity of every previously inserted chunk: the same file, tag and offset now produce 12:data/one.csv:abc:0 where the previous binary produced abc:0. An old server can insert some chunks, abort its unfinished batch during an ordinary upgrade shutdown, and reset those files for replay. The new server starts them at offset 0 with the new tokens. DeduplicationInfo::getBlockUnifiedHash hashes the complete user token, so neither the local nor replicated destination recognizes the hashes already recorded by the old server and those rows are inserted again. The same problem occurs when a file moves between old and new consumers during a rolling upgrade.
There is no persisted token-scheme version or compatibility switch in this change. Preserve the scheme for existing in-flight work, or gate the transition with an explicit drain/switch migration that also covers rolling upgrades. Please add a cross-version partial-batch replay test; replaying twice with the new helper does not cover this transition.
There was a problem hiding this comment.
🕵 Addressed in 60414ee: the scheme of the token is now persisted per queue.
ObjectStorageQueueTableMetadatarecordsdeduplication_token_versionin the metadata of the queue in Keeper. Metadata without the field belongs to a queue created before this change and means the first scheme,<etag>:<offset>, which that queue keeps after the upgrade. So a file that an old server inserted partially and reset is replayed with the same tokens.- Only a queue whose Keeper metadata is created by a server that records the scheme uses the token with the path. A table attaching to an existing queue takes the scheme from Keeper (
adjustFromKeeper), so replicas of one queue agree during a rolling upgrade. An unknown scheme is refused. - Covered by the unit test
QueueCreatedBeforeThePathWasAddedKeepsItsTokens: old metadata parses to the first scheme, yields exactlyabc:100, and the scheme survives a rewrite of the metadata and an attach. I did not add a cross-version integration test: it needs an old binary in the cluster, and the transition is decided entirely by the parsed metadata.
Two limits remain, both for a human to weigh: existing queues keep the token without the path (so identical files at different paths still collide there, as before this PR) and there is no way yet to switch one over; and an old server that rewrites the metadata of a new queue (ALTER TABLE ... MODIFY SETTING during a rolling upgrade) drops the field.
Conflicts: - `src/Common/FailPoint.cpp`: keep the fail points of master (`iceberg_writes_lose_metadata_commit_request`, `iceberg_writes_lose_metadata_commit_response`). The fail point of this branch, `iceberg_writes_unknown_commit_status`, lived in the code of the insert sink that master replaced, so it is renamed to `iceberg_writes_fail_version_hint_after_publication` and moves to the hint phase in the next commit. - `src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp`: take master's side. The insert sink commits through `Iceberg::commitMetadataFile` and keeps the files of a commit whose outcome is unknown through `commit_outcome_unknown`, which replaces the `isUnknownCommitStatus` guard this branch had there. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…eberg commit fails The read of `version-hint.text` in `tryWriteVersionHintFileImpl` runs after `writeMetadataFile` has published the new snapshot. Its exceptions (a failed `exists`, a failed read) escaped as they were, and the callers that guard their cleanup with `isUnknownCommitStatus` (mutations, compaction, `DROP PARTITION`) removed the data files and the manifests that the still visible metadata file references. The whole phase after the publication now goes through `advanceVersionHintAfterPublication`, which reports every failure as `UNKNOWN_STATUS_OF_INSERT`. `writeMetadataFileAndVersionHint` and `commitMetadataFile` (the insert sink, after the merge with master) both use it. `commitMetadataFile` also checks that the hint can be advanced before it publishes anything (`checkVersionHintCanBeAdvanced`), as `writeMetadataFileAndVersionHint` does. The fail point `iceberg_writes_fail_version_hint_after_publication` (was `iceberg_writes_unknown_commit_status`) now injects an ordinary network error into that phase instead of an already classified exception, so `05452_iceberg_unknown_commit_status_keeps_files` covers the conversion and the destruction of the sink. Unit tests cover a failed `exists` and a failed read of the hint after the publication. Also mark the functions of the test stubs `[[nodiscard]]`, which fixes the `modernize-use-nodiscard` errors of the `arm_tidy` build: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=120908&sha=6129a41ef9566058203e6b5e7647aa784d89e89f&name_0=PR&name_1=Build%20%28arm_tidy%2C%204%2F4%29 #120908 Co-Authored-By: Claude Fable 5.2 <[email protected]>
Adding the path to the token changed the identity of every chunk: `abc:0` became `12:data/one.csv:abc:0`. A server before the change may have inserted a part of a file and aborted the batch on shutdown, which resets the file for a replay from offset `0`. The upgraded server (or another replica during a rolling upgrade) would replay it with the new tokens, which the deduplication logs of the dependent targets do not know, and insert the rows again. The scheme of the token is now recorded in the metadata of the queue in Keeper (`ObjectStorageQueueTableMetadata::deduplication_token_version`). Metadata without it belongs to a queue created before the change and means the first scheme, `<etag>:<offset>`, which such a queue keeps. Only a queue created by a server that records the scheme uses the token with the path. A table that attaches to an existing queue takes the scheme over from Keeper, and a scheme the server does not know is refused. Co-Authored-By: Claude Fable 5.2 <[email protected]>
After the merge the uncertain outcome is tracked by `commit_outcome_unknown`, so `committed` again means only a confirmed commit. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Related: #115706
Related: #120419
Related: #130519
ETagis an optional response header, and an object storage may returnObjectMetadatawith an emptyetag. Two consumers rely on the tag and are hardened here, so that an absent tag does not silently weaken them:version-hint.text: later commits advance the hint with a compare-and-swap on itsETag. When a freshly created hint reads back without a tag,takeBackVersionHintWithoutETagremoves it instead of leaving a table that cannot be committed to. OnCREATE TABLEit also removes the first metadata file and throwsUNSUPPORTED_METHOD. On a commit, the already published metadata file stays (listing-based writers may have built on it), and the commit succeeds without a hint. A storage that reports a tag for every object (IObjectStorage::alwaysReportsETag: local and Azure) skips the check and the request it needs. Any failure of the hint phase after the metadata file is published (including a failed read of the hint) is reported asUNKNOWN_STATUS_OF_INSERT, so the callers keep the files the published snapshot references.ObjectStorageQueuededuplication: the per-chunk deduplication token is built from the file's path, itsETagand the chunk offset, and requires a strongETag. The path is a part of the token because anETagidentifies content, not an object: two files with identical bytes at different paths may have the same tag, and the rows of the second one were deduplicated away. The scheme of the token is recorded in the metadata of the queue in Keeper (deduplication_token_version): a queue created before this change keeps the token without the path, so a file that was inserted partially before an upgrade is replayed with the same tokens, and only a newly created queue uses the token with the path. The token is attached only when a dependent target actually deduplicates (InsertDependenciesBuilder::dependentViewsDeduplicateBlocksOnInsert). A partially processed file is aborted and replayed from offset0on shutdown orSYSTEM STOPonly when every dependent target certainly deduplicates (dependentViewsCertainlyDeduplicateBlocksOnInsert).This PR originally also fixed the abort in
Azure::ETag::ToStringon an Azure answer without anETag, by reporting an empty tag. That defect was since fixed on master the other way in #130519:AzureBlobStorage::getETagthrowsLOGICAL_ERROR. After the merge with master this PR follows that design: the Azure code is identical to master, and only the consumer hardening remains.This is one of the independent parts of #115706, which was reverted in #120419.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Do not leave an Iceberg table with a
version-hint.textthat cannot be advanced when the object storage does not report anETag. In newly createdS3QueueandAzureQueuetables, the deduplication token of a chunk now includes the path of the file, so files with identical content at different paths are no longer deduplicated against each other in dependent materialized views (existing queues keep the previous token); a file without a strongETagis reported as an error instead of being deduplicated incorrectly.Workflow [PR]
Sync PR [sync-upstream/pr/120908]