Skip to content

Stateless tests: Remove useless ignore_drop_queries_probability = 0 - #113117

Merged
alexey-milovidov merged 5 commits into
masterfrom
remove-ignore-drop-queries-probability-pins
Sep 1, 2026
Merged

alexey-milovidov merged 5 commits into
masterfrom
remove-ignore-drop-queries-probability-pins

Conversation

@rschu1ze

@rschu1ze rschu1ze commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Removing the noise before AI will metastasize it all over the place.

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Version info

  • Merged into: 26.9.1.499 (included in 26.9 and later)

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]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fbeb49d]

Summary: ✅


AI Review

Summary

This PR removes ignore_drop_queries_probability = 0 pins from a set of stateless tests. Some of those pins really are redundant, but several touched tests still rely on them under the current --stress-tests profile: some DROP statements are the operation under test, some hit storages where a fault-injected DROP becomes unsupported TRUNCATE, and the 04651... group still shares fixture names inside the shared --database=test_<i> workers. Verdict: not ready as-is.

Findings

⚠️ Majors

  • [tests/queries/0_stateless/03224_invalid_alter.sql:58] DROP TABLE test3 is still load-bearing in the shared --database=test_<i> stress workers. A ReplicatedMergeTree drop ignored by ignore_drop_queries_probability returns success without removing the table, and test3 is a generic name reused by other stateless tests, so a later test can then hit TABLE_ALREADY_EXISTS after its own unpinned DROP TABLE IF EXISTS test3 is ignored too. Restore SETTINGS ignore_drop_queries_probability = 0 on this teardown.
  • [tests/queries/0_stateless/03822_named_collection_drop_dependency_check.sh:94,124,130] These DROP TABLE statements still need the pin. All three tables are ENGINE = URL, so in --stress-tests the injected ignore_drop_queries_probability=0.2 can rewrite the drop to TRUNCATE TABLE, and StorageURL::truncate deliberately throws NOT_IMPLEMENTED. That makes the first cleanup block flaky, breaks the test_nc_dep_atomic dependency step, and can also fail the final cleanup block. Put ignore_drop_queries_probability = 0 back on these drops, or set it once per affected -m -q batch.
  • [tests/queries/0_stateless/04648_kafka2_race_creation_removal.sh:133,154] These two DROP TABLE k2_race SYNC calls are the race being tested. Under the stress profile, ignore_drop_queries_probability can rewrite a Kafka drop into TRUNCATE, so removeTableNodesFromZooKeeper is never exercised and the scenario turns into either NOT_IMPLEMENTED or a false pass. Restore the query-level override on both drops.
  • [tests/queries/0_stateless/04650_substring_alias_normalization_metadata_roundtrip.sh:28] The second drop_views call runs after all of the views exist. Once the stress setting rewrites one of those DROP VIEW statements to TRUNCATE, StorageView throws NOT_IMPLEMENTED and the cleanup call itself becomes probabilistically failing. The per-statement pin inside drop_views is still needed.
  • [tests/queries/0_stateless/04651_intdiv_const_variable_monotonicity.sql:120, tests/queries/0_stateless/04651_intdiv_const_variable_monotonicity_controls.sql:126, tests/queries/0_stateless/04651_intdiv_const_variable_monotonicity_decimal_float.sql:133, tests/queries/0_stateless/04651_intdiv_const_variable_monotonicity_ip.sql:119] These four tests share fixture names such as t_cv_neg, t_cv_span, and t_cv_f64p inside the shared --database=test_<i> stress workers. If one file’s trailing unpinned DROP TABLE leaves a fixture behind, the sibling file’s own unpinned DROP TABLE IF EXISTS setup can be ignored too, so the later CREATE TABLE either reuses stale state or fails with TABLE_ALREADY_EXISTS. The cleanup overrides still need to stay, or each file needs a session-wide SET ignore_drop_queries_probability = 0.
  • [tests/queries/0_stateless/04905_lwu_drop_race_table_lock.sh:99] This DROP TABLE IF EXISTS ... SYNC is still the behavior under test. When ignore_drop_queries_probability fires on the ReplicatedMergeTree table, the statement returns success without taking the exclusive table lock, so the script either prints drop=ignored or misses the race window entirely. Keep the query-level pin here.
  • [tests/queries/0_stateless/05024_keeper_map_parenthesized_metadata.sql:6] The removed session SET is still doing real work. In this .sql file it applies to the whole --multiquery run, and later DROP TABLE 05024_keeper_map_parenthesized_metadata_unparsable SYNC must be a real drop so the final system.zookeeper check sees that the table path is gone. If the stress profile rewrites that drop to TRUNCATE, the table stays attached and the final assertion is wrong. Restore SET ignore_drop_queries_probability = 0.
Final Verdict

⚠️ Request changes. Several removed ignore_drop_queries_probability = 0 pins are still load-bearing under the current stress profile, so the PR would make some tests flaky and make others stop testing the path they claim to cover.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 3, 2026
@rschu1ze rschu1ze changed the title Stateless tests: Don't do ignore_drop_queries_probability = 0 Stateless tests: Remove uselessignore_drop_queries_probability = 0 Aug 3, 2026
@rschu1ze
rschu1ze marked this pull request as ready for review August 3, 2026 14:41
@rschu1ze rschu1ze changed the title Stateless tests: Remove uselessignore_drop_queries_probability = 0 Stateless tests: Remove useless ignore_drop_queries_probability = 0 Aug 3, 2026
# 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" &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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; "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

pull Bot pushed a commit to infdahai/ClickHouse that referenced this pull request Aug 5, 2026
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]>
pull Bot pushed a commit to sonvt1710/ClickHouse that referenced this pull request Aug 13, 2026
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]>

-- 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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 &

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@alexey-milovidov alexey-milovidov self-assigned this Aug 31, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Sep 1, 2026
Merged via the queue into master with commit 744240e Sep 1, 2026
174 checks passed
@alexey-milovidov
alexey-milovidov deleted the remove-ignore-drop-queries-probability-pins branch September 1, 2026 20:15
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 1, 2026
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 4, 2026
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]>
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 4, 2026
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 }`.
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Sep 14, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog 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