Skip to content

Antalya 26.3 Backport of #99628 - Fix TOCTOU race in vertical merge cancellation - #2820

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

zvonand merged 2 commits into
antalya-26.3from
backports/antalya-26.3/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 in executeImpl; the other hunk 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:

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

  • 2d7cba9: resolution

  • src/Storages/MergeTree/MergeTask.cpp conflicted in executeImpl, where antalya-26.3 had the old if (ctx->is_cancelled() || ...pull(block)) condition and the PR rewrites it.

  • I removed the conflict markers and kept the PR's version, which reads ctx->is_cancelled() once into cancelled and sets merge_list_element_ptr->is_cancelled if it is true.

  • The executeVerticalMergeForOneColumn hunk applied cleanly with the same latching approach.

  • I did not build or run the new regression test 04041_vertical_merge_stop_start_race.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Workflow [PR], commit [2d7cba9]

@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 2d7cba9

3 failing checks: none caused by the code change. One stateless test fails in 2 suites and also fails the same way on unrelated PRs. DCO is a commit-metadata problem. The PR check is just the aggregate gate.

Check Failure Verdict
Stateless tests (amd_debug, sequential) 03271_s3_table_function_asterisk_glob Pre-existing (external S3 / network)
Stateless tests (amd_debug, distributed plan, s3 storage, sequential) 03271_s3_table_function_asterisk_glob Pre-existing (same)
DCO No Signed-off-by on either commit On this PR, but metadata only, not code

Everything else that ran is green: builds, fast/quick tests, the other stateless suites (asan, ubsan, debug parallel), integration (asan, binary), unit, stress, AST fuzzer, BuzzHouse, SQLLogic, compatibility, and the regression suites. Many tsan/msan/arm jobs were skipped by the workflow config.


1. 03271_s3_table_function_asterisk_glob (both amd_debug sequential suites)

Reason: return code:  159
Error on processing query: Timeout exceeded while receiving data from server. Waited for 300 seconds, timeout is 300 seconds.
(query: SELECT * FROM s3('https://clickhouse-public-datasets.s3.amazonaws.com/wikistat/original/*', NOSIGN) LIMIT 1 FORMAT Null;)
  • Not caused by this PR. The query globs a very large public AWS bucket over the internet. This PR only changes the vertical-merge cancellation in MergeTask.cpp, which is never reached by an s3() table-function read.
  • The same failure shows up elsewhere on antalya-26.3. The identical test fails in the same two suites on unrelated PRs:
  • The earlier queries in the test returned the expected output. Only the call to the external bucket timed out.
  • Next step: nothing to do on this PR. If it keeps failing across the branch, it is worth tagging the test as network-dependent or skipping it on Altinity CI, as a separate change.

2. DCO

All commits are incorrectly signed off, the check did not pass.
🔴 2106669  Merge pull request #99628 from Desel72/fix/issue-9...  Sign-off not found
🔴 2d7cba9  Resolve conflicts in backport of #99628                Sign-off not found
  • The backport tooling made the cherry-pick commit (2106669) and the conflict-resolution commit (2d7cba9), and neither has a Signed-off-by: line.
  • Fix, either of:
    • Push a DCO remediation commit with no file changes, e.g. git commit --allow-empty -s with the I, <name>, hereby add my Signed-off-by to this commit: <sha> lines for both SHAs (dco2 docs).
    • Have a maintainer set DCO to pass, if that's how backport PRs are usually handled.
  • I didn't push anything: a sign-off has to come from the committer, and rewriting history would need a force-push.

Notes

@zvonand zvonand added the verified Approved for release label Nov 10, 2026
@zvonand
zvonand merged commit 71d1aac into antalya-26.3 Nov 10, 2026
419 of 427 checks passed
@blau-ai blau-ai mentioned this pull request Nov 16, 2026
9 of 30 tasks
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