Repository navigation
Split out and skip the statements that create a table from a SQL-created named collection on the replicated-database CI arm - #117234
Conversation
…ted named collection on the replicated-database CI arm `04511_remote_named_collection_complex_overrides`, `04327_s3queue_server_credentials`, `04320_url_engine_dispatch_partition_and_format` and `04626_s3_base_setting` fail the main pass on every run of the two `Stateless tests (amd_llvm_coverage, ..., DBReplicated, ...)` jobs with `Code: 159. ReplicatedDatabase DDL task .../log/query-00000000NN is not finished on 2 of 3 hosts (2 of them are currently executing the task, 0 are inactive).` `CREATE NAMED COLLECTION` is server-global, not database-scoped, so it is not a `Replicated` database DDL entry and is applied only on the host that receives it. A `CREATE TABLE` inside a `Replicated` database is a replicated DDL entry and is replayed verbatim on every replica, where the collection is absent, so it fails with `Code: 669 NAMED_COLLECTION_DOESNT_EXIST` (retriable false). It is retried `max_retries_before_automatic_recovery` (10) times at about 5 s, then drives the replica into lost-replica recovery, which replays the same unloadable metadata and fails identically: `DatabaseReplicatedWorker.cpp:122-134` retries `initializeReplication` every 5 s with no bound. The initiator, which does have the collection, creates the table locally and then waits out `distributed_ddl_task_timeout`. Raising `distributed_ddl_task_timeout` is not the fix: the entry can never complete at any speed. The queue is not stalled either, since every one of the more than 25,000 CIDB rows that carry this message, for these four tests over 21 days, reports `0 are inactive`. Nor is the coverage build part of the mechanism, since `Code: 669` is deterministic and speed-independent, so the change is not scoped to the coverage flavour. Almost every occurrence is then force-set to `OK`. The reproducibility rerun cannot reproduce the failure as `diag_command` (`ci/jobs/functional_tests.py:1395-1403`) is built, because it carries no `runner_options`, the only carrier of `--replicated-database`: `get_db_engine` (`tests/clickhouse-test:860-872`) then creates the rerun's test database without the `Replicated` engine, so the `CREATE TABLE` is host-local and succeeds. `tests/clickhouse-test:4754-4758` sees `fail_n < total_n`, labels the test `flaky`, and `ci/jobs/functional_tests.py:1433-1438` turns a `flaky` label into `Result.Status.OK` on coverage jobs, which is why only these two lanes hide it. The linked report shows the same mechanism from the other side: it comes from a branch that does forward those options, and there the rerun reproduced the failure on every attempt with randomization disabled, kept the `reproducible` label and left the job red. A job where more than ten tests fail also stays red, since the diagnostics step is then skipped entirely (`:1385-1392`) and no label is produced. The main pass fails every time; only the label varies. Each occurrence also wastes 120 s and leaves both replicas' DDL worker wedged until the test drops its database. `no-replicated-database` is this repository's existing declaration for such a test: 18 of the 35 stateless tests containing `CREATE NAMED COLLECTION` already carry it, among them `04512_remote_missing_named_collection.sh` (the sibling of `04511`) and `04318_remote_storage_engine_access.sh` (the same `Remote(<collection>)` shape); 8 of the 18 use this exact reason string. None of the four tests `DatabaseReplicated` itself. `04003_named_collection_drop_dependency_check_dict` and `04010_mongodb_dictionary_named_collection` also build an object from their own collection but are deliberately left untagged: a dictionary's `SOURCE` is resolved when the dictionary is loaded rather than when it is created (`dictionaries_lazy_load` defaults to 1, `src/Core/ServerSettings.cpp:1419`) and loading is local and on demand, so the replicated DDL succeeds. Both are `OK` on every one of their more than 6,000 rows on the `DBReplicated` arms over 21 days; tagging them would delete working coverage. Only the refused statements are declared unsupported, so the granularity differs per file. `04511_remote_named_collection_complex_overrides.sh` and `04327_s3queue_server_credentials.sh` take the tag whole: every assertion they make needs the collection, and `04511`'s only collection-independent statements are `remote(...)` table functions that execute locally and replay no table definition. `04320_url_engine_dispatch_partition_and_format.sh` and `04626_s3_base_setting.sh` are split instead. Their collection sections move into tests/queries/0_stateless/04320_url_engine_dispatch_partition_and_format_named_collection.sh tests/queries/0_stateless/04626_s3_base_setting_named_collection.sh which carry the tag, and the two parents lose it and keep running: 9 of 12 reference lines for `04320` and 19 of 22 for `04626`. That is coverage only this arm provides, because those retained lines include positional `CREATE TABLE ... ENGINE = URL(...)` and `ENGINE = S3(...)` definitions, which inside a `Replicated` database are themselves replicated DDL entries; the 17-21 other arms all use `Atomic` databases and never replay a table definition through a DDL log. The failing job's own `query_log` artifact confirms it rather than inferring it: every statement that stays in a parent finished with `exception_code = 0` on that arm, and the only exceptions in either test are the four named-collection statements that move into the children (`Code: 159`) plus `04626`'s deliberate no-scheme error (`Code: 36`), which is itself one of the retained assertions. Nothing is duplicated and nothing is dropped: for each split, the sorted parent and child `.reference` files together equal the sorted original byte-for-byte, and every executable statement of the original appears exactly once across the two scripts. The exceptions are each child's `shell_config.sh` preamble and, for `04626`, its own `BUCKET_URL`/`FILE` and a re-created seeding `INSERT`; that seed writes 5 rows rather than the parent's 3, because the count assertion that moves with the section reads the file after the parent's later 5-row relative `INSERT`. Each tag sits on its file's single `Tags:` line because `find_tag_line` (`tests/clickhouse-test:4310-4316`) returns only the first such line, so a second one would parse as an ordinary comment and the change would be a silent no-op. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112247&sha=66ee0b152db689826f5509ce55b0845246e1ae70&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F3%29 Related: ClickHouse#112247 Related: ClickHouse#112052
Internal second-model review (click to expand)Five review rounds before publication: each round an automated cold review of the resulting tree, my
Verified independently rather than taken from the change author, since these are the claims a reader
One observation while counting the precedents, noted because a reader who greps will count 19 rather Session id: cron:clickhouse-review-slot-9:20260831-012800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-41:20260831-004800 |
|
Workflow [PR], commit [1ec2a21] Summary: ✅ AI ReviewSummaryThis PR splits the named-collection-only assertions out of Final Verdict✅ No new review findings. |
|
cc @tuanpach, could you review this? Four stateless tests create a table from a SQL-created named collection, and a named collection is server-global, so inside a |
7168724
Related: #112052
Related: #112247
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Two stateless tests are skipped on the replicated-database CI arm, and two are split so their remaining assertions keep running there.
Description
@ alexey-milovidov asked for this on #112052;
#112247's CI ledger owns
04511.04511_remote_named_collection_complex_overrides,04327,04320and04626fail the main passon every run of both
Stateless tests (amd_llvm_coverage, ..., DBReplicated, ...)jobs withCode: 159 ... ReplicatedDatabase DDL task ... is not finished on 2 of 3 hosts. The diagnosticsrerun drops
--replicated-databaseand passes, so itsflakylabel force-sets coverage jobs toOKunless the rerun also fails: over 25,000 such rows in 21 days, no genuine pass.CREATE NAMED COLLECTIONis server-global, not database-scoped, so it applies only on the receivinghost.
CREATE TABLEinside aReplicateddatabase is a replicated DDL entry, replayed on everyreplica, where the collection is absent: it fails
Code: 669 NAMED_COLLECTION_DOESNT_EXIST, thenenters lost-replica recovery, which replays the same metadata and fails identically. Raising
distributed_ddl_task_timeoutcannot help, the entry never completes.no-replicated-databaseis the repository's existing declaration for this: 18 of the 35 statelesstests with
CREATE NAMED COLLECTIONalready carry it, 8 with this reason string verbatim. Thesefour are the whole class. A dictionary built from its own collection is not a carrier: its
SOURCEresolves at load.Only the refused statements are declared unsupported.
04511and04327take the tag whole, everyassertion they make needs the collection.
04320and04626do not, so their collection sectionsmove into new tests carrying the tag and the parents keep running: 9 of 12 reference lines for
04320, 19 of 22 for04626, confirmed from the job's ownquery_log. Those parents assertpositional
URL(...)/S3(...)table definitions, replicated DDL entries no other arm replays.Not fixed here: the timeout reports the replicas as still executing after both failed
non-retriably; the recovery retry is unbounded.
CI report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=112247&sha=66ee0b152db689826f5509ce55b0845246e1ae70&name_0=PR&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F3%29
Workflow [PR]
Sync PR [sync-upstream/pr/117234]