Skip to content

Bound the system.text_log read in 05237_hash_join_row_store_cache_miss - #124473

Merged
m-selmi merged 2 commits into
ClickHouse:masterfrom
groeneai:bound-05237-text-log-read
Oct 8, 2026
Merged

m-selmi merged 2 commits into
ClickHouse:masterfrom
groeneai:bound-05237-text-log-read

Conversation

@groeneai

@groeneai groeneai commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #100394 (comment)

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

05237_hash_join_row_store_cache_miss (added in #121981) ends with a LEFT JOIN system.text_log that has no predicate on text_log, so the whole table is read as the join's build side. Late in a long parallel run that exceeds the max_rows_to_read = 20000000 of tests/config/users.d/limits.yaml. Reported from the CH Inc sync check in #100394 (comment):

Code: 158. DB::Exception: Limit for rows (controlled by 'max_rows_to_read' setting) exceeded, max rows: 20.00 million, current rows: 20.15 million. (TOO_MANY_ROWS) (query 35, line 53)

Change. The right side becomes a subquery bounded by the table's key, event_date >= yesterday() AND event_time >= now() - 600, and the statement gets SETTINGS max_rows_to_read = 0: the two levers of #103290 and #122525. The bound sits inside the subquery, because a filter after the LEFT JOIN would drop the queries that log no row store line. The joined lines are written by the test's own queries, well inside the window (the test is killed after 600 s). The .reference is unchanged.

Validation (master 516006f49ada9 debug build, limits.yaml in users.d, system.text_log padded with 21M rows):

  • rows outside the window: the unmodified test fails with the error above (query 35, line 53); the fixed one passes, and its last query reads 6,493 rows;
  • rows inside the window: unmodified fails, fixed passes; without the SETTINGS line it fails, so both levers are needed;
  • 50/50 runs with randomized settings; the unmodified test fails 10/10 on the same server.

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

Version info

  • Merged into: 26.10.1.1844-master (included in 26.10 and later)

The final assertion joined `system.text_log` with no predicate, so the
whole table was read as the join's build side and, on a log-heavy CI
server, exceeded the `max_rows_to_read = 20000000` of
`tests/config/users.d/limits.yaml` (`TOO_MANY_ROWS`, query 35, line 53,
reported from the CH Inc sync check on ClickHouse#100394).

Read `text_log` through a subquery bounded by its primary key to the
last 10 minutes and lift the row limit for that statement, as ClickHouse#103290
and ClickHouse#122525 do. The bound stays inside the subquery so the `LEFT JOIN`
keeps the queries that log no row store line. The joined rows are
written by the test's own queries, and the test is killed after 600 s,
so they are always inside the window.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 7, 2026
@groeneai

groeneai commented Oct 7, 2026

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

Pre-publication review by an independent model (engine: codex; 1 finding) plus my own review (1 nit).

# Sev Finding Verdict Evidence / action
1 ⚠️ The .reference does not prove the text_log time bound prunes, so it could stop pruning while the test stays green DISAGREE max_rows_to_read = 0 removes the TOO_MANY_ROWS whether or not the bound prunes (42M rows inside the window: passes); the bound is live (21M rows outside it: the last query reads 6,493 rows). A plan oracle on system.text_log would test system-table key analysis, not the row store
2 💡 The query_log side keeps its date-only bound noted Covered by the statement-level setting; left as is to keep the diff minimal

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-8:20261007-182400

@groeneai

groeneai commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Debug build of master 516006f49ada9, server with tests/config/users.d/limits.yaml, system.text_log padded with 21M rows: the unmodified test fails 12/12 with TOO_MANY_ROWS (query 35, line 53), the CI signature.
b Root cause explained? The final LEFT JOIN system.text_log has no predicate on text_log, so the whole table is the build side and its read is checked against max_rows_to_read = 20000000; a log-heavy CI server passes that.
c Fix matches root cause? Yes. The read is bounded by the table's key (event_date, event_time) to the last 10 minutes, and the statement gets SETTINGS max_rows_to_read = 0, as in #103290 / #122525. No tag, no config change.
d Test intent preserved / new tests added? Yes. .reference unchanged; with the row store disabled the fixed test still fails on the reference diff. The joined lines come from the test's own queries, and the test is killed after 600 s, so they are always inside the window.
e Both directions demonstrated? Yes. Same binary and server: unmodified 12/12 FAIL, fixed 52/52 OK (21M rows outside the window: last query reads 6,493 rows; 42M rows inside it: passes). Without the SETTINGS line it fails when the window holds >20M rows.
f Fix is general across code paths? It is the only system.text_log read in the file; the query_log read is covered by the statement-level setting.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change). 50 randomized runs covered 6 session time zones; the bound compares instants.
h Backward compatible? (maintainer-approved exception only) N/A (test-only change).
i Invariants and contracts preserved? Yes. The time bound is inside the right-side subquery, so the LEFT JOIN still keeps the queries with no row store line (empty values in the .reference).

Session id: cron:clickhouse-impl-slot-5:20261007-174600

@clickhouse-gh

clickhouse-gh Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6f8581f]

Summary: ✅


AI Review

Summary

This PR narrows the system.text_log side of 05237_hash_join_row_store_cache_miss to a recent time window and applies max_rows_to_read = 0 to the final verification query, which matches the stated goal of eliminating the CI-only TOO_MANY_ROWS failure without changing the test's asserted result. I did not find correctness, safety, performance, or test-quality issues in the current diff after checking the PR discussion, current file contents, and the one-file patch.

Final Verdict

✅ Approve. The change is narrowly scoped, the CI Fix or Improvement metadata matches the actual change, and there are no new inline findings to post.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 7, 2026
@m-selmi
m-selmi added this pull request to the merge queue Oct 8, 2026
Merged via the queue into ClickHouse:master with commit e9fae2d Oct 8, 2026
152 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 8, 2026
@clickhouse-gh clickhouse-gh Bot added comp-joins JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla... 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-joins JOINs end-to-end (planning hooks + runtime join operators/algorithms). Single bucket to avoid pla... groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-ci 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