Skip to content

Backport #108728 to 26.3: Fix CREATE OR REPLACE MATERIALIZED VIEW ... POPULATE losing the source subscription - #115449

Merged
PedroTadim merged 3 commits into
26.3from
backport/26.3/108728
Aug 20, 2026
Merged

PedroTadim merged 3 commits into
26.3from
backport/26.3/108728

Conversation

@robot-clickhouse-ci-1

@robot-clickhouse-ci-1 robot-clickhouse-ci-1 commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #108728

This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.

The PR source

The PR is created in the CI job

Version info

  • Merged into: 26.3.20.9

… POPULATE losing the source subscription
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added pr-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default labels Aug 19, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [9dd857d]

Summary: ✅

PedroTadim and others added 2 commits August 19, 2026 14:09
`CREATE OR REPLACE MATERIALIZED VIEW` does not exist on 26.3: the parser guards
the `MATERIALIZED` keyword with `!replace_view` and only master dropped that
guard, in `ed062fd96e1` (first released in 26.5). Both backported tests therefore
failed with `Syntax error ... at position 19 (MATERIALIZED)` rather than
exercising anything. `04493` also collided with the existing
`04493_async_insert_dedup_optimize_on_insert_replicated_merge_tree`.

The backported fix is still wanted here, because the same stale storage-cache
entry breaks `CREATE OR REPLACE TABLE ... AS SELECT`, which 26.3 does support:
the internal drop of the replaced table resolves the temporary name to the new,
live table and cancels its merges forever. So both tests are replaced by one that
covers that path.

Verified in both directions with release binaries: on 26.3.17.110, which lacks
the fix, `OPTIMIZE` fails with `Code: 236 ... Cancelled merging parts (ABORTED)`;
on 26.7.4.58, which has it, the test passes.

Related: #115288
Related: #108728

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The push of 6cd5f64 updated the branch ref but GitHub never recorded the
matching synchronize event, so the pull request still reported 085201f as
its head and no CI ran on the new commit.
@PedroTadim
PedroTadim merged commit a0ae900 into 26.3 Aug 20, 2026
34 checks passed
@PedroTadim
PedroTadim deleted the backport/26.3/108728 branch August 20, 2026 10:16
bytehalo-infra added a commit to sentioxyz/ClickHouse that referenced this pull request Sep 25, 2026
OTHER: CREATE OR REPLACE TABLE ... AS SELECT over an existing table -> the internal DROP of the replaced table resolves
the temporary name through a stale storage-cache entry and shuts down the new, live table: its merges are cancelled
for good (every OPTIMIZE fails with ABORTED, background merges never run again until a restart). Upstream reaches
the same cache also through CREATE OR REPLACE MATERIALIZED VIEW ... POPULATE (the source subscription is lost).
Effect in the production build a394e92: the backport's test 04492_create_or_replace_table_as_select_keeps_merges
fails on it and passes on official 26.8.8.8, run on isolated servers (evidence/fix_ci_20260925/upstream_repro/corrected3/). The upstream tests
04492/04493 (MATERIALIZED VIEW ... POPULATE) are no evidence here: 26.3 has no CREATE OR REPLACE MATERIALIZED VIEW,
so they fail on it with a syntax error.
Upstream patch unchanged, with the backport's test: 04492_create_or_replace_table_as_select_keeps_merges.

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-backport Changes, backported to release branch. Do not use manually - automated use only! pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants