Repository navigation
Host the tables of 05234_constraint_scalar_subquery_over_distributed in a Memory database - #122101
Conversation
…in a Memory database Stress test (*_asan_ubsan) failed with "Cannot start clickhouse-server" three times in one day, twice on master, the last of them on a tree that already contained the previous fix for this test. That fix closed the AST-fuzzer route; this failure took a different one. The stress runner passes ignore_drop_queries_probability=0.2 as a client option (ci/jobs/scripts/stress/stress.py:528). Under that setting a DROP TABLE on a table that stores data on disk is a silent no-op that reports success to the client (src/Interpreters/InterpreterDropQuery.cpp:219-231, the early return at :226); the branch is entered only for a table drop, since is_drop_or_detach_database at :213 excludes DROP DATABASE. So this test's own DROP TABLE t_scalar_constraint_user can succeed without dropping anything, and that run's log shows exactly that, 17 ms apart: (query 17, line 26) DROP TABLE t_scalar_constraint_user; InterpreterDropQuery: Ignore DROP TABLE query for table ...t_scalar_constraint_user The surviving table then meets the post-run restart. An asynchronous metadata load has no query context (src/Databases/TablesLoader.cpp:80 copies the global context and never calls makeQueryContext), so re-analysing a CHECK constraint whose scalar subquery reads a table function reaches the unguarded getQueryContext() in QueryAnalyzer::resolveTableFunction (src/Analyzer/Resolve/QueryAnalyzer.cpp:5509) and throws THERE_IS_NO_QUERY. When stress_runner.sh randomizes async_load_databases = false, that load failure is fatal and the server never comes up, so the whole job's signal is lost on an unrelated PR. Four independent routes end in that same state: a renamed fuzzer clone, a fuzzed DROP replayed as UNDROP TABLE, the ignored DROP above, and a failed ATTACH, which keeps the metadata file while making the test's own DROP throw UNKNOWN_TABLE, as does an aborted file (tests/clickhouse-test:4015 runs .sql with --multiquery and no --ignore-error). The last two are reachable by no SET at all, so pinning routes one at a time cannot work. Hosting the tables in a Memory database removes the class instead. Such a database never writes table metadata (src/Databases/DatabaseMemory.cpp:36-58 only attaches in memory, there is no getMetadataPath override, and the startup loader does not ask it for any, since supportsLoadingInTopologicalOrder is the default false), so no leftover can be replayed at startup even when the teardown never runs at all. The trailing drops become one DROP DATABASE, which is the one drop that branch never ignores and which also skips same-database dependency checks, so the HAVE_DEPENDENT_OBJECTS failure the same mechanism caused in that run goes away too. The eight DROP TABLE IF EXISTS lines are gone because a freshly created database is always empty, and ast_fuzzer_any_query = 0 is kept as a second belt, as 03822_named_collection_drop_dependency_check.sh does. Measured with the stress fuzzer profile installed and async_load_databases=0. At ignore_drop_queries_probability=1.0, which makes the carrier fire on every draw: before the change the restart refused to start in 6 of 6 draws (exit 210, zero "Ready for connections", five leftover table metadata files); after it, 6 of 6 came up with no table metadata at all. At the runner's own 0.2: 1 of 8 restarts failed before and 0 of 8 after, and the test itself went from 3 of 8 failing to 8 of 8 passing. 50 of 50 randomized runs pass and the .reference is unchanged. The loader-side gap itself is pre-existing on master and tracked separately.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings, and it reproduced the
The two claims the fix rests on, checked at source before I read the implementation's evidence: a Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-10:20260924-202200 |
|
Workflow [PR], commit [cee0c8b] Summary: ✅ AI ReviewSummaryThis PR moves the fixture tables in Final Verdict✅ No actionable findings. |
d5d7738
…ne_bucket in a Memory database
Stress test (amd_msan) failed with "Cannot start clickhouse-server": the
restart could not load q_peer, "Existing table metadata in ZooKeeper
differs in buckets setting. Stored in ZooKeeper: 2, local: 1
(METADATA_MISMATCH)".
The test rewrites the Keeper metadata of q_peer to "buckets":2 to simulate
a migration by another server, then runs ALTER TABLE q_peer MODIFY SETTING
buckets = 2. In between, Keeper has 2 buckets and the table's .sql has 1,
which ATTACH refuses. The stress run's global time limit killed the client
right after the rewrite, stress.py detached (not dropped) the database,
and the restart with async_load_databases = false failed on the table.
Only q_peer has such a state: run up to every statement boundary of the
test, then detached and restarted, every other table loads. So only q_peer
moves into a Memory database, {CLICKHOUSE_DATABASE_1:Identifier}, whose
table metadata a restart never loads, as 05234 does (ClickHouse#122101). USE makes
currentDatabase() and the {database} macro of keeper_path name that
database, so the queries and the reference are unchanged; the other cases
keep running in the test database, including its Replicated variant.
DROP DATABASE is the cleanup because ignore_drop_queries_probability never
ignores it.
Related: ClickHouse#130798
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…isk in a Memory database The stress test stops every worker at its global time limit. Worker 0 runs the tests in the runner's default descending order, so the limit lands in the same band of newest tests on every run; on 26.8 that band includes 05496 (4 `Stress test` jobs in 4 days, with ClickHouse#130670 present). The test can then stop between a `CREATE TABLE` that names a disk of an already dropped table (`disk = '<name>'`, `storage_policy = '__<name>'`, a wrapper of `server_<db>`) and its `DROP`. `prepare_for_hung_check` detaches, not drops, the databases, the restart attaches them again, the table cannot be loaded (`Unknown storage policy __server_<db>`, `Unknown disk plain_<db>`, `The wrapped disk must have been announced earlier`) and the server does not start. An interruption cannot be pinned by a setting, so every table of the test now lives in a Memory database, which keeps no table metadata on disk: after the restart it is empty, wherever the test was stopped. That also covers a `DROP` lost to an injected memory fault, so the `memory_tracker_fault_probability=0` pin of the previous commit is removed again. Same shape as ClickHouse#122101 (05234) and ClickHouse#131581 (05620). `CREATE DATABASE ... ENGINE = Memory` stays on one line: the runner's `--replace-log-memory-with-mergetree` (stress worker 0) rewrites `ENGINE = Memory` to MergeTree except on a line with `CREATE DATABASE`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #121418
Related: #121952
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 (*_asan_ubsan)failed withCannot start clickhouse-server, the server dying on all 11start attempts:
Failing jobs (last two on master):
https://github.com/ClickHouse/ClickHouse/actions/runs/35956719220/job/107532305130
https://github.com/ClickHouse/ClickHouse/actions/runs/35975552176/job/107563492694
https://github.com/ClickHouse/ClickHouse/actions/runs/36030675501/job/107744083942
t_scalar_constraint_useris from the test I added in #121418. #121952 closed the AST-fuzzerroute; this failure took another. The stress runner passes
ignore_drop_queries_probability=0.2(
stress.py:528): aDROP TABLEon a disk-backed table then becomes a silent no-op that reportssuccess (
InterpreterDropQuery.cpp:219-227), so the table survived to the post-run restart:The asynchronous metadata load has no query context, so a
CHECKconstraint whose scalar subqueryreads a table function cannot be analysed; with
async_load_databases = falsethat is fatal. Twomore routes reach the same state and no
SETreaches either: a failedATTACHleaves the metadatafile while the test's own
DROPthen throwsUNKNOWN_TABLE, and an aborted file skips them.Pinning routes one at a time cannot work.
The test's tables now live in a
Memorydatabase, whose table metadata is never written, and thetrailing drops become one
DROP DATABASE, which that branch never ignores. Nothing can be replayedat startup even if the teardown never runs.
With the stress profile and
async_load_databases=0: 6 of 6 restarts refused before, 6 of 6 came upafter, 5 table metadata files before and 0 after. At the runner's own 0.2: 1 of 8 restarts failed
before and 0 of 8 after, and the test went from 3 of 8 failing to 8 of 8. 50 of 50 randomized
runs pass;
.referenceis unchanged.The loader-side gap is pre-existing and tracked by #96886, per @ alexey-milovidov's ruling on #121418.
Workflow [PR]
Sync PR [sync-upstream/pr/122101]
Version info
26.10.1.643-master(included in26.10and later)