Skip to content

Throw an exception instead of aborting when an Azure endpoint omits the ETag header - #127673

Merged
alexey-milovidov merged 7 commits into
masterfrom
azure-etag-missing-throw
Nov 2, 2026
Merged

alexey-milovidov merged 7 commits into
masterfrom
azure-etag-missing-throw

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

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 std::abort under NDEBUG). Four call sites converted it unconditionally: ReadBufferFromAzureBlobStorage::setMetadataFromResponse (on every Download), AzureObjectStorage::getObjectMetadata (GetProperties), and both listing paths (listObjects and AzureIteratorAsync). An Azure-compatible endpoint that omits the header could abort the server.

This is a minimal alternative to #120908: instead of substituting an empty ETag (which then required hardening the Iceberg version-hint.text compare-and-swap and the ObjectStorageQueue deduplication), the new AzureBlobStorage::getETag throws AZURE_BLOB_STORAGE_ERROR, so the query fails with an exception and the server keeps running.

Related: #120908

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Throw an exception instead of aborting the server when an Azure Blob Storage endpoint omits the optional ETag header in a response to blob download, GetProperties, or listing.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/127673]

Version info

  • Merged into: 26.11.1.1090-master (included in 26.11 and later)

…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: #120908

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [eff22cb]

Summary: ✅


AI Review

Summary

Reviewed #127673 at eff22cb053e2547aa8b2c3723fb10fad29a1efd3. Missing Azure ETag values now raise AZURE_BLOB_STORAGE_ERROR instead of aborting during downloads, metadata lookup, and both listing paths. No actionable findings remain. The added AzureReadBuffer.MissingETagIsAnException regression test addresses the earlier coverage concern and passes in ASan/UBSan CI.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 24, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good.

@alexey-milovidov alexey-milovidov added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Oct 24, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-azure Azure Blob Storage integration (credentials, multipart, Azure-specific IO). label Oct 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing eff22cb05 with master 5294f9b23 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of ba0d3f020; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

43 translation units recompiled, 391 s compile time in total, 43 of them have a recent master baseline.

Job report

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 CI status: 05218_text_index_substreams_opened_lazily (amd_debug, sequential) fails only with the randomized use_columns_cache = 1; it is unrelated to this Azure change and is being fixed in #127781. The remaining red check is the new_tests_check.py bug-fix gate: no regression test was added, per the author's decision in the review thread — overriding that gate needs a human decision.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127673&sha=11ab59dc253902d40d4223d3f6cc606db687b7c2&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 and provide a fix in a separate PR. If the fix is already in progress, link it here.

05325_parallel_replicas_progress_total_rows printed "total_rows_to_read":"0" instead of 1000000 with parallel_replicas_local_plan=0. It is unrelated to this Azure ETag change: 1 failure against about 49000 passing runs in the last 14 days, and 129 reruns with the same randomized settings all passed. The branch has been updated with the latest master. The new_tests_check.py gate stays red because no regression test is added, per the author's decision in the review thread.

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm investigating why 05325_parallel_replicas_progress_total_rows reports "total_rows_to_read":"0" for the count() query with parallel_replicas_local_plan=0 (the coordinator-published total path); I'll follow up here with a fix PR (or my findings) shortly. I found no fix already in progress.

@groeneai

Copy link
Copy Markdown
Collaborator

The fix is in #128036.

Without a local plan, the coordinator reported the total through one stored progress callback that every RemoteSource overwrote, so the total was buffered in the last replica's source and lost when that source never ran again. In this CI run one replica took all marks and the other two were cancelled as unused right after Total rows to read: 1000000. The PR reports the total through the callback of the replica that announced. It also adds an arm with an unavailable replica, which fails 50/50 on master and passes 50/50 with the fix.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Thanks @groeneai — the 05325_parallel_replicas_progress_total_rows fix is tracked in #128036 (still open), and that test passed on the latest commit b7ef5afb. CI status for that commit: Build profile diff errored with an infrastructure problem (LogClusterNotReady: the endpoint never became ready) that has nothing to do with this change. The only other red check is the new_tests_check.py gate, which fails because no regression test was added, as the author decided in the review thread. Overriding that gate needs a human. No code changes are needed.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged the latest master (64f94366). The merge was clean, and the affected Azure translation units build. The red checks on b7ef5afb were Build profile diff, which hit an infrastructure error (LogClusterNotReady), and the new_tests_check.py gate. That gate stays red because no regression test was added, as the author decided in the review thread. Waiving it needs a human. The 05325_parallel_replicas_progress_total_rows flake is being fixed in #128036.

The fake endpoint serves a blob without the optional `ETag` header. Without the
fix, `ReadBufferFromAzureBlobStorage::setMetadataFromResponse` calls
`Azure::ETag::ToString` and the process aborts; with the fix the read fails with
`AZURE_BLOB_STORAGE_ERROR`.

The PR had no test, so the "new tests" check of the `Bug Fix` category failed:
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127673&sha=64f94366e19e65e4544170a9981ba07f2a6f5505&name_0=PR&name_1=Finish%20Workflow
PR: #127673

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Added src/Disks/tests/gtest_azure_read_buffer_missing_etag.cpp (ecb5b37): a mock transport serves a download without ETag. Locally, the read now fails with AZURE_BLOB_STORAGE_ERROR; with the ReadBufferFromAzureBlobStorage change reverted, unit_tests_dbms aborts (exit code 134). This covers the "new tests" requirement of the Bug Fix category. The other call sites go through the same AzureBlobStorage::getETag helper, so I did not add a separate test for each of them.

@alexey-milovidov alexey-milovidov self-assigned this Nov 1, 2026
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged the latest master (ba0d3f02) as eff22cb0. The merge was clean and the affected Azure translation units build. The only red check on ecb5b373 was Stress test (amd_debug), which hit the Cannot write to canceled buffer logical error (STID: 4158-351e) in JSONUtils::writeArrayEnd from IOutputFormat::writeSuffixIfNeeded in the embedded client. That is unrelated to this Azure change. It is tracked in #125973, and the fix is in progress in #126142.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 2, 2026
Merged via the queue into master with commit 5b87bdf Nov 2, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the azure-etag-missing-throw branch November 2, 2026 13:30
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Nov 2, 2026
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 2, 2026
alexey-milovidov added a commit that referenced this pull request Nov 3, 2026
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]>
robot-clickhouse added a commit that referenced this pull request Nov 3, 2026
… an Azure endpoint omits the `ETag` header
robot-clickhouse added a commit that referenced this pull request Nov 3, 2026
… an Azure endpoint omits the `ETag` header
robot-clickhouse added a commit that referenced this pull request Nov 3, 2026
…n an Azure endpoint omits the `ETag` header
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Nov 3, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 3, 2026
Backport #127673 to 26.8: Throw an exception instead of aborting when an Azure endpoint omits the `ETag` header
clickhouse-gh Bot added a commit that referenced this pull request Nov 3, 2026
Backport #127673 to 26.10: Throw an exception instead of aborting when an Azure endpoint omits the `ETag` header
PedroTadim added a commit that referenced this pull request Nov 3, 2026
Backport #127673 to 26.3: Throw an exception instead of aborting when an Azure endpoint omits the `ETag` header
leshikus pushed a commit that referenced this pull request Nov 13, 2026
… an Azure endpoint omits the `ETag` header
leshikus pushed a commit that referenced this pull request Nov 13, 2026
… an Azure endpoint omits the `ETag` header
leshikus pushed a commit that referenced this pull request Nov 13, 2026
…n an Azure endpoint omits the `ETag` header
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-azure Azure Blob Storage integration (credentials, multipart, Azure-specific IO). pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants