Skip to content

Antalya 25.8 Backport of #99628 - Fix TOCTOU race in vertical merge cancellation - #2818

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

zvonand merged 2 commits into
antalya-25.8from
backports/antalya-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:06
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-column hunk had already applied cleanly.
@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:

  • 865dc25: cherry-pick with the conflicts committed as-is

  • 6999153: resolution

  • Conflict: the only one was in ExecuteAndFinalizeHorizontalPart::executeImpl in MergeTask.cpp. antalya-25.8 still had the old if (ctx->is_cancelled() || ...pull(block)) line, while the PR replaces it with a latched bool cancelled. The if (cancelled) store in the body had already merged in, so keeping only the old line would have left it referring to an undeclared cancelled.

  • Resolution: I removed the old line and the markers and kept the PR's version. It reads ctx->is_cancelled() once into cancelled and uses it for both the pull condition and the store into merge_list_element_ptr->is_cancelled.

  • Vertical merge: the hunk in executeVerticalMergeForOneColumn merged cleanly and needed no changes.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Workflow [PR], commit [6999153]

@zvonand

zvonand commented Nov 10, 2026

Copy link
Copy Markdown
Member

@blau-ai

@blau-ai

blau-ai commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator Author

CI triage for 6999153

Summary: 4 red checks (2 of them are downstream of the keeper-image failure). None are caused by this PR. The PR changes only src/Storages/MergeTree/MergeTask.cpp and adds the stateless test 04041_vertical_merge_stop_start_race. All stateless, unit, fast-test and regression jobs that ran passed, including the new test.

Check Classification PR-caused?
Integration tests (amd_asan, old analyzer, 4/6): test_storage_s3::test_storage_s3_put_uncompressed Known Antalya bug, hit at random ❌ No
Docker keeper image (and GrypeScanKeeper / Grype Scan …keeper…, which depend on it) Runner infra: arm64 emulation missing ❌ No
DCO Missing Signed-off-by (process) ❌ No (not a code issue)
PR / FinishCIReport Summary checks that only add up the failures above —

1. test_storage_s3/test.py::test_storage_s3_put_uncompressed: known bug, random trigger

E  Code: 1000. DB::Exception: ... Syntax error: Not a valid floating-point number: '347e3767'.
2. Poco::NumberParser::parseFloat
6. DB::PathWithMetadata::CommandInTaskResponse::CommandInTaskResponse(String const&)
9. DB::StorageObjectStorageSource::KeysIterator::next
(query: SELECT sum(id) FROM test_put_uncompressed)

2. Docker keeper image: arm64 build on the runner

#8 [glibc-donor 2/2] RUN arch=arm64 && case $arch in ...
#8 0.229 exec /bin/sh: exec format error
ERROR: failed to solve: process "/bin/sh -c arch=${TARGETARCH:-amd64} ..." did not complete successfully: exit code: 255

3. DCO

Neither commit has a Signed-off-by line: 865dc25 (the upstream merge commit of ClickHouse#99628) and 6999153 (the conflict-resolution commit). Other backport PRs on this branch (e.g. #2797, #2775) show the same DCO failure, so this is the usual state for backports, not a code problem. If the check is required, a maintainer can mark it as passing. I won't rewrite history to fix it, because that needs a force-push.


Verdict: nothing to fix in the PR. Re-run the integration shard and the keeper image job. From this triage, the backport itself looks clean.

@zvonand zvonand added the verified Approved for release label Nov 10, 2026
@zvonand
zvonand merged commit 5e1b7e0 into antalya-25.8 Nov 10, 2026
354 of 359 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants