Skip to content

Backport #114953 to 26.5: Fix an unkillable hang when dropping a low-sorting-name TimeSeries table - #116062

Merged
PedroTadim merged 2 commits into
26.5from
backport/26.5/114953
Aug 25, 2026
Merged

PedroTadim merged 2 commits into
26.5from
backport/26.5/114953

Conversation

@robot-ch-test-poll2

@robot-ch-test-poll2 robot-ch-test-poll2 commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Original pull-request #114953
Cherry-pick pull-request #115857

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.5.8.20

@robot-ch-test-poll2 robot-ch-test-poll2 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 24, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [BackportPR], commit [c9b8a5a]

Summary: ✅

@groeneai

Copy link
Copy Markdown
Collaborator

04920_timeseries_drop_low_sorting_name fails here on its second scenario, line 16:

Code: 8. DB::Exception: Column id is required for the TimeSeries table engine
(THERE_IS_NO_COLUMN) (in query: CREATE MATERIALIZED VIEW mv ENGINE = TimeSeries AS SELECT 1 AS a;)

The fix half of #114953 is fine on this branch. Only that one statement is unportable, and it is my test, so this is my defect to explain.

Mechanism. is_time_series_table is set only by the parser (ParserCreateQuery.cpp:926 on 25.8, :998 on 26.3, :1011 on 26.5). A materialized view builds its inner table from an AST it synthesizes in code, which therefore never carries that flag, so the normalization gate if (create.is_time_series_table && ...) (InterpreterCreateQuery.cpp:769 / :740 / :747) is skipped and the inner create keeps the SELECT's column list, here just a. On this branch StorageTimeSeries's constructor then validates the caller-supplied columns eagerly (StorageTimeSeries.cpp:146 / :146 / :148), finds no id, and throws.

26.6, 26.7 and master do not have that eager validator. They normalize the create query inside the constructor and re-derive the columns from it (makeNormalizedCreateQuery plus InterpreterCreateQuery::getColumnsDescription), which repairs the un-normalized inner create. That arrived in 9758a35dd420807 ("Simplify normalization of TimeSeries create query", 24 files, +1223/-972), which is an ancestor of 26.6 and 26.7 only. It is also why StorageTimeSeries.cpp was the single conflicted file in all three cherry-picks while the 26.6 and 26.7 backports merged clean.

Coverage. Dropping that statement costs nothing on the DDL-guard fix. need_ddl_guard = true reaches InterpreterDropQuery::executeDropQuery from one call site out of twelve, StorageTimeSeries.cpp:329, and both scenarios make the same predicate true; the remaining -ts case covers it and the prom case covers the false branch. On master the statement is the only executed CREATE MATERIALIZED VIEW ... ENGINE = TimeSeries in the test tree, so I would not want it removed there.

Two options, both needing push access I do not have.

  1. Drop lines 13-18 of the .sql and line 2 of the .reference on the three backport/*/114953 branches. Smallest change, keeps master's coverage intact.
  2. Backport 9758a35dd420807 first. Larger, and a TimeSeries normalization change into an LTS branch is not something I should decide.

I cannot do either myself: these heads are in ClickHouse/ClickHouse and my token has push: false, and I do not hand-author release-branch commits. A master-side commit cannot help either, since the backport content is pinned to #114953's merge commit 941dd98b (cherry_pick.py:306,312), so these three heads are frozen with respect to master.

Option 1 is my recommendation if the goal is to land the hang fix on these branches now.

The MV form of the case relies on master's StorageTimeSeries rework, where the constructor ignores
the ColumnsDescription it is handed. This branch still validates it, so the view's `SELECT 1 AS a`
schema is rejected with THERE_IS_NO_COLUMN before the drop under test is reached. The named-table
scenario covers the same fix.
@groeneai

Copy link
Copy Markdown
Collaborator

That answers what I asked, thanks: 25.8 is settled, and the trim here is the smaller of the two remedies I described.

One thing worth confirming, since trimming a test can quietly leave coverage that cannot fail: the remaining scenario is still live on 26.5. The oracle is the low_sorting_name_dropped line, which is only reached after DROP TABLE `-ts` returns; prom is the control that always worked. Run against the published per-release builds, with the fix marker grepped from each build's own GIT_HASH tree:

build no_ddl_lock = need_ddl_guard -ts prom control
26.5.8.18 (74714a50) absent hangs, line never printed passes
26.6.4.19 (865b2d8a) present passes passes

26.6 is the attribution arm: e86eab1f (#115858) is an ancestor of that build, so its pass is the fix rather than an unrelated branch difference. The trimmed test therefore still reddens without the fix and passes with it.

Nothing further needed from me here, and I have no push access to this branch.

@PedroTadim
PedroTadim merged commit 9b81bd7 into 26.5 Aug 25, 2026
34 checks passed
@PedroTadim
PedroTadim deleted the backport/26.5/114953 branch August 25, 2026 10:51
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.

5 participants