Skip to content

Revert "Revert "Allow Unfinished Processor Removal in Query Runtime"" - #115810

Merged
Michicosun merged 4 commits into
masterfrom
revert-115809-revert-115625-allow_unfinished_processor_removal
Aug 21, 2026
Merged

Michicosun merged 4 commits into
masterfrom
revert-115809-revert-115625-allow_unfinished_processor_removal

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 21, 2026 •

Copy link
Copy Markdown
Member

Reverts #115809
Must include #115800


Workflow [PR]
Sync PR [sync-upstream/pr/115810]

Version info

  • Merged into: 26.8.1.1890 (included in 26.8 and later)

alexey-milovidov and others added 2 commits August 21, 2026 14:50
Processor removal became deferred: `updatePipeline` only records
`update.to_remove` into a pending group and `updateNode` retires the group
once every processor in it reports `Finished`. Two paths leave a recorded
group behind, so the processors stay in the pipeline until the whole query
is destroyed:

- `updatePipeline` records the group and then returns `Cancelled`, which
  makes `updateNode` return before it reaches the code that retires groups;
- the retiring code handles a single group per prepared node, so a backlog
  can outlive the last `updateNode` call.

Retire every group that is ready instead of one, and also do it on the way
out when `updatePipeline` does not return `Done`.

This is what `Processors.UpdatePipelineMultipleCoordinatorsMultithreaded`
caught on master: it cancels the executor while 16 coordinators are cycling,
so one of them gets its removal stranded and an extra source is still alive
at the end of the test.

https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=b16561cc816cf56cadd0c35ed9ad48964ad7758d&name_0=MasterCI&name_1=Unit%20tests%20%28amd_llvm_coverage%29

Caused by: #115625

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [5702ca0]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted, old_compatibility) FAIL
Logical error: Reading from materialized CTE 'A' before its materialization completed - DelayedPortsProcessor gate is missing in the query plan (STID: 2467-2c2d) FAIL cidb

AI Review

Summary

This PR reverts #115809 and restores deferred removal of unfinished processors in ExecutingGraph, including the follow-up from #115800 that drains every ready removal group and retires ready groups even when updatePipeline() exits through cancellation. That fixes the specific stranded-ready-group regression, but the deferred-removal contract is still incomplete: some queued processors have no guaranteed path to the later prepare() == Finished transition that the new refcounting scheme relies on.

Findings

❌ Blockers

  • [src/Processors/Executors/ExecutingGraph.cpp:223] The new pending-removal path assumes every non-Finished member of update.to_remove will eventually come back through prepare() and call accountFinishedProcessorInGroup(). After disconnect(), though, the executor neither closes/finishes the removed boundary port nor emits an update for it. A processor that was sitting in NeedData or PortFull on that edge can therefore remain dormant forever, and if it does get re-entered common prepare() code paths such as input.isFinished(), output.isFinished(), setNeeded(), or canPush() now throw Port is not connected. That leaves the group stranded in removed_processors until teardown or surfaces a LOGICAL_ERROR, which means the feature is still unsafe for the short-circuit subtree removals it is supposed to support. Suggested fix: make queued removals drive an explicit boundary shutdown/wakeup step, instead of only waiting on a later self-reported Finished status.
Tests
  • ⚠️ Add a focused regression where a processor in to_remove is still NeedData or PortFull on the very port being disconnected. The test should prove that the group is retired before executor teardown, not merely on pipeline destruction.
Final Verdict

Changes requested. The cancellation-specific regression from #115800 looks fixed, but the generic unfinished-removal path still lacks a safe way for disconnected boundary processors to observe the removal and converge to Finished.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 87.00% 87.00% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 79.30% 79.30% +0.00%

Changed lines: Changed C/C++ lines covered: 183/189 (96.83%) · Uncovered code

Full report · Diff report

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


Brings in #115800, which the
re-landed change needs: processors queued for removal were left in the graph
when `updatePipeline` returned `Cancelled`, or when more than one group became
removable between two prepared nodes.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 5702ca02a with master 6e4e77ec8 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 704.50 MiB 701.48 MiB -3.02 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes

4 object files changed (+21.93 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Processors/Executors/ExecutingGraph.cpp.o 138.75 KiB 158.45 KiB +19.70 KiB (+14.19%)

737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

202 translation units recompiled, 2013 s compile time in total, 202 of them have a recent master baseline.

Median compile-time ratio to the baselines is ×0.92 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio.
The matched translation units cost -179.4 s (-8%) in total before that adjustment.

Job report

@Michicosun
Michicosun added this pull request to the merge queue Aug 21, 2026
Merged via the queue into master with commit 7a32e0f Aug 21, 2026
175 of 177 checks passed
@Michicosun
Michicosun deleted the revert-115809-revert-115625-allow_unfinished_processor_removal branch August 21, 2026 23:06
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants