Skip to content

Fix hang when dropping a Refreshable Materialized View during refresh planning - #113188

Merged
thevar1able merged 2 commits into
ClickHouse:masterfrom
evillique:rmv-cancel-during-planning
Aug 7, 2026
Merged

thevar1able merged 2 commits into
ClickHouse:masterfrom
evillique:rmv-cancel-during-planning

Conversation

@evillique

@evillique evillique commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

DROP TABLE of a Refreshable Materialized View waited for the in-flight refresh to finish planning its query, because the refresh query became cancellable only once its pipeline existed. It is now published to the process list before interpretation.

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

Fix DROP TABLE and SYSTEM STOP VIEW hanging when a Refreshable Materialized View is blocked while planning its refresh query.

Version info

  • Merged into: 26.8.1.988 (included in 26.8 and later)
  • Backported to: 26.7.4.38, 26.6.3.54, 26.5.7.62, 26.3.20.3

@clickhouse-gh

clickhouse-gh Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [571c590]

Summary: ✅


AI Review

Summary

This PR makes refresh cancellation visible earlier in RefreshTask by publishing the refresh query's QueryStatus before InterpreterInsertQuery::execute starts planning nested pipelines, and it adds a regression test that now fails hard if it never actually reaches the blocked-planning state. I did not find a remaining correctness, synchronization, or evidence gap in the current diff.

Final Verdict

✅ No new findings.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.50% 86.50% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.70% 78.70% +0.00%

Changed lines: Changed C/C++ lines covered: 17/18 (94.44%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 3, 2026
@evillique
evillique requested a review from al13n321 August 6, 2026 18:29
@thevar1able thevar1able self-assigned this Aug 7, 2026
@thevar1able
thevar1able added this pull request to the merge queue Aug 7, 2026
Merged via the queue into ClickHouse:master with commit 7704325 Aug 7, 2026
180 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 7, 2026
@evillique evillique added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Aug 14, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Aug 14, 2026
clickhouse-gh Bot pushed a commit that referenced this pull request Aug 14, 2026
clickhouse-gh Bot added a commit that referenced this pull request Aug 14, 2026
Backport #113188 to 26.7: Fix hang when dropping a Refreshable Materialized View during refresh planning
robot-clickhouse-ci-1 added a commit that referenced this pull request Aug 17, 2026
Cherry pick #113188 to 25.8: Fix hang when dropping a Refreshable Materialized View during refresh planning
robot-clickhouse added a commit that referenced this pull request Aug 17, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Aug 17, 2026
Cherry pick #113188 to 26.3: Fix hang when dropping a Refreshable Materialized View during refresh planning
robot-clickhouse added a commit that referenced this pull request Aug 17, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Aug 17, 2026
Cherry pick #113188 to 26.5: Fix hang when dropping a Refreshable Materialized View during refresh planning
robot-clickhouse added a commit that referenced this pull request Aug 17, 2026
robot-clickhouse-ci-1 added a commit that referenced this pull request Aug 17, 2026
Cherry pick #113188 to 26.6: Fix hang when dropping a Refreshable Materialized View during refresh planning
robot-clickhouse added a commit that referenced this pull request Aug 17, 2026
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 17, 2026
clickhouse-gh Bot added a commit that referenced this pull request Aug 18, 2026
Backport #113188 to 26.6: Fix hang when dropping a Refreshable Materialized View during refresh planning
evillique added a commit that referenced this pull request Aug 18, 2026
Backport #113188 to 26.3: Fix hang when dropping a Refreshable Materialized View during refresh planning
evillique added a commit that referenced this pull request Aug 18, 2026
Backport #113188 to 26.5: Fix hang when dropping a Refreshable Materialized View during refresh planning
bytehalo-infra added a commit to sentioxyz/ClickHouse that referenced this pull request Sep 25, 2026
OTHER: cancelling a refreshable MV while its refresh query is being planned (IN subqueries) -> hang.
Effect in the production build a394e92: its upstream test(s) 04661_refreshable_mv_cancel_during_planning fail on it and pass on official 26.8.8.8, run on isolated servers (evidence/fix_ci_20260925/upstream_repro/server_triage_PROD263_vs_UP2688.tsv).
Upstream patch with its test(s), adapted: RefreshTask.h: the three header changes are applied by hand (a neighbouring comment differs in the fork); RefreshTask.cpp: the fork logs through `log` where upstream uses getLogger(), the hunk is applied with the fork's logger.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR 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.

4 participants