Skip to content

Keep the set of IN in memory in 02844_subquery_timeout_with_break - #126623

Merged
nihalzp merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-02844-in-set-stays-in-memory
Oct 20, 2026
Merged

nihalzp merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-02844-in-set-stays-in-memory

Conversation

@groeneai

@groeneai groeneai commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #124907

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

Description

02844_subquery_timeout_with_break fails with Query was cancelled before the set of IN was written to disk. (QUERY_WAS_CANCELLED) in Stateless tests (arm_binary, AsyncInsert, s3 storage, parallel) with --max_bytes_before_external_set 8556090 (127/128 reruns with the same settings fail).

Since #124907 the runner randomizes the spill thresholds of the set of IN. A threshold below what the set collects in the test's 0.1 s puts the set on disk, and a set on disk throws in the break mode by design (05401_external_set_cancellation). The test checks the set that stays in memory, so it now clamps both thresholds to 0 with Random settings limits; other settings stay random.

Validation: with the CI value it fails 20/20, with 0 it passes 50/50; with the runner's draw forced to the CI value it passes 20/20 with the clamp and fails 20/20 without it; 50/50 randomized runs pass.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.281-master (included in 26.11 and later)
  • Backported to: 26.10.2.29

Since ClickHouse#124907 the test runner randomizes `max_bytes_before_external_set`
and `max_bytes_ratio_before_external_set`. When the threshold is below
what the set collects before the test's 0.1 s limit, the set goes to
disk, and the disk set builder throws `QUERY_WAS_CANCELLED` in the
`break` mode by design (`05401_external_set_cancellation`). The test
checks the quiet stop of the in-memory set, so clamp both thresholds to
0 for it with `Random settings limits`; every other setting stays
random.

Failed in "Stateless tests (arm_binary, AsyncInsert, s3 storage,
parallel)" on PR ClickHouse#126476 with `--max_bytes_before_external_set 8556090`
(127/128 reruns with the same settings failed).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) and my own cold review (0 findings). Test-only change; nothing to adjudicate.

Session id: cron:clickhouse-review-slot-8:20261018-231800

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @nihalzp, could you review this and add the can be tested label so CI runs? Since #124907 randomizes max_bytes_before_external_set, the set of IN in 02844_subquery_timeout_with_break can go to disk, where the break mode throws QUERY_WAS_CANCELLED by design, so the test now clamps both spill thresholds to 0 with Random settings limits.

@clickhouse-gh

clickhouse-gh Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [406efc9]

Summary: ✅


AI Review

Summary

This test-only change clamps max_bytes_before_external_set and max_bytes_ratio_before_external_set to zero for 02844_subquery_timeout_with_break, preserving its in-memory timeout behavior while leaving other settings randomized. No actionable findings.

Final Verdict

Status: ✅ Approve

@nihalzp
nihalzp added this pull request to the merge queue Oct 20, 2026
Merged via the queue into ClickHouse:master with commit 2dd86c5 Oct 20, 2026
526 of 528 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 20, 2026
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 20, 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 Oct 20, 2026
alexey-milovidov pushed a commit to scanhex12/ClickHouse that referenced this pull request Oct 20, 2026
Since ClickHouse#124907 the test runner randomizes max_bytes_before_external_set and
max_bytes_ratio_before_external_set. A threshold below the memory of the
1M-key set makes the set spill while it is built, and such a set keeps no
explicit elements, so the primary key cannot use it and force_primary_key = 1
throws INDEX_NOT_USED. This is documented (docs/reference/statements/in.mdx:
"A set written to disk while it is built cannot be used by the primary key or
data skipping indexes"). CI hit it with --max_bytes_before_external_set 29596895.

Clamp both thresholds to 0 on the existing Random settings limits line (the
runner reads only the first such line); other settings stay random. Same fix
as ClickHouse#126623 for 02844_subquery_timeout_with_break.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
clickhouse-gh Bot added a commit that referenced this pull request Oct 20, 2026
Backport #126623 to 26.10: Keep the set of `IN` in memory in `02844_subquery_timeout_with_break`
zoomxi pushed a commit to zoomxi/ClickHouse that referenced this pull request Nov 19, 2026
Since ClickHouse#124907 the runner randomizes max_bytes_before_external_set and
max_bytes_ratio_before_external_set. A draw below the memory of an IN set
(CI: 1215 bytes) makes the set spill while it is built. A spilled set keeps
no explicit elements, so KeyCondition does not use it, partition pruning
keeps all 3 partitions, and EXPLAIN ESTIMATE reports 3 parts instead of 2 in
the "Non-safe cast" section (results stay correct; documented in
docs/reference/statements/in.mdx). The LowCardinality, Nullable and
LowCardinality(Nullable) set sections lose pruning the same way for a
smaller draw.

The test checks pruning by the in-memory set, so clamp both thresholds to 0
with a Random settings limits line; every other setting stays random. Same
fix as ClickHouse#126681 (00673) and ClickHouse#126623 (02844).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-query-execution Runtime execution pipeline, processors, vectorized operators, resource management during execution. pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci 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 v26.10-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants