Repository navigation
Fix no-op cleanup prologue in 04104_any_join_semi_anti_not_ready_set - #112005
Conversation
The test dropped t_left_004104, t_right_004104, t_subq_004104 (three zeros)
but creates and uses t_left_04104, t_right_04104, t_subq_04104 (two zeros).
Every prologue name was a misspelled twin of a created name, so the prologue
matched nothing and the test had no leftover-state cleanup.
Latent on the default path, where each test gets a fresh test_<random>
database. Live in the stress runner's shared-database mode: stress.py passes
--database=test_{i} to every odd thread, and clickhouse-test skips per-test
cleanup when --database is set, so tables survive between tests. The epilogue
DROPs are unguarded, so a mid-test abort leaves the three tables behind and the
next run in that database fails TABLE_ALREADY_EXISTS at CREATE TABLE
t_left_04104, because the prologue cleared nothing and the CREATEs have no
IF NOT EXISTS.
Verified with the harness in shared-database mode: with a prior run's tables
left behind the test passes with this change and fails with return code 57 when
the rename alone is reverted. The default path is unaffected (50/50 randomized
runs pass) and the reference file is unchanged.
IF NOT EXISTS was deliberately not added to the CREATEs: it would run the test
against a stale table instead of clearing it.
Co-Authored-By: Claude Fable 5 <[email protected]>
Correcting the misspelled prologue names is not sufficient in the mode the
previous commit targets. ci/jobs/scripts/stress/stress.py:222 passes
ignore_drop_queries_probability=0.2 to every non-upgrade stress thread,
including the odd threads that also get --database=test_{i}, and
InterpreterDropQuery.cpp:220-228 reports success without dropping when the
roll fires and storesDataOnDisk is true, which is always the case for
MergeTree. Each prologue DROP was therefore skipped with p=0.2, so all three
cleared only 0.8^3 = 0.512 of the time and the following CREATE, which has no
IF NOT EXISTS, still failed TABLE_ALREADY_EXISTS.
The setting is applied per statement rather than as a file-level SET so the
epilogue DROPs keep exercising the injection.
Verified against the shared-database harness with the probability forced to 1,
so the pin is the only thing that can clear a prior run's tables. Removing the
pin fails with return code 57, and reverting the earlier rename while keeping
the pin also fails with 57, so neither change is redundant. The default
per-test-database path is unaffected, 50 randomized runs pass, and the
reference file is unchanged.
Co-Authored-By: Claude Fable 5 <[email protected]>
Internal second-model review (click to expand)Two rounds. Round 0 bounced this change; round 1 is clean. An independent Round 0 (bounced, both findings fixed here)❌ The corrected prologue was still silently skipped in the very mode this ❌ A coverage claim in the validation-gate comment was false. It asserted
Round 1 (clean)Second model: 0 findings over the full scope. Independent reviewer: 0 blockers, 0 majors. The sweep was re-run from scratch 💡 Noted, not blocking: Session id: cron:clickhouse-review-slot-9:20260727-023400 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20260727-015600 |
|
cc @maxknv - could you review this? The test's cleanup prologue drops |
|
Workflow [PR], commit [36d9e7b] Summary: ✅ AI ReviewSummaryThis PR fixes the typoed cleanup Final Verdict✅ No blocker or major findings. |
alexey-milovidov
left a comment
There was a problem hiding this comment.
That was funny 😆 Thanks for fixing!
| DROP TABLE IF EXISTS t_left_004104; | ||
| DROP TABLE IF EXISTS t_right_004104; | ||
| DROP TABLE IF EXISTS t_subq_004104; | ||
| DROP TABLE IF EXISTS t_left_04104 SETTINGS ignore_drop_queries_probability = 0; |
There was a problem hiding this comment.
@clickgapai, adding the setting ignore_drop_queries_probability was not needed here. Ordinary stateless tests don't use this setting. Stress tests uses it, but it does not check test results - the goal of Stress test is to introduce more stress to check invariants in the code.
Send a PR removing unnecessary SETTINGS ignore_drop_queries_probability = 0
There was a problem hiding this comment.
@alexey-milovidov I looked into #112005 but didn't land on a concrete change to make — the requested work looks like it may already be in the PR, or I couldn't pin down exactly what's still needed. If you have a specific case in mind (a query, a file, or the exact scenario to cover), point me to it and I'll follow up.
There was a problem hiding this comment.
You are right; the pins should not have gone in. My justification in that PR measured the wrong thing: the return code: 57 I cited came from a Stress run, and Stress does not compare output against the reference, so making the cleanup prologue deterministic there bought nothing. The setting defaults to 0 (src/Core/Settings.cpp) and the only injectors in CI are ci/jobs/scripts/stress/stress.py:222 and --fake-drop in the upgrade check, so no results-checking job ever sees it.
rschu1ze's #113117 already removes every carrier. I grepped master for statement-level SETTINGS ignore_drop_queries_probability = 0: the 6 files it touches are the complete set, and all 6 are pin-free at its head. What is left on master afterwards is legitimate (03013 is the setting's own test, 03920 sets it to 1.0 on purpose, 03359 carries it inside a fuzzer settings dump, 03999 is a baseline). So there is nothing left for me to send for master.
The remaining work is mine: 16 of my open PRs would re-add the pin to 19 test files once #113117 merges. I am removing it from all of them.
There was a problem hiding this comment.
Correcting my note above: "I am removing it from all of them" was over-broad, and the reasoning I gave for it was too strong (Stress test does report per-test failures, so a drop that is ignored there is not invisible).
14 of the 16 are discharged, by strip, merge or close. The other two, plus three carriers I found later, keep the clause: five files, 61 clauses. 50 of those are in one file with the same shape as 04652_compound_key_monotonicity.sql, and this PR already settled that case in the other direction: bc9aeba35476bf8 removed its 80 clauses, fbeb49d77b1a6ed put all 80 back, and the reverted state is the one that merged. In the other four the clause is load-bearing for a reason specific to the test, which I checked one by one.
Requested by alexey-milovidov on ClickHouse#112005: "Send a PR removing unnecessary SETTINGS ignore_drop_queries_probability = 0". The 10 pins were on the test's DROP ... IF EXISTS prologue, where pinning the setting buys nothing. Its default is 0, and only two jobs inject a nonzero value: the Stress test (ci/jobs/scripts/stress/stress.py:222, =0.2) and the Upgrade check via clickhouse-client --fake-drop (programs/client/Client.cpp:988-989, =1). Neither of those jobs compares per-test results. tests/docker_scripts/stress_runner.sh:298-300 writes exactly one result row, built from the wrapper's own exit code, and the per-clickhouse-test exit code is discarded: stress.py:395-404 collects retcodes only to count how many processes have finished, then returns the pipe list, and the caller ignores it. So an ignored DROP in a stateless test cannot turn into a failed check in the only jobs where an ignored DROP can occur. The pinning was also internally inconsistent: the same test's epilogue drops, where the tables always exist, were never pinned. Measured on this change: with the pins removed the test passes and its output is byte-identical to the reference, at the default probability, at the 0.2 the stress runner injects (50 randomized runs), and at 1. Leftover-table counts after the run are identical before and after the change, so the pins were not preventing anything. rschu1ze's ClickHouse#113117 removes the setting from the other six stateless tests that carry it, so master reaches zero once both land. There is no file overlap. Co-Authored-By: Claude Fable 5 <[email protected]>
…4649 @alexey-milovidov asked for the removal of unnecessary `SETTINGS ignore_drop_queries_probability = 0` clauses in ClickHouse#112005 (comment). This drops the one pin this branch adds, together with the two comment lines that existed only to justify it. The setting defaults to 0, and `tests/clickhouse-test` never injects it: the only injectors are `ci/jobs/scripts/stress/stress.py:222` (0.2, Stress) and `clickhouse-client --fake-drop` (1, Upgrade check, programs/client/Client.cpp:989). Neither of those jobs compares per-test results. `stress.py` collects each `clickhouse-test` return code into `retcodes` only to count finished processes and then returns the process list, its caller does not assign that value, and nothing raises or exits on a test failure; `tests/docker_scripts/stress_runner.sh:299` writes a single result row built from the wrapper's own exit code, and `upgrade_runner.sh:135` uses the identical pattern. So the pinned DROP cannot turn red in a job whose results are checked. The pin was not inert, which is why the comment went with it: a cache dictionary does not store data on disk, so under an injected probability the ignore branch rewrites the DROP into a TRUNCATE and `DROP DICTIONARY` then fails with `Code: 62, Cannot TRUNCATE dictionary`. Measured on a master debug build: with the setting forced to 1 the unpinned drop returns 62 and the pinned one returns 0. The drop is the last statement of the test, the test greps only its own query output, and there is no `{ echo }` header or reference line covering it, so the removal cannot change the compared output.
…m the two StorageJoin tests Requested on ClickHouse#112005: the pins are unnecessary, so they should not be added. They were added to keep the cleanup DROPs deterministic under the Stress job, which injects `ignore_drop_queries_probability = 0.2`. That buys nothing. The default is 0 (`src/Core/Settings.cpp`) and the only injectors are `ci/jobs/scripts/stress/stress.py` (0.2) and the upgrade check's `--fake-drop` client (`programs/client/Client.cpp`); `tests/clickhouse-test` never injects it. Neither injecting job compares per-test results: `tests/docker_scripts/stress_runner.sh` writes a single row built from the wrapper's own exit code, and `stress.py` collects per-test return codes only to count finished processes before returning, so a nonzero `clickhouse-test` exit is discarded. `upgrade_runner.sh` uses the same wrapper pattern. Both tests run under `-- { echo }`, so the statement text is the expected output and the `.reference` files carry the same clauses; all four files are edited in lockstep. The `DROP` statements themselves are unchanged (94 and 8), and the comment that existed only to justify the pin is removed with it. The surrounding shared-database rationale is kept: it explains why the tests drop first at all, which is still true.
@alexey-milovidov asked for these pins to be dropped (ClickHouse#112005 (comment)). They cannot affect this test's result. The setting's default is 0 and the only injectors are the Stress runner (ci/jobs/scripts/stress/stress.py:222, 0.2) and the upgrade check's --fake-drop client (programs/client/Client.cpp:989); tests/clickhouse-test never injects it. Neither job compares per-test results: tests/docker_scripts/stress_runner.sh:298-300 writes one row from the wrapper's own exit code, and stress.py collects per-test return codes only to count finished processes, so a nonzero clickhouse-test exit is discarded. Measured with the pins removed: 98/98 reference lines byte-identical, and the database is left with 0 tables afterwards (control: truncating the run before the epilogue leaves 13), so the trailing DROPs still execute.
ClickHouse#110885 landed the same buildSelectOrUnionExpression nested-union alias forwarding this branch carried, so the conflicting hunk is resolved to master's side and QueryTreeBuilder.cpp is left byte-identical to it. The remaining fix is the two toAST emission sites, which master does not have: the issue still reproduces on master at a96787f. Also drop the ignore_drop_queries_probability = 0 pins from the test, as requested on ClickHouse#112005.
Four changes, all from re-reviewing the merged tree. Trim the commentary around keyToSetConversionMayCollapse to the invariant each site needs, per the standing request that motivation and context live in the commit message rather than in the code. Correct the helper's header: it had claimed an unclassified many-to-one conversion is only ever treated as approximate, but when canBeSafelyCast(set -> key) holds, tryPrepareSetColumnsForIndex takes the early exit that casts the set values directly and returns before consulting the predicate, so the atom stays exact there. The scope limit itself is unchanged and pre-existing. Add Case E2 to 04545. Case E's carrier was a String-to-String conversion, which is equality-preserving and so never sets set_is_approximate, leaving tryPrepareSetIndexForHas's own relaxation arm unasserted: deleting `|| set_is_approximate` from that caller kept the test green. E2 carries a UInt8 key against a Nullable(Int64) element, whose conversion is not equality-preserving. A text pair cannot be used because has requires a supertype for the key and the element. Rows are correct either way, so the load-bearing assertion is Parts: 3/3; the mutant prunes to 2/3 and fails on that line. Its table is dropped in the epilogue with the other thirty. Remove ignore_drop_queries_probability = 0 from the thirty cleanup statements, as asked on ClickHouse#112005. The setting defaults to 0 and only the stress runner and the upgrade check's --fake-drop client inject it; neither compares per-test results, and clickhouse-test's leftover-tables check is gated on `case_file >= "02800"` where case_file is an absolute path, so it never fires. The DROP statements are unchanged.
Requested at ClickHouse#112005 (comment), and ClickHouse#113117 has since removed every carrier on master. This branch still added the setting to eight `DROP` statements, so it would bring back a convention master no longer uses. The pins only ever changed anything under the stress runner, which injects `ignore_drop_queries_probability=0.2` as a client option (`ci/jobs/scripts/stress/stress.py`), and the upgrade check, which sets it to 1 (`programs/client/Client.cpp`); neither job compares per-test output. Measured at the default 0, which is what every results-checking job uses: with and without the pins the eight statements exit 0, produce byte-identical output and leave no table behind. Forcing the setting to 1 is the only way to tell the two apart. The unpinned run then keeps all four tables (`Memory` truncated, `Set` and `MergeTree` skipped) and a second run in the same database fails with `TABLE_ALREADY_EXISTS`. That is the behaviour the removal accepts, and it is what master's own de-pinned tests now do. The comment that justified the pins goes with them. The note about the `exists` consumer of the same resolution site stays, because it explains why that sibling cannot carry the bug and that is still true. Co-Authored-By: Claude Opus 5 <[email protected]>
Every `DROP TABLE IF EXISTS` in `04747_unwrap_monotonicity_dedup.sql` carried `SETTINGS ignore_drop_queries_probability = 0`. The setting defaults to 0 and only two jobs ever set it - the stress test (0.2) and the upgrade check (1, via `--fake-drop`) - and neither compares a stateless test's per-test output, so the clause cannot affect any job that checks results. @ alexey-milovidov asked for these pins to be removed (ClickHouse#112005), and ClickHouse#113117 has since deleted every one of them from master. Keeping them on this branch would re-add a setting a maintainer has just removed. The removal is textually exact: the file is byte-identical to its previous content with only the trailing clause dropped from the 20 `DROP` lines, and the `.reference` is untouched because this test does not use `-- { echo }`.
…ck test Both pinned statements are `DROP DATABASE`, and the injection never reaches one: the branch in `InterpreterDropQuery::executeToTableImpl` requires `!is_drop_or_detach_database`, which holds whenever the original query names no table, and that also covers the table drops a database drop performs internally. Measured on master with `clickhouse local`, five arms: `DROP TABLE` of a `MergeTree` at probability 1 leaves the table behind, both through a statement-level `SETTINGS` clause and through a session-level `SET`, while `DROP DATABASE` at probability 1 removes the database and its tables, with the pin and without it. So the clause changed nothing here. Requested by alexey-milovidov in ClickHouse#112005.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
04104_any_join_semi_anti_not_ready_set.sqldropst_left_004104,t_right_004104,t_subq_004104(three zeros) but creates and usest_left_04104,t_right_04104,t_subq_04104(two zeros). Every prologue nameis a misspelled twin of a created name, so the prologue matches nothing and the
test has no leftover-state cleanup.
This is latent on the default path, where each test gets a fresh
test_<random>database. It is live in the stress runner's shared-database mode:ci/jobs/scripts/stress/stress.py:158-161passes--database=test_{i}to everyodd thread ("Run some threads with one database for all tests"), and
tests/clickhouse-test:3755skips per-test cleanup when--databaseis set, sotables survive between tests. Leftovers then arise within a single job in three
ways: a mid-test abort; a same-database retry, since
clickhouse-test:4582re-runs the test with the same
args.database(:2085-2086) andMESSAGES_TO_RETRYincludes(total) memory limit exceeded, one of this test'sown attested failure reasons; and the drop injection described below, which skips
the epilogue DROPs on an otherwise successful run. The next run then fails
TABLE_ALREADY_EXISTSatCREATE TABLE t_left_04104, because the prologuecleared nothing and the CREATEs have no
IF NOT EXISTS.Correcting the three identifiers alone is not enough in that same mode.
stress.py:222also passesignore_drop_queries_probability=0.2to everynon-upgrade thread, and
InterpreterDropQuery.cpp:220-228reports successwithout dropping when the roll fires and
storesDataOnDiskis true, which isalways the case for
MergeTree. Each prologueDROPis therefore skipped withp=0.2, so all three would clear only 0.8^3 = 0.512 of the time. Pinning
ignore_drop_queries_probability = 0on those three statements makes the cleanupdeterministic. The pin is per statement rather than a file-level
SET, so theepilogue DROPs keep exercising the injection.
I did not add
IF NOT EXISTSto the CREATEs: that would run the test against astale table instead of clearing it.
Verified with the real harness in shared-database mode, with the injection forced
to 1 so the pin is the only thing that can clear the tables. With a prior run's
tables left behind the test passes; it fails
return code: 57with the pinremoved, and also with the rename reverted, so neither line is redundant. At the
probability CI actually uses, 30 consecutive runs against the same database
without reseeding pass with both lines, against 27 passes and 3 failures with the
pin removed. The default path is unaffected (50/50 randomized runs pass) and the
.referenceis unchanged.I am not claiming this fixes the CI failures previously observed on this test.
Those decompose into unrelated external causes (other PRs' own regressions, a
runner filesystem error, host OOM kills, and server deaths caused by other
tests' queries); none involves this prologue, and this change makes no behavioural
difference on the default per-test-database path where they occurred.
Version info
26.8.1.228(included in26.8and later)