Repository navigation
Fix flaky text_log/query_log scans on busy CI workers (03312, 03335 azure/s3, 03735) - #103290
Conversation
Both tests fail with `Limit for rows (controlled by 'max_rows_to_read' setting) exceeded, max rows: 20.00 million, current rows: 22.19 million. (TOO_MANY_ROWS)` when run on CI workers whose `system.text_log` has accumulated more than 20M rows. The test queries scan `system.text_log` with LIKE predicates that require a full-table read to find matching messages, hitting the randomized `max_rows_to_read` ceiling. Fix: add `SETTINGS max_rows_to_read = 0` to the `system.text_log` and `system.query_log` queries, following the established pattern used in `02935_parallel_replicas_settings.sql`, `02813_starting_in_text_log.sql`, `03096_text_log_format_string_args_not_empty.sh`, and many others. For `03312_line_numbers.sql`, the fix is applied at the query level (not as a top-of-file `SET`) because the test asserts on `script_line_number` — adding any line before the tracked queries would shift them and break the reference. Verification: - Without the fix: test reliably FAILS with `CLICKHOUSE_CLIENT_OPT="--max_rows_to_read=1000"` on the same query pattern CI hits. - With the fix: 30/30 runs pass with the same restrictive setting plus full randomization.
|
cc @alexey-milovidov — could you review this? It fixes two chronic flaky tests (03312, 03335) that fail on busy CI workers when |
|
Workflow [PR], commit [377453f] Summary: ✅ AI ReviewSummaryThis PR removes deterministic Final Verdict
|
Two more stateless tests hit the same `system.text_log` randomized
`max_rows_to_read = 20000000` cap as the previously-fixed `03312` /
`03335_empty_blobs_on_azure`:
- `03335_empty_blobs_on_s3.sh` is the S3 sibling of the Azure variant;
both `Skipped empty blobs after 1 insert:` and
`Skipped empty blobs after 2 inserts and merge:` queries scan
`system.text_log` with a `LIKE` predicate.
- `03735_excessive_buffer_flush.sql` ends with a `system.text_log` scan
using `logger_name LIKE format('%StorageBuffer ({}.%', ...)` to count
Buffer flush logs.
Both reproduce the chronic CI flake on `Stateless tests (arm_binary,
parallel)` workers whose `text_log` has accumulated >20M rows.
Per-failure CI diagnostic confirms the failure is environmental
(reproduces with AND without random settings), not setting-driven:
`03335_empty_blobs_on_s3` 32/32 fail with randomization, 68/68 without;
`03735_excessive_buffer_flush` 3/3 with, 3/3 without. Error message
verbatim:
Code: 158. DB::Exception: Limit for rows (controlled by
'max_rows_to_read' setting) exceeded, max rows: 20.00 million,
current rows: 22.96 million. (TOO_MANY_ROWS)
Fix: append `SETTINGS max_rows_to_read = 0` to each `system.text_log`
query, following the exact pattern already applied earlier in this PR
to `03335_empty_blobs_on_azure.sh` and `03312_line_numbers.sql`, and
established in 15+ other tests (`02935`, `02813`, `03096`, `01165`, ...).
|
Extended this PR to cover two more sibling tests that hit the same
The fix in the new commit is mechanically identical to the merged 03335_azure / 03312 pattern. Pre-PR validation gatea) Deterministic repro? Yes — b) Root cause explained? c) Fix matches root cause? Yes — d) Test intent preserved? Yes — the queries still scan the same rows with the same predicates and still produce the same output. Only the artificial row-count cap on the e) Both directions demonstrated? The failure direction is established by CI: deterministic f) Fix is general? Same pattern now applied symmetrically to the S3 sibling and to the Buffer-engine variant — no remaining cc @alexey-milovidov — same scope as before, just two more sibling tests folded in. CI is re-running now. — Session: |
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 490 line(s), 52 function(s) across 139 file(s) · Details Top files
|
…ows-to-read-03312-03335 Fix flaky text_log/query_log scans on busy CI workers (03312, 03335 azure/s3, 03735)
04640_deduplication_log_reattach_no_phantom_blobs and 05258_deduplication_log_alter_window_no_phantom_blobs end with a count() over system.text_log that filters only on level and message. Neither column is in the table's key (ORDER BY (event_date, event_time)), so the read selects every granule, and once a long parallel run has logged more than 20 million rows the query fails with TOO_MANY_ROWS against max_rows_to_read = 20000000 from tests/config/users.d/limits.yaml (seen in the CH Inc sync check: "current rows: 20.31 million", query 15, line 39 of 05258). Apply the two levers already used for this family of tests: - event_date >= yesterday() AND event_time >= now() - 600, the convention of 9eaf025 and b8c39c9, so the primary key prunes the read to the last ten minutes; - SETTINGS max_rows_to_read = 0, as in ClickHouse#103290, because the window alone can exceed the limit on a log-heavy run (a time-bounded query of 00956_sensitive_data_masking failed at 21.28 million rows in the CI of PR 103706). The bound cannot hide a real error row: the row is logged by the test's own ATTACH shortly before the check, these tests are killed after 600 s (the runner's --timeout default, which CI keeps; they are not tagged long), and yesterday() leaves a day of slack against the randomized session_timezone. Validated on master e5b8853 with the CI config overlay and a local MinIO, with a text_log of 21 million rows: the unmodified tests fail 6/6 with the same TOO_MANY_ROWS, the fixed ones pass 6/6, also with 21 million rows inside the window (their SELECT then reads 21.02 million rows); a corrupted deduplication log is still counted (base and fixed check both return 1); 100/100 randomized runs pass. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
Description
Several stateless tests fail on CI workers whose
system.text_loghas accumulated more than 20M rows, with:The test queries scan
system.text_log(orsystem.query_log) withLIKEpredicates that require a full-table read to find the matching messages, so they hit the randomizedmax_rows_to_readceiling the test runner injects intoCLICKHOUSE_CLIENT_OPT. The per-failure CI diagnostic confirms the failures reproduce both with AND without random settings — this is a deterministic environmental flake, not a settings randomization issue.This PR fixes four tests with the same root cause:
03312_line_numbers.sql03335_empty_blobs_on_azure.sh03335_empty_blobs_on_s3.sh(added 2026-05-21)03735_excessive_buffer_flush.sql(added 2026-05-21)Fix
Add
SETTINGS max_rows_to_read = 0to eachsystem.text_log(and thesystem.query_log) query, following the well-established pattern in other tests such as02935_parallel_replicas_settings.sql,02813_starting_in_text_log.sql,03096_text_log_format_string_args_not_empty.sh, and01165_lost_part_empty_partition.sql.For
03312_line_numbers.sqlthe fix is applied at the query level rather than as a top-of-fileSET, because the test asserts onscript_line_number— adding any line above the tracked queries would shift them and break the reference.CIDB evidence (30 days)
03312_line_numbers: 4 genuinely unrelated PRs (+ 0 master) with the sameTOO_MANY_ROWSsignature.03335_empty_blobs_on_azure: 8 genuinely unrelated PRs (+ 0 master) with the sameTOO_MANY_ROWSsignature.03335_empty_blobs_on_s3: 1 unrelated PR (ReaderExecutor: pipeline-based read orchestration #103706) with diagnostic showing 32/32 fail WITH randomization and 68/68 fail WITHOUT randomization.03735_excessive_buffer_flush: 2 unrelated PRs (ReaderExecutor: pipeline-based read orchestration #103706, Lightweight Updates v2 #103182) + 1 master hit (2026-05-04 21:06:28), 3/3 fail WITH and 3/3 fail WITHOUT randomization.Verification
03312_line_numbers.sqlwithCLICKHOUSE_CLIENT_OPT="--max_rows_to_read=1000"reliably reproduces03735_excessive_buffer_flushwas additionally verified locally (1 OK / 21s) after the new commit.CI report
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Version info
26.6.1.113