Skip to content

Stable 25.8 Backport of #99628 - Fix TOCTOU race in vertical merge cancellation - #2819

Merged
zvonand merged 2 commits into
stable-25.8from
backports/stable-25.8/99628
Nov 10, 2026
Merged

zvonand merged 2 commits into
stable-25.8from
backports/stable-25.8/99628

Conversation

@blau-ai

@blau-ai blau-ai commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

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 to CHANGELOG.md):

Fix a rare logical error exception during vertical merge when SYSTEM STOP MERGES and SYSTEM START MERGES are executed concurrently. (ClickHouse#99628 by @Daedalus-Icarus)

Documentation entry for user-facing changes

...

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

Avogar and others added 2 commits November 9, 2026 11:07
Fix TOCTOU race in vertical merge cancellation

Conflicts committed as-is; the next commit resolves them:
- src/Storages/MergeTree/MergeTask.cpp (both modified)
Took the PR's latched-cancellation code in `executeImpl`; the vertical-merge hunk had already applied cleanly.
@blau-ai blau-ai added 25.8 25.8 Altinity Stable backport Backport stable stable-25.8 labels Nov 9, 2026
@blau-ai

blau-ai commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator Author

Port-AL: cherry-pick conflicts resolved by AI

Conflicted files:

  • src/Storages/MergeTree/MergeTask.cpp (both modified)

Commits:

  • dea191b: cherry-pick with the conflicts committed as-is

  • 08ec335: resolution

  • The conflict was in ExecuteAndFinalizeHorizontalPart::executeImpl. stable-25.8 has if (ctx->is_cancelled() || !pull(block)) with no earlier latch, so the PR's context lines didn't match.

  • I removed the conflict markers and kept the PR's version. It reads ctx->is_cancelled() once into cancelled, then stores it into merge_list_element_ptr->is_cancelled before calling finalize().

  • The second hunk, in VerticalMergeStage::executeVerticalMergeForOneColumn, applied cleanly and has the same latching logic.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Workflow [PR], commit [08ec335]

@zvonand
zvonand merged commit 7a118cf into stable-25.8 Nov 10, 2026
241 of 242 checks passed
@zvonand zvonand added the verified Approved for release label Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

25.8 25.8 Altinity Stable backport Backport stable stable-25.8 verified Approved for release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants