Repository navigation
Scope SHOW DATABASES in 02105_backslash_letter_commands - #113713
PedroTadim merged 1 commit into
Conversation
The test matched against `SHOW DATABASES`, whose size is set by whatever other tests happen to be running concurrently. It is the only one of the 54 `.expect` tests that renders `SHOW DATABASES` or `SHOW TABLES` unscoped, which is why the sibling client/expect tests passed in every job where this one failed. `ClientBase::mainImpl`'s alias loop substitutes only the first backslash alias (the `break` at src/Client/ClientBase.cpp:4657), so line 35 sent `SHOW DATABASES ; \d;` and line 38 sent `SHOW DATABASES ;`. The rendered table pads every row to the widest database name, bounded only by `output_format_pretty_max_column_pad_width` (default 250), so a concurrent test creating very long database names inflated the matched output by roughly 8x. Past a few kilobytes the client stops emitting output mid-stream, the prompt is never written, and the script's `expect_after` turns the 60s timeout into a failure. The two reason strings seen in CI, `return code: 1` and `Timeout! Killing process group`, are the same event and differ only in which timeout fires first. Scoping both `\l` sends with `like 'system'` matches the idiom this test already uses for `\d` on line 49. Measured on one binary against a fixture of ~120 databases whose widest name is 214 characters: the largest buffer expect must retain drops from 6001 characters, exactly its cap of `3 * match_max + 1`, to 340, and buffers sitting at that cap from 11 to 0. Interleaving both variants to cancel load drift on a shared box, the previous form fails 9 of 12 runs and the scoped one 0 of 12. 50 randomized and 50 non-randomized runs pass, and a suite slice over all 54 `.expect` tests plus 04655, 03566 and 00419 has identical failure sets on both arms. Because the client echoes the formatted query in interactive mode, the predicate also appears in that echo, so the pre-existing `expect "system"` would have been satisfied by the echoed text alone. An `expect "1 row in set"` is therefore added after it: that string is emitted only below the rendered result, and the unfiltered statement reports a row count that varies with the environment and is never one, so the assertion pins both that the predicate reached the server and that it was applied. Reverting the two predicates while keeping the assertion makes the test fail while awaiting it, against an otherwise complete and correct unfiltered answer. Coverage is preserved and slightly extended. All 19 assertions fire in order; unfiltered `SHOW DATABASES` keeps separate coverage in 00419_show_sql_queries.sh; and `\l` argument pass-through (src/Client/ClientBase.cpp:4655) becomes newly covered, having previously been exercised only through `\c` and `\d`. Why the client stops writing is not identified, and this does not claim to fix it. What it removes is the measured precondition: a test matching unbounded output that unrelated tests control.
Internal second-model review — 1 blocker fixed, 2 nitsBefore opening this PR I ran an independent cold review of the resulting code plus a ❌ BlockersThe Raised independently by both passes.
So with the predicate alone, Fixed by adding
|
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-42:20260806-173400 |
|
cc @azat, could you review this? The test matched an unscoped |
|
Workflow [PR], commit [2f85949] Summary: ✅ AI ReviewSummaryThis PR scopes the flaky Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
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. Compile time of recompiled translation units6 translation units recompiled, 3 s compile time in total, 6 of them have a recent master baseline. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
02105_backslash_letter_commands.expectmatches againstSHOW DATABASES, whose size is set bywhatever other tests are running. It is the only one of the 54
.expecttests renderingSHOW DATABASESorSHOW TABLESunscoped, which is why the sibling client tests passed inevery job where it failed.
The rendered table pads every row to the widest database name (bounded only by
output_format_pretty_max_column_pad_width, default 250), so a concurrent test creating verylong names inflated what this test must match by 7.6x. Past a few kilobytes the client stops
emitting output mid-stream, the prompt is never written, and
expect_afterturns the 60stimeout into a failure. The reason strings
return code: 1andTimeout! Killing process groupare one event.This scopes both
\lsends withlike 'system', the idiom this test already uses for\donline 49. Measured against ~120 databases whose widest name is 214 characters: the largest
buffer expect must retain drops from 6001 characters, exactly its cap of
3 * match_max + 1,to about 340, and buffers at that cap from 11 to 0. Interleaved to cancel load drift, the
current test fails 9 of 12 runs and the scoped one 0 of 12; 50 randomized and 50 plain runs
pass.
Since the client echoes the formatted query, the predicate alone would have let
expect "system"match the echoedLIKE 'system'rather than a result row, so the test alsogains a
1 row in setassertion. That count is printed only below the rendered result, and theunfiltered statement reports a count that varies with the environment and is never one.
00419_show_sql_queries.shstill covers unfilteredSHOW DATABASES.I did not identify why the client stops writing, and this does not claim to. It removes the
measured precondition: a test matching unbounded output controlled by other tests.