Repository navigation
Keep DDL out of the AST fuzzer in 05234_constraint_scalar_subquery_over_distributed - #121952
Conversation
…er_distributed The stress job installs its own fuzzer profile before the test phase (tests/docker_scripts/stress_tests.lib:210-211 sets ast_fuzzer_runs and ast_fuzzer_any_query), so the server-side AST fuzzer replays every successful statement, DDL included: the eligibility gate at src/Interpreters/executeQuery.cpp:3469 is `if (!any_query && !isReadOnlyQuery(ast)) return;`. That leaves a persisted copy of this test's scalar-subquery CHECK constraint behind by either of two routes. A fuzzed CREATE is renamed (src/Common/QueryFuzzer.cpp:1395), so the clone is not the name the test's own DROP TABLE mentions; and a fuzzed DROP can be replayed as UNDROP TABLE (src/Common/QueryFuzzer.cpp:7087), which resurrects the original. Nothing drops either one: executeASTFuzzerQueries has no cleanup, the only caller of QueryFuzzer::getDropQueriesForFuzzedTables is the client-side fuzzer in programs/client/FuzzLoop.cpp:256, and the stress workers share a database that is never dropped (ci/jobs/scripts/stress/stress.py:408 pins --database, and tests/clickhouse-test:4343 then skips the per-test DROP DATABASE). The leftover survives to the post-run restart at tests/docker_scripts/stress_runner.sh:356. An asynchronous metadata load has no query context (src/Databases/TablesLoader.cpp:80 copies the global context and never calls makeQueryContext), so re-analysing the constraint throws THERE_IS_NO_QUERY at src/Analyzer/Resolve/QueryAnalyzer.cpp:5509. In the half of stress runs that stress_runner.sh:307-310 randomizes to async_load_databases = false, that load failure is fatal rather than deferred (programs/server/Server.cpp:3508-3510), so the server never starts and the whole job's signal is lost on an unrelated PR. ast_fuzzer_any_query = 0 is the narrowest pin that closes both routes, since the gate above excludes every non-read-only statement while the test's SELECTs keep being fuzzed. Six tests in the corpus already pin this setting for the same class of leftover. The loader-side gap itself is pre-existing and tracked separately. Measured with the stress fuzzer profile installed and async_load_databases=0: before the change the restart refused to start in 6 of 6 draws (exit 210, zero "Ready for connections"); after it, 6 of 6 came up with no leftover tables at all, and the test passed 6 of 6 and 50 of 50 randomized runs.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings), plus my own cold
What I verified independently before reading the implementation's evidence:
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20260924-100700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-5:20260924-092000 |
|
Workflow [PR], commit [05c97cd] Summary: ✅ AI ReviewSummaryThis PR makes Final Verdict
|
715315f
|
This pin did what it was measured to do, but it was not sufficient: the AST fuzzer is not the only thing that leaves the table behind. Master went red again at 17:13Z on The cause of that one, from the run's own server log: the stress runner sets I opened #122101, which removes the class rather than one carrier: the test's tables now live in a |
Related: #121418
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Test-only change, no changelog entry required.
Description
Stress test (arm_asan_ubsan)failed withCannot start clickhouse-server, the server dying on all11 start attempts:
Failing jobs, the second on master:
https://github.com/ClickHouse/ClickHouse/actions/runs/35956719220/job/107532305130
https://github.com/ClickHouse/ClickHouse/actions/runs/35975552176/job/107563492694
t_scalar_constraint_usercomes from the test I added in #121418. The stress profile setsast_fuzzer_any_query(tests/docker_scripts/stress_tests.lib:211), so the server-side AST fuzzerreplays DDL too, and it leaves a persisted copy of that table's scalar-subquery
CHECKconstraintbehind in two ways: a renamed
__fuzz_Nclone (QueryFuzzer.cpp:1395), which the test's ownDROP TABLEdoes not name, or a replay of thatDROPasUNDROP TABLE(QueryFuzzer.cpp:7087),which resurrects the original. The stress workers share a database that is never dropped, so the
leftover survives to the post-run restart, where the asynchronous metadata load has no query context
and cannot re-analyse the constraint. When
stress_runner.sh:307randomizesasync_load_databases = false, that load failure is fatal and the server never comes up, so thewhole job's signal is lost on an unrelated PR.
This pins
ast_fuzzer_any_query = 0for the test, which is the narrowest available pin: the gate atexecuteQuery.cpp:3469excludes every non-read-only statement, so noCREATE,DROP,DETACHorATTACHof this file is replayed, while itsSELECTs are still fuzzed. Six existing tests pin thesame setting for the same class of leftover.
Validation: with the stress fuzzer profile installed and
async_load_databases=0, the restartrefused to start in 6 of 6 runs before the change and came up in 6 of 6 after it, with no leftover
tables at all. 50/50 randomized runs pass.
The loader-side gap itself is pre-existing on master and is tracked by #96886 per @ alexey-milovidov's
ruling on #121418; it is not addressed here.
Workflow [PR]
Sync PR [sync-upstream/pr/121952]
Version info
26.10.1.607-master(included in26.10and later)