Repository navigation
Fix reads of a reloaded table created AS an object storage table function with parallel replicas - #132315
Conversation
…hout the cluster `CREATE TABLE t AS s3(...)` (and every other object storage table function with a `*Cluster` variant) executes the table function with `is_insert_query = true`, so it never builds the parallel replicas cluster storage. When the table is loaded back from its metadata (ATTACH DATABASE, a server restart), `createTableFromAST` executes the same definition with the loader's global context and `is_insert_query = false`, so on a server whose default profile enables parallel replicas the table became a `StorageObjectStorageCluster`. Queries reference that table by name, which the cluster storage cannot rewrite into a `*Cluster` table function call, so every replica resolved its own `db.t` again, and every read failed with THERE_IS_NO_COLUMN (on the replicas for a single SELECT, on the initiator for the second branch of UNION ALL, where the proxy matched a WithMergeableState header by name). Stored columns only accompany a table definition (CREATE and replay), never an ad-hoc call, so a definition with stored columns now resolves to the storage its creation selected. This is the rule `TableFunctionURL` already applies for `url` (ClickHouse#115095). Closes ClickHouse#132278 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review of the diff (2 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261117-095100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20261117-092700 |
|
Workflow [PR], commit [80f9756] Summary: ❌
AI ReviewSummaryThe stored-column guard keeps tables created with The remaining CI gate failure is the previously discussed Final VerdictStatus: ✅ Approve |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 18 s compile time in total, 7 of them have a recent master baseline. |
CI finish ledger - f09bb52Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The other CIDB Session id: cron:our-pr-ci-monitor:20261117-140019 |
…e` and `05569_lazy_load_tables_iceberg_snapshot_per_select` `02354_vector_search_drop_cache_for_table_lazy_proxy_rename` was added on master and checks that `system.tables.engine` is `TableProxy` for a table behind a proxy. This PR reports the engine from the `CREATE` query instead, so check `is_loaded` too. `05569_lazy_load_tables_iceberg_snapshot_per_select` hits the known failure of a table created `AS` a data lake table function with parallel replicas in the server profile: ClickHouse#132278 (fix in progress: ClickHouse#132315), so it is tagged `no-parallel-replicas`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=113389&sha=a4d7e8c6bb086fc1110ca9b69e14803a174fa498&name_0=PR PR: ClickHouse#113389 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵️ @groeneai The fix looks right: only One suggestion about the test: a new integration module with its own cluster is the most expensive kind of test, and the integration test guidelines ask for one only when a stateless test cannot cover the behavior. Here one probably can. The bug needs a server whose default profile enables parallel replicas, and the stateless |
|
Will do: I'll replace the integration module with a stateless test (a table created Two notes. |
The bug needs a server whose default profile enables parallel replicas, which is the profile of the stateless ParallelReplicas CI job, so a stateless test covers it there instead of a separate integration module with its own cluster (review request on ClickHouse#132315). In the other jobs the test passes on master too. Measured against local servers: with the ParallelReplicas profile (tests/config/users.d/enable_parallel_replicas.xml) master fails 3 of 3 (`Cannot find column id ... [__table1.id]` on the replica), the PR head passes 50 of 50 with random settings; with the default profile master passes 5 of 5. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Done in 80f9756: the integration module is replaced by the stateless |
CI finish ledger - 80f9756Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
The Session id: cron:our-pr-ci-monitor:20261124-003024 |
2c466c2
|
The only red is |
Closes: #132278
Related: #113389
Related: #115095
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed reading a table created
ASan object storage table function (s3,azureBlobStorage,hdfs,icebergLocal,deltaLakeand others) after the table was loaded back from its metadata (ATTACH DATABASE, a server restart) on a server whose default profile enables parallel replicas: every read of it failed, for example withTHERE_IS_NO_COLUMN. Closes #132278.Description
On 26.10.4.207, every read of a table created
AS icebergLocal(...)fails withTHERE_IS_NO_COLUMNonce the table is reloaded on a server whose default profile enables parallel replicas (theParallelReplicasCI configuration, #132278): a singleSELECT sum(id)fails on the replicas, and the second branch ofUNION ALLfails on the initiator.CREATE ... AS f(...)executes the table function withis_insert_query = true, so it builds a plain object storage. Reloading executes the stored definition with the server context andis_insert_query = false, so with parallel replicas in the profile it becomesStorageObjectStorageCluster. Queries name the table, which that storage cannot rewrite into a*Clustercall: each replica resolves its own reloaded table again, and the reads fail. Fixing only the by-name header match inStorageTableFunctionProxy::readmoves the failure to the replicas (measured).Stored columns reach a table function only from
CREATEand its replay, never from an ad-hoc call, so a definition with stored columns now resolves to the storage its creation selected, the ruleurlalready follows (#115095). After a reload such a table is read without the cluster, as it already was right afterCREATE; an ad-hoc call of the function in a query still reads through the cluster.The new stateless test reloads such a table and reads it. With the
ParallelReplicasprofile it fails on master (THERE_IS_NO_COLUMNon the replicas) and passes with the change (50 of 50 runs against a local server with that profile); with the default profile it passes on master too.05569_lazy_load_tables_iceberg_snapshot_per_selectcan leaveparallel_replicas_blacklist.txtin #113389 once this is merged.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/132315]
Version info
26.12.1.394-master(included in26.12and later)