Repository navigation
Stable 26.3 Backport of #99628 - Fix TOCTOU race in vertical merge cancellation - #2813
Conversation
Fix TOCTOU race in vertical merge cancellation Conflicts committed as-is; the next commit resolves them: - src/Storages/MergeTree/MergeTask.cpp (both modified)
Applied the final cancellation-latching form of the fix directly, since stable-26.3 lacked the earlier partial fix; also fixed the misplaced `{` at line 1278.
|
Port-AL: cherry-pick conflicts resolved by AI Conflicted files:
Commits:
|
CI triage for
|
| Check | Verdict |
|---|---|
| Stateless tests (amd_debug, sequential) | Pre-existing / infra (network to public S3) |
| Stateless tests (amd_debug, distributed plan, s3 storage, sequential) | Same test, same cause |
| AST fuzzer (amd_debug) | Not PR-related: known analyzer/planner LOGICAL_ERROR |
| DCO | Expected on backports (unsigned upstream commit) |
The PR changes only src/Storages/MergeTree/MergeTask.cpp and adds 04041_vertical_merge_stop_start_race. No failure goes through vertical merges. Every other stateless suite that ran is green: amd_debug parallel, ubsan, asan 1-4/4, and distributed plan s3 parallel.
1 & 2. Stateless tests: 03271_s3_table_function_asterisk_glob (both amd_debug sequential suites)
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;)
- Classification: infra / pre-existing. The test lists a large public internet bucket (
-- Tag no-fasttest: Depends on AWS), and the query hung for 300 s on the S3 listing. - Evidence: the same test fails in the same two suites on the unrelated sibling backport Stable 26.3 Backport of #102156 - Fix Nullable(X)->Y cross-type ALTER MODIFY COLUMN #2711 (
f436b1bc), whose report lists03271_s3_table_function_asterisk_globas FAIL in bothamd_debug, sequentialandamd_debug, distributed plan, s3 storage, sequential. The result is the same no matter what the PR changes. - Next step: none for this PR. It's safe to re-run or ignore. A separate fix would be to skip or mark this test broken on Altinity runners that have slow or limited egress to
clickhouse-public-datasets.
3. AST fuzzer (amd_debug): server abort
gdb backtrace in job.log:
Thread 767 "TCPHandler" received signal SIGABRT
#6 DB::handle_error_code (... code=49 ...) # LOGICAL_ERROR
#11 DB::GlobalPlannerContext::createColumnIdentifier src/Planner/PlannerContext.cpp:39
#12 prepareBuildQueryPlanForTableExpression src/Planner/PlannerJoinTree.cpp:485
#13 DB::buildJoinTreeQueryPlan
PlannerContext.cpp:39 throws Column identifier {} is already registered.
- Classification: not PR-related. This is the long-running analyzer/planner fuzzer finding, and it is unrelated to MergeTree merges.
- Evidence: the crash path is query planning (Analyzer → Planner) and never reaches
MergeTask. Upstream has a family of issues for exactly this message: Logical error: Column identifier A is already registered (STID: 4697-4326) ClickHouse/ClickHouse#99931, Logical error: Column identifier A is already registered (STID: 4697-369d) ClickHouse/ClickHouse#100678, Analyzer LOGICAL_ERROR 'Column identifier id is already registered' on ALTER/lightweight UPDATE with IN-subquery joining derived tables (regression in 26.6) ClickHouse/ClickHouse#106649, Correlated subquery over a VIEW on a Distributed table bypasses the "not supported with remote tables" check: exception 49Column identifier __table1.n is already registeredClickHouse/ClickHouse#116090, and Custom-key parallel replicas over a VIEW + correlated subquery: exception 49Column identifier __table1.v is already registeredClickHouse/ClickHouse#111896 (still open). The fuzzer's random queries hit it non-deterministically, and on Stable 26.3 Backport of #102156 - Fix Nullable(X)->Y cross-type ALTER MODIFY COLUMN #2711 and Stable 26.3 Backport of #127318 - Distrust the compromised eMudhra certificates #2696 the same job ended with "Fuzzer exited with timeout" (pass) without reaching it. - Next step: none for this PR. If it keeps showing up on stable-26.3, it's worth tracking separately, for example by backporting whichever upstream fix covers the specific query shape. The core dump and full logs are under the job's
ast_fuzzer_amd_debug/artifacts.
4. DCO
- Classification: expected on backport PRs. Neither the cherry-picked upstream merge commit (
a36ad3c402) nor the conflict-resolution commit has aSigned-off-bytrailer. - Evidence: DCO also fails on Stable 26.3 Backport of #102156 - Fix Nullable(X)->Y cross-type ALTER MODIFY COLUMN #2711 and Stable 26.3 Backport of #127318 - Distrust the compromised eMudhra certificates #2696, the other
backports/stable-26.3/*PRs. - Next step: none, unless the branch policy requires DCO. In that case use the DCO app's "set to pass" override; re-signing would require rewriting history, so it isn't recommended.
Bottom line: nothing in this CI run points to a problem in the backported MergeTask.cpp change. Most sanitizer suites (tsan/msan/arm) were excluded through the CI/CD options in the PR body, so this run gives no tsan coverage of this race fix. If you want that coverage before merging, enable the tsan stateless suites.
Evidence: result_pr.json for this SHA and for #2711, AST fuzzer job.log (gdb section), and gh pr checks on #2696/#2711. No local build or test re-run was needed.
Changelog category (leave one):
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 MERGESandSYSTEM START MERGESare executed concurrently. (ClickHouse#99628 by @Daedalus-Icarus)Documentation entry for user-facing changes
...
CI/CD Options
Exclude tests:
Regression jobs to run: