Skip to content

DiskObjectStorage synchronously wait blob removal in transactions - #100064

Merged
Michicosun merged 31 commits into
masterfrom
disk_sync_wait_blobs_removal
Mar 26, 2026
Merged

Michicosun merged 31 commits into
masterfrom
disk_sync_wait_blobs_removal

Conversation

@Michicosun

@Michicosun Michicosun commented Mar 19, 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):

Fixes #99996

Version info

  • Merged into: 26.4.1.285
  • Backported to: 26.3.3.9, 26.2.7.13

@clickhouse-gh

clickhouse-gh Bot commented Mar 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [8540ecf]

Summary: ❌

job_name test_name status info comment
Stateless tests (amd_msan, WasmEdge, parallel, 1/2) failure
03706_statistics_preserve_checksums_on_mutations FAIL cidb

AI Review

Summary

This PR adds synchronous post-commit blob-removal waiting for DiskObjectStorage transactions and introduces server/disk settings (disk_transaction_wait_for_blob_removal / wait_for_blob_removal) to control it. The main risk is semantic drift: with waiting enabled, cleanup failures are swallowed and commit still reports success, so behavior becomes best-effort instead of deterministic. I request changes to make the new “wait” contract explicit and reliable, and to cover it with regression tests.

PR Metadata
  • Changelog category is currently Not for changelog, but this PR introduces a new user-visible server setting and changes sync operation behavior; category should be Improvement.
  • Changelog entry is required with Improvement and should describe user impact.
  • Suggested replacement text:
    • Changelog category: Improvement
    • Changelog entry: Added server setting disk_transaction_wait_for_blob_removal(and per-diskwait_for_blob_removal) to control whether object-storage transactions wait for background blob cleanup before returning; default is enabled.
Missing context
  • ⚠️ No CI logs or test results were provided in this review context.
Findings

❌ Blockers

  • [src/Disks/DiskObjectStorage/DiskObjectStorageTransaction.cpp:64] In waitBlobRemoval, exceptions from blob_killer->triggerAndWait are swallowed, while commit/successful tryCommit still return success when wait_for_blob_removal=1. This can silently skip the requested synchronous guarantee under cleanup misconfiguration/failures.
    • Suggested fix: propagate failure when pending blobs remain after wait attempts (or return unsuccessful tryCommit outcome) instead of unconditional success.

⚠️ Majors

  • [src/Disks/DiskObjectStorage/DiskObjectStorageTransaction.cpp:58-59] The loop is bounded to 100 attempts and then exits even if blobs are still pending, so “wait” is effectively best-effort.
    • Suggested fix: either make this deterministic (fail if still pending) or rename/document setting as best-effort and expose timeout/attempts as explicit settings.

💡 Nits

  • [src/Common/ProfileEvents.cpp:258] Profile event description should match current flow (“after committing metadata transaction”).
Tests
  • ⚠️ Missing regression tests for wait_for_blob_removal behavior:
    • enabled path: commit blocks until submitted blobs leave pending-removal state (or fails deterministically on timeout/failure);
    • disabled path: commit does not wait.
      These are needed because this PR changes transaction completion semantics.
ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ✅
No test removal ✅
Experimental gate ➖
No magic constants ⚠️ Fixed retry budget 100 governs sync semantics but is not configurable/documented as contract
Backward compatibility ⚠️ New default waiting behavior can change latency/semantics of sync operations
SettingsChangesHistory.cpp ➖
PR metadata quality ⚠️ Not for changelog does not match user-visible setting/behavior change
Safe rollout ⚠️ Current wait path can silently degrade to best-effort on exceptions
Compilation time ✅
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Make wait_for_blob_removal=1 semantics deterministic (do not silently swallow wait failures while returning success).
    • Add regression tests for both enabled/disabled waiting modes.
    • Fix PR metadata (Changelog category/entry) to reflect the user-visible behavior change.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Mar 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.20% 84.20% +0.00%
Functions 24.40% 24.60% +0.20%
Branches 76.70% 76.70% +0.00%

Changed lines: 90.03% (271/301) · Uncovered code

Full report · Diff report

@Michicosun
Michicosun added this pull request to the merge queue Mar 26, 2026
Merged via the queue into master with commit 5e8f816 Mar 26, 2026
148 of 149 checks passed
@Michicosun
Michicosun deleted the disk_sync_wait_blobs_removal branch March 26, 2026 12:58
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Mar 26, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Mar 27, 2026
robot-clickhouse added a commit that referenced this pull request Mar 27, 2026
Michicosun added a commit that referenced this pull request Mar 30, 2026
Backport #100064 to 26.3: DiskObjectStorage synchronously wait blob removal in transactions
robot-clickhouse added a commit that referenced this pull request Mar 30, 2026
@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 Mar 30, 2026
Michicosun added a commit that referenced this pull request Mar 30, 2026
Backport #100064 to 26.2: DiskObjectStorage synchronously wait blob removal in transactions
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.

Add option to return syncrhonous deletion blob storage data during DROP TABLE ... SYNC execution

5 participants