Skip to content

Support Batch Remove for Azure - #100522

Merged
Michicosun merged 12 commits into
masterfrom
azure_batch_remove
Mar 25, 2026
Merged

Michicosun merged 12 commits into
masterfrom
azure_batch_remove

Conversation

@Michicosun

@Michicosun Michicosun commented Mar 24, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

This patch changes the behaviour of removeObjectsIfExist from a sequential removal loop to batch removal.

Version info

  • Merged into: 26.4.1.257
  • Backported to: 26.3.2.5, 26.2.6.27

@clickhouse-gh

clickhouse-gh Bot commented Mar 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [9364acf]

Summary: ❌

job_name test_name status info comment
Upgrade check (amd_release) failure
Error message in clickhouse-server.log (see upgrade_error_messages.txt) FAIL cidb
AST fuzzer (amd_debug) failure
Segmentation fault (STID: 5737-6ff0) FAIL cidb

AI Review

Summary

This PR adds batched Azure blob deletion in removeObjectsIfExist by introducing BlobContainerBatch flow and deferred per-object responses. The change is directionally good for throughput, but there are still observability regressions in the new path and test coverage is insufficient for changed failure semantics. Verdict: request changes.

Missing context
  • ⚠️ No CI logs or Azure integration test evidence were provided in this review context.
Findings

❌ Blockers

  • [src/Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp:414] If SubmitBatch throws, the function exits before emitting per-object delete events to BlobStorageLog. The previous per-object path logged each delete attempt (including failures), so this is an observability regression for deletion operations.
    Suggested fix: on batch-level exception, emit one delete log entry per object in the current batch with error details before rethrowing.

⚠️ Majors

  • [src/Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp:416-418] AzureDeleteObjects/DiskAzureDeleteObjects are incremented only after successful SubmitBatch. Failed batch submissions now disappear from delete-attempt metrics, unlike the previous per-object behavior.
    Suggested fix: increment attempt counters before SubmitBatch, or split metrics into attempted vs confirmed deletes.
  • [src/Disks/DiskObjectStorage/ObjectStorages/AzureBlobStorage/AzureObjectStorage.cpp:431-437] NotFound deletions are logged as success (error_code=0, empty message), while previous logic preserved 404 details. This loses useful diagnostics when cleanup repeatedly targets missing objects.
    Suggested fix: preserve status/message for NotFound in batch logging, consistent with removeObjectImpl behavior.
Tests
  • ⚠️ Missing tests for batched delete failure semantics: add Azure-object-storage tests covering SubmitBatch exception path, mixed per-object deferred responses (200/404/5xx), and expected blob_storage_log + ProfileEvents behavior.
ClickHouse Rules
Item Status Notes
Deletion logging ❌ Batch-level SubmitBatch exceptions do not produce per-object delete log events.
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ✅
SettingsChangesHistory.cpp ➖
PR metadata quality ⚠️ Category Not for changelog is acceptable for internal behavior/perf changes, but provided changelog text is unnecessary for that category.
Safe rollout ⚠️ Missing failure-path test evidence for rollout confidence.
Compilation time ✅
Performance & Safety
  • Batch delete implementation should improve steady-state throughput, but missing failed-attempt metrics and incomplete delete-event logging reduce failure observability under real cloud faults.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    1. Restore per-object deletion observability for batch-level SubmitBatch failures.
    2. Fix delete metrics semantics (attempted vs confirmed) so failed batch attempts are still measurable.
    3. Add Azure tests for mixed deferred-response and batch-exception paths.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 24, 2026
for (const auto & object : object_batch)
responses.push_back(requests.DeleteBlob(client_ptr->GetBlobPath(object.remote_path)));

client_ptr->SubmitBatch(requests);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

removeObjectImpl logs every deletion attempt (including failures), but this batched path throws directly on SubmitBatch errors before emitting any BlobStorageLogElement::EventType::Delete entries for the objects in this chunk.

That breaks parity with existing Azure delete observability and violates the deletion-logging requirement for failed delete attempts.

Please catch around SubmitBatch, log a failed delete event for each object_batch entry (with error code/message when available), and then rethrow.

@SmitaRKulkarni SmitaRKulkarni self-assigned this Mar 24, 2026
@Michicosun

Copy link
Copy Markdown
Member Author

azurite still not working

@CheSema CheSema left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The rest is Ok

@Michicosun

Copy link
Copy Markdown
Member Author

With this patch:

2026.03.25 01:56:28.709424 [ 1948 ] {} <Trace> azure::BlobKillerThread: Execution took 786 ms.
2026.03.25 01:56:30.470234 [ 1604 ] {} <Trace> azure::BlobKillerThread: Execution took 881 ms.
2026.03.25 01:56:32.533160 [ 1841 ] {} <Trace> azure::BlobKillerThread: Execution took 793 ms.
2026.03.25 01:56:33.922921 [ 2040 ] {} <Trace> azure::BlobKillerThread: Execution took 735 ms.
2026.03.25 01:56:36.065588 [ 1587 ] {} <Trace> azure::BlobKillerThread: Execution took 816 ms.
2026.03.25 01:56:38.143118 [ 1975 ] {} <Trace> azure::BlobKillerThread: Execution took 656 ms.
2026.03.25 01:56:39.899644 [ 1672 ] {} <Trace> azure::BlobKillerThread: Execution took 316 ms.
2026.03.25 01:57:01.455580 [ 1716 ] {} <Trace> azure::BlobKillerThread: Execution took 270 ms.
2026.03.25 01:57:07.875296 [ 1663 ] {} <Trace> azure::BlobKillerThread: Execution took 416 ms.
2026.03.25 01:57:10.217387 [ 1777 ] {} <Trace> azure::BlobKillerThread: Execution took 281 ms.
2026.03.25 01:57:41.207322 [ 1670 ] {} <Trace> azure::BlobKillerThread: Execution took 205 ms.
2026.03.25 01:57:42.869961 [ 1602 ] {} <Trace> azure::BlobKillerThread: Execution took 644 ms.
2026.03.25 01:57:44.427052 [ 1702 ] {} <Trace> azure::BlobKillerThread: Execution took 346 ms.
2026.03.25 01:57:59.939019 [ 1902 ] {} <Trace> azure::BlobKillerThread: Execution took 239 ms.
2026.03.25 01:58:11.333862 [ 1933 ] {} <Trace> azure::BlobKillerThread: Execution took 499 ms.
2026.03.25 01:58:20.742620 [ 1867 ] {} <Trace> azure::BlobKillerThread: Execution took 248 ms.
2026.03.25 01:58:29.482366 [ 1673 ] {} <Trace> azure::BlobKillerThread: Execution took 279 ms.
2026.03.25 01:58:36.601175 [ 1872 ] {} <Trace> azure::BlobKillerThread: Execution took 227 ms.
2026.03.25 01:58:51.989265 [ 1561 ] {} <Trace> azure::BlobKillerThread: Execution took 796 ms.
2026.03.25 01:58:54.877491 [ 1758 ] {} <Trace> azure::BlobKillerThread: Execution took 372 ms.
2026.03.25 01:58:56.883710 [ 1991 ] {} <Trace> azure::BlobKillerThread: Execution took 261 ms.
2026.03.25 01:59:14.003615 [ 1973 ] {} <Trace> azure::BlobKillerThread: Execution took 268 ms.
2026.03.25 01:59:23.687843 [ 1594 ] {} <Trace> azure::BlobKillerThread: Execution took 389 ms.
2026.03.25 01:59:28.939802 [ 1925 ] {} <Trace> azure::BlobKillerThread: Execution took 613 ms.

Without:

2026.03.23 15:01:43.652668 [ 1927 ] {} <Trace> azure::BlobKillerThread: Execution took 3071 ms.
2026.03.23 15:01:45.421310 [ 1749 ] {} <Trace> azure::BlobKillerThread: Execution took 1082 ms.
2026.03.23 15:01:49.662838 [ 1954 ] {} <Trace> azure::BlobKillerThread: Execution took 3094 ms.
2026.03.23 15:01:54.240779 [ 1765 ] {} <Trace> azure::BlobKillerThread: Execution took 3936 ms.
2026.03.23 15:02:03.895241 [ 1805 ] {} <Trace> azure::BlobKillerThread: Execution took 8386 ms.
2026.03.23 15:02:14.366878 [ 1714 ] {} <Trace> azure::BlobKillerThread: Execution took 9025 ms.
2026.03.23 15:02:24.552796 [ 1962 ] {} <Trace> azure::BlobKillerThread: Execution took 9522 ms.
2026.03.23 15:02:34.641158 [ 1673 ] {} <Trace> azure::BlobKillerThread: Execution took 8656 ms.
2026.03.23 15:02:46.883948 [ 1960 ] {} <Trace> azure::BlobKillerThread: Execution took 10964 ms.
2026.03.23 15:02:51.164021 [ 1831 ] {} <Trace> azure::BlobKillerThread: Execution took 3612 ms.
2026.03.23 15:02:56.203997 [ 1700 ] {} <Trace> azure::BlobKillerThread: Execution took 4420 ms.
2026.03.23 15:03:01.632136 [ 1598 ] {} <Trace> azure::BlobKillerThread: Execution took 4922 ms.
2026.03.23 15:03:04.517800 [ 1743 ] {} <Trace> azure::BlobKillerThread: Execution took 1433 ms.
2026.03.23 15:03:09.230370 [ 1915 ] {} <Trace> azure::BlobKillerThread: Execution took 3901 ms.
2026.03.23 15:03:13.409759 [ 1892 ] {} <Trace> azure::BlobKillerThread: Execution took 3302 ms.
2026.03.23 15:03:20.503402 [ 1560 ] {} <Trace> azure::BlobKillerThread: Execution took 2727 ms.
2026.03.23 15:03:23.877224 [ 1966 ] {} <Trace> azure::BlobKillerThread: Execution took 2159 ms.
2026.03.23 15:03:27.461835 [ 1894 ] {} <Trace> azure::BlobKillerThread: Execution took 1451 ms.
2026.03.23 15:03:30.700502 [ 1544 ] {} <Trace> azure::BlobKillerThread: Execution took 1942 ms.
2026.03.23 15:03:32.739164 [ 1846 ] {} <Trace> azure::BlobKillerThread: Execution took 1098 ms.
2026.03.23 15:03:35.132136 [ 1591 ] {} <Trace> azure::BlobKillerThread: Execution took 1104 ms.
2026.03.23 15:03:37.438393 [ 1774 ] {} <Trace> azure::BlobKillerThread: Execution took 1186 ms.
2026.03.23 15:03:42.241711 [ 1760 ] {} <Trace> azure::BlobKillerThread: Execution took 1065 ms.
2026.03.23 15:03:48.880539 [ 1808 ] {} <Trace> azure::BlobKillerThread: Execution took 5434 ms.
2026.03.23 15:03:58.953722 [ 1616 ] {} <Trace> azure::BlobKillerThread: Execution took 8930 ms.
2026.03.23 15:04:08.748910 [ 1576 ] {} <Trace> azure::BlobKillerThread: Execution took 8457 ms.
2026.03.23 15:04:11.527149 [ 1959 ] {} <Trace> azure::BlobKillerThread: Execution took 1778 ms.
2026.03.23 15:04:14.328006 [ 1699 ] {} <Trace> azure::BlobKillerThread: Execution took 2182 ms.
2026.03.23 15:04:26.730564 [ 1962 ] {} <Trace> azure::BlobKillerThread: Execution took 11185 ms.
2026.03.23 15:04:34.154737 [ 1603 ] {} <Trace> azure::BlobKillerThread: Execution took 6585 ms.
2026.03.23 15:04:40.626211 [ 1776 ] {} <Trace> azure::BlobKillerThread: Execution took 5839 ms.
2026.03.23 15:04:44.040614 [ 2019 ] {} <Trace> azure::BlobKillerThread: Execution took 859 ms.
2026.03.23 15:04:48.305977 [ 1856 ] {} <Trace> azure::BlobKillerThread: Execution took 1182 ms.
2026.03.23 15:04:52.146936 [ 1751 ] {} <Trace> azure::BlobKillerThread: Execution took 880 ms.
2026.03.23 15:05:01.859428 [ 1602 ] {} <Trace> azure::BlobKillerThread: Execution took 817 ms.
2026.03.23 15:05:05.808967 [ 1780 ] {} <Trace> azure::BlobKillerThread: Execution took 2788 ms.
2026.03.23 15:05:11.875819 [ 1656 ] {} <Trace> azure::BlobKillerThread: Execution took 4813 ms.
2026.03.23 15:05:13.963821 [ 1594 ] {} <Trace> azure::BlobKillerThread: Execution took 1430 ms.

@clickhouse-gh

clickhouse-gh Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.10% 84.20% +0.10%
Functions 24.40% 24.30% -0.10%
Branches 76.60% 76.70% +0.10%

PR changed lines: PR changed-lines coverage: 86.90% (73/84, 0 noise lines excluded)
Diff coverage report
Uncovered code

@Michicosun
Michicosun added this pull request to the merge queue Mar 25, 2026
Merged via the queue into master with commit 1c0d273 Mar 25, 2026
147 of 149 checks passed
@Michicosun
Michicosun deleted the azure_batch_remove branch March 25, 2026 14:52
@robot-ch-test-poll1 robot-ch-test-poll1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 25, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 26, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Mar 26, 2026
clickhouse-gh Bot added a commit that referenced this pull request Mar 27, 2026
Backport #100522 to 26.2: Support Batch Remove for Azure
clickhouse-gh Bot added a commit that referenced this pull request Mar 27, 2026
Backport #100522 to 26.3: Support Batch Remove for Azure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport v26.3-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants