Skip to content

Revert the PromQL topk/limitk streaming plan and its shared-subquery materialization - #114326

Merged
alexey-milovidov merged 2 commits into
masterfrom
revert-promql-topk-streaming-deadlock
Aug 12, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
revert-promql-topk-streaming-deadlock

Conversation

@alexey-milovidov

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

Copy link
Copy Markdown
Member

Reverts the PromQL topk/bottomk/limitk streaming plan and the shared-subquery materialization built on top of it, because they deadlock DROP TABLE on a TimeSeries table and have kept the stress tests red on master since 2026-08-10.

The stuck query is DROP TABLE prometheus, blocked for 849 seconds in StorageTimeSeries::dropInnerTableIfAny -> InterpreterDropQuery -> DatabaseCatalog::waitTableFinallyDropped, with DROP DATABASE ... SYNC and DETACH DATABASE queued behind its DDLGuard. The stress database is the one created by 04811_promql_topk_bottomk_limitk, whose vector-grid subquery #113772 turned into a SQLSubqueryType::MATERIALIZED_TABLE.

CI history puts the onset between two commits. Twenty-three consecutive stress-tested master commits are clean through b9d4064cb88 (#113772, merged 2026-08-10 07:02 UTC); the next first-parent commit, 5e52a0f269f (#114061, which only deletes tests), fails at 08:18 UTC, and the failure has not stopped since - 51 occurrences over 28 commits on 2026-08-10 against a baseline of 1 to 5 per day, across every stress configuration. Hung check failed, possible deadlock found on master, by day:

Day Failures Commits
2026-08-07 1 1
2026-08-08 0 0
2026-08-09 0 0
2026-08-10 51 28

#113656 is reverted together with #113772 rather than left in place: #113772 edits the body of applyLimitAggregationOperator, the function #113656 introduced, so reverting only the newer one leaves half of the feature behind and reverting only the older one does not apply. The two reverts are in one pull request, newest first, so that neither commit stands alone on master.

Related: #113772
Related: #113656

Both changes were merged after the last release and never shipped, so no changelog entry is needed. The reverted work should be reintroduced once the TimeSeries inner-table drop no longer waits on a reference held by the materialized subquery.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Version info

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

robot-clickhouse and others added 2 commits August 11, 2026 13:39
This reverts pull request #113772 (merge commit
b9d4064).

Stress tests on `master` started reporting `Hung check failed, possible
deadlock found` on the first commit after this one, and have not stopped
since. The stuck query is `DROP TABLE prometheus` blocked in
`StorageTimeSeries::dropInnerTableIfAny` ->
`DatabaseCatalog::waitTableFinallyDropped`, in the PromQL `limitk` test
whose vector-grid subquery this change turned into a
`SQLSubqueryType::MATERIALIZED_TABLE`.

Related: #113772

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
… plan"

This reverts pull request #113656 (merge commit
bf4fa22).

Reverted together with #113772, which built on the plan this change
introduced: the two touch the same function, so reverting only the newer
one would leave the older half of the feature in place.

Related: #113656

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fa31690]

Summary: ❌

job_name test_name status info comment
Stress test (arm_asan_ubsan, s3) FAIL
Sanitizer (STID: 2064-22d0) FAIL cidb

AI Review

Summary

This PR cleanly reverts the short-lived PromQL topk / bottomk / limitk streaming implementation and the AS MATERIALIZED shared-subquery path behind it. I did not find any actionable correctness, compatibility, or coverage issues in the revert itself: the removed aggregate functions are fully unregistered, the materialized-CTE plumbing is removed consistently, and the remaining PromQL support still has parser and integration coverage.

Final Verdict

✅ No actionable findings.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.70% 86.70% +0.00%
Functions 92.00% 92.00% +0.00%
Branches 79.00% 79.00% +0.00%

Changed lines: Changed C/C++ lines covered: 169/173 (97.69%) · 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 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing fa316902a with master c462bd702 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 93cb91d56; 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 691.29 MiB 688.11 MiB -3.18 MiB (-0.46%)

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

9 object files changed (+19.59 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Storages/TimeSeries/PrometheusQueryToSQL/applyLimitAggregationOperator.cpp.o 157.62 KiB 184.75 KiB +27.12 KiB (+17.21%)

739 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

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

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

Job report

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