Repository navigation
Fix Iceberg DELETE and UPDATE on catalog tables with parallel replicas - #126097
alexey-milovidov merged 2 commits into
Conversation
With parallel replicas for cluster engines, `DatabaseDataLake` returns a `StorageObjectStorageCluster` for every statement, and its `mutate` (added in ClickHouse#119214) passed itself as the mutation's read source. `Iceberg::writeDataFiles` builds `MutationsInterpreter` over that storage; for a non-MergeTree source it reads with a synthetic `SELECT <columns> WHERE <predicate>` that has no table expression, and `IStorageCluster::read` re-analyzes that query to build the per-replica query, so the virtual columns cannot be resolved: `Unknown expression identifier _row_id (UNKNOWN_IDENTIFIER)` for `ALTER TABLE ... DELETE`, `ALTER TABLE ... UPDATE` and `DELETE FROM`. Pass a transient local `StorageObjectStorage` of the same table as the read source instead, built with the arguments `DatabaseDataLake` uses without parallel replicas (`is_table_function` so the constructor never creates the table in the catalog, `lazy_init` so it does no object storage request). The metadata refresh and the metadata snapshot stay with the cluster storage, so the mutation runs against the state the interpreter validated, and the read storage needs no refresh of its own. The mutation read runs on the initiator, as it does without parallel replicas. Closes ClickHouse#122161 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Condense the read-source comment in StorageObjectStorageCluster::mutate to one line. 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 cold review (1 nit).
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-8:20261015-182900 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-6:20261015-175300 |
|
Workflow [PR], commit [823920d] Summary: ✅
AI ReviewSummaryPR #126097 fixes Iceberg catalog mutations with parallel replicas by reading through a temporary local Missing context / blind spots
Final VerdictStatus: ✅ Approve. No code changes requested; CI confirmation remains pending. |
|
cc @alesapin @scanhex12, could you review this? With parallel replicas, |
9b94f8a
Backport #126097 to 26.10: Fix Iceberg `DELETE` and `UPDATE` on catalog tables with parallel replicas
Closes: #122161
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed
ALTER TABLE ... DELETE,ALTER TABLE ... UPDATEandDELETE FROMon Iceberg tables of aDataLakeCatalogdatabase failing withUNKNOWN_IDENTIFIERwhen parallel replicas are enabled. Closes #122161.Description
On 26.9 (measured on
26.9.16.11),ALTER TABLE ... DELETE,ALTER TABLE ... UPDATEandDELETE FROMon an Iceberg table of aDataLakeCatalogdatabase fail withUNKNOWN_IDENTIFIER(unknown identifier_row_id) whenever parallel replicas are enabled, while the same statements succeed without them. The table is not modified.Root cause: with parallel replicas the database returns a
StorageObjectStorageCluster, and itsmutate(added in #119214) passed itself as the mutation's read source.MutationsInterpreterreads with aSELECTthat has noFROM, andIStorageCluster::readre-analyzes that query to build the per-replica query, so the virtual columns cannot be resolved.Change: the mutation now reads through a local
StorageObjectStorageof the same table, built with the argumentsDatabaseDataLakeuses without parallel replicas. The metadata refresh and snapshot still come from the cluster storage. The mutation read runs on the initiator, as it does without parallel replicas.ALTER TABLE ... DROP PARTITIONis not implemented by the cluster variant and still returnsNOT_IMPLEMENTEDwith parallel replicas; this PR does not change it.Validation: the new integration test
test_cluster_mutationsfails on master and on26.9.16.11with the error from the issue and passes with the fix (10/10 repeated); thetest_database_icebergmodule andtest_writes_parallel_replicas_no_catalogpass.Workflow [PR]
Sync PR [sync-upstream/pr/126097]
Version info
26.11.1.12-master(included in26.11and later)