Repository navigation
Stateless tests: Remove useless ignore_drop_queries_probability = 0 - #113117
Conversation
The pins were only there to defeat the stress runner's injection of `ignore_drop_queries_probability = 0.2`. Drop them, together with the comments that existed only to explain them. Tests that legitimately reference the setting are untouched: `03013_ignore_drop_queries_probability.sql` (the test of the feature), `03920_drop_db_hang_with_trx.sh` (passes `1.0` deliberately), `03359_ub_merging_aggregated_transform.sql` (fuzzer-derived setting list), `04236_merge_with_alias_missing_target_104740.sql` (prose comment only). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Workflow [PR], commit [fbeb49d] Summary: ✅ AI ReviewSummaryThis PR removes Findings
Final Verdict
|
ignore_drop_queries_probability = 0ignore_drop_queries_probability = 0
ignore_drop_queries_probability = 0ignore_drop_queries_probability = 0
| # DROP TABLE SYNC triggers dropReplica -> removeTableNodesFromZooKeeper, which pauses on the | ||
| # failpoint before calling tryGetChildren. | ||
| ${CLICKHOUSE_CLIENT} -q "DROP TABLE k2_race SYNC SETTINGS ignore_drop_queries_probability = 0" & | ||
| ${CLICKHOUSE_CLIENT} -q "DROP TABLE k2_race SYNC" & |
There was a problem hiding this comment.
This DROP TABLE is the operation under test. Without the query-level pin, --stress-tests injects ignore_drop_queries_probability=0.2; StorageKafka2 uses the default non-disk path, so when that fires InterpreterDropQuery rewrites the statement to TRUNCATE, dropReplica / removeTableNodesFromZooKeeper never run, and wait_for_pause for kafka2_remove_zk_before_get_children times out. The same problem exists for the scenario B DROP below, and in --upgrade-check it becomes deterministic because --fake-drop sets the probability to 1.
| ") | ||
| for v in $VIEWS; do | ||
| sql+="DROP VIEW IF EXISTS $v SETTINGS ignore_drop_queries_probability = 0; " | ||
| sql+="DROP VIEW IF EXISTS $v; " |
There was a problem hiding this comment.
drop_views is called again after all of the views are created, so these are real teardown statements, not stale pre-cleanup. Once the per-statement pin is removed, the stress runner's injected ignore_drop_queries_probability=0.2 can rewrite an existing DROP VIEW into TRUNCATE; StorageView reports supportsTruncate false, so the view is not removed and the post-test empty-database check fails. This helper still needs a query-level override for the DROP VIEW batch.
…rop-queries-probability-pins
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]>
The test turns the DROP fault injection on, so its own setup and teardown DROPs were being eaten by it and it pinned the setting to 0 on each of them. DROP DATABASE is structurally exempt from the injection (the flag is computed once from the original statement and carried into every table the recursion visits, InterpreterDropQuery.cpp:214-220,676), so putting every object in a database the test creates and dropping that database at the end needs no pin at all. @rschu1ze is removing that pinning idiom from stateless tests in ClickHouse#113117, so this avoids adding seven fresh occurrences of it. Assertions and the reference file are unchanged: the system.tables predicates follow currentDatabase(), which USE moves to the created database. Co-Authored-By: Claude Fable 5 <[email protected]>
…rop-queries-probability-pins
|
|
||
| -- ignore_drop_queries_probability = 0: the stress runner sets it to 0.2, which makes a DROP a no-op. | ||
| DROP TABLE test3 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE test3; |
There was a problem hiding this comment.
This DROP TABLE is still load-bearing. test3 is a ReplicatedMergeTree, so when the stress profile injects ignore_drop_queries_probability the statement returns success without removing the table. Because 03224... is above the harness's 02800 cleanup threshold, clickhouse-test then hits its post-test SHOW TABLES FROM <db> check with test3 still present. The setup-side DROP DATABASE calls are fine; this trailing teardown still needs SETTINGS ignore_drop_queries_probability = 0.
|
|
||
| # Drop the Atomic table, should still fail because Ordinary table uses the collection | ||
| $CLICKHOUSE_CLIENT -q "DROP TABLE test_nc_dep_atomic SETTINGS ignore_drop_queries_probability = 0, ast_fuzzer_runs = 0;" | ||
| $CLICKHOUSE_CLIENT -q "DROP TABLE test_nc_dep_atomic SETTINGS ast_fuzzer_runs = 0;" |
There was a problem hiding this comment.
Because this is a fresh $CLICKHOUSE_CLIENT -q invocation, the removed session-level override from the setup block does not protect it. Here the table is ENGINE = URL, so when ignore_drop_queries_probability fires the server rewrites DROP TABLE to TRUNCATE, and StorageURL::truncate throws NOT_IMPLEMENTED; the DROP NAMED COLLECTION ... NAMED_COLLECTION_IS_USED assertion below never runs. The same applies to the cleanup block and the Ordinary-table drop later in the file, so these URL drops still need a per-statement ignore_drop_queries_probability = 0 pin.
| DROP TABLE m_cv_i64n SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_i64p SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE m_cv_i64p SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_neg; |
There was a problem hiding this comment.
This tail block is the only teardown for this file's fixtures. Under the stress profile, the MergeTree drops can become successful no-ops and the Memory drops become TRUNCATE, so the tables remain in the per-test database and clickhouse-test's post-test SHOW TABLES FROM <db> check fails. The setup-side DROP IF EXISTS removals are fine, but these final drops still need SETTINGS ignore_drop_queries_probability = 0.
| DROP TABLE m_cv_u8 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_u8g SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE m_cv_u8g SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_span; |
There was a problem hiding this comment.
This tail block is the only teardown for this file's fixtures. Under the stress profile, the MergeTree drops can become successful no-ops and the Memory drops become TRUNCATE, so the tables remain in the per-test database and clickhouse-test's post-test SHOW TABLES FROM <db> check fails. The setup-side DROP IF EXISTS removals are fine, but these final drops still need SETTINGS ignore_drop_queries_probability = 0.
| DROP TABLE m_cv_lc SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_nul SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE m_cv_nul SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_d32p; |
There was a problem hiding this comment.
This tail block is the only teardown for this file's fixtures. Under the stress profile, the MergeTree drops can become successful no-ops and the Memory drops become TRUNCATE, so the tables remain in the per-test database and clickhouse-test's post-test SHOW TABLES FROM <db> check fails. The setup-side DROP IF EXISTS removals are fine, but these final drops still need SETTINGS ignore_drop_queries_probability = 0.
| DROP TABLE m_cv_ipwrap4 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_ipwrap6 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE m_cv_ipwrap6 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE t_cv_neg; |
There was a problem hiding this comment.
This tail block is the only teardown for this file's fixtures. Under the stress profile, the MergeTree drops can become successful no-ops and the Memory drops become TRUNCATE, so the tables remain in the per-test database and clickhouse-test's post-test SHOW TABLES FROM <db> check fails. The setup-side DROP IF EXISTS removals are fine, but these final drops still need SETTINGS ignore_drop_queries_probability = 0.
| ${CLICKHOUSE_CLIENT} --query_id "$drop_qid" --query " | ||
| DROP TABLE IF EXISTS ${CLICKHOUSE_DATABASE_1}.t SYNC | ||
| SETTINGS ignore_drop_queries_probability = 0" < /dev/null > /dev/null 2>&1 & | ||
| DROP TABLE IF EXISTS ${CLICKHOUSE_DATABASE_1}.t SYNC" < /dev/null > /dev/null 2>&1 & |
There was a problem hiding this comment.
This is the operation under test: if ignore_drop_queries_probability fires on this ReplicatedMergeTree, the statement returns success without dropping anything, so it never waits on the exclusive table lock. The script then either prints drop=ignored instead of the reference's drop=ok, or trips the drop did not wait for the table lock. setup_table and the Alias-table pre-drop above still need the same pin for the same reason.
| SET ast_fuzzer_runs = 0; | ||
| SET ast_fuzzer_any_query = 0; | ||
|
|
||
| -- Every assertion below reads the state a preceding statement left in Keeper, so a DROP has to drop. |
There was a problem hiding this comment.
This session SET is still doing real work here. .sql tests run under one clickhouse-client --multiquery, so this line is what protects the later DROP TABLE ... SYNC statements in the same file. KeeperMap is a non-disk storage, so when ignore_drop_queries_probability fires those drops are rewritten to TRUNCATE; StorageKeeperMap::truncate clears /data but leaves the metadata/root znodes. That breaks the final DROP TABLE ..._unparsable + SELECT count() check at the bottom and can also leave tables behind for the post-test cleanup check.
| SET ast_fuzzer_runs = 0; | ||
| DROP TABLE test_nc_dep_table_renamed SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE test_nc_dep_table2 SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE test_nc_dep_table_renamed; |
There was a problem hiding this comment.
This cleanup block still needs an ignore_drop_queries_probability = 0 override. Both test_nc_dep_table_renamed and test_nc_dep_table2 are ENGINE = URL, so in --stress-tests the injected ignore_drop_queries_probability=0.2 can rewrite either DROP TABLE to TRUNCATE TABLE; StorageURL::truncate deliberately throws NOT_IMPLEMENTED, so the test can abort here before it even reaches the mixed-database half. A single session SET ignore_drop_queries_probability = 0 in this -m -q batch, or statement-level SETTINGS on these two DROP TABLEs, would keep the cleanup deterministic.
| $CLICKHOUSE_CLIENT -m -q " | ||
| SET ast_fuzzer_runs = 0; | ||
| DROP TABLE ${ORDINARY_DB}.test_nc_dep_ordinary_renamed SETTINGS ignore_drop_queries_probability = 0; | ||
| DROP TABLE ${ORDINARY_DB}.test_nc_dep_ordinary_renamed; |
There was a problem hiding this comment.
This last cleanup block has the same problem as line 124. It is a fresh $CLICKHOUSE_CLIENT -m -q invocation, so the removed setup-side SET ignore_drop_queries_probability = 0 does not apply here, and ${ORDINARY_DB}.test_nc_dep_ordinary_renamed is also ENGINE = URL. Under --stress-tests this DROP TABLE can be rewritten to unsupported TRUNCATE and fail at the very end of the test. This block still needs either its own session SET ignore_drop_queries_probability = 0 or a statement-level pin on the DROP TABLE.
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 }`.
…cy-until-metadata-gone The only conflict is in `04318_remote_storage_engine_access.sh`, and it is resolved by taking master's side whole. This branch pinned that test's `DROP TABLE` with `SETTINGS ignore_drop_queries_probability = 0, ast_fuzzer_runs = 0` and then asserted the table was gone before the collection was dropped. Since then `e71a2e2ff65d7` landed the same protection on master as `SET ast_fuzzer_any_query = 0`, which covers the fuzzed `DETACH` that was the only channel able to strand the collection reference: a `DROP` skipped or rewritten by `ignore_drop_queries_probability` returns before `removeDependencies`, so the table keeps its edge and the following `DROP NAMED COLLECTION` is refused rather than stranding anything. Keeping this branch's version would therefore re-add an `ignore_drop_queries_probability` pin that master no longer uses (ClickHouse#113117 removed the carriers) for a channel master already covers, so the whole hunk goes, and the two `.reference` lines that only existed for its assertion go with it. `04318` is now byte-identical to master and drops out of this pull request. The source fix and `05045_drop_table_keeps_dependencies_on_error` are unchanged; the failpoint entry re-applied on top of master's current `FailPoint.cpp` list without displacing any of the entries added upstream since this branch was cut. Co-Authored-By: Claude Opus 5 <[email protected]>
Removing the noise before AI will metastasize it all over the place.
Changelog category (leave one):
Workflow [PR]
Sync PR [sync-upstream/pr/113117]
Version info
26.9.1.499(included in26.9and later)