Repository navigation
Fix Metadata not initialized for RestCatalog - #102882
Conversation
|
Workflow [PR], commit [0167c7d] Summary: ✅
AI ReviewSummaryThis PR tries to fix lazy metadata initialization for PR Metadata
Findings
Tests
Final VerdictStatus: Minimum required actions: refresh metadata before |
|
Hello! Can this be merged soon? |
| ) | ||
|
|
||
| # Insert rows without any prior SELECT so that metadata starts uninitialized. | ||
| node.query( |
There was a problem hiding this comment.
This regression test inserts rows before the first mutation, but INSERT already calls updateExternalDynamicMetadataIfExists (InterpreterInsertQuery), which initializes DataLake metadata. That means this can pass even if the original #96806 path (first mutation on lazy metadata) is still broken.
Can we make the first ClickHouse operation on this table a mutation (or pre-populate data through the external catalog fixture) so the test directly covers the uninitialized-metadata case?
| auto metadata_snapshot = getInMemoryMetadataPtr(context_, false); | ||
| auto storage = getStorageID(); | ||
| configuration->mutate(commands, context_, storage, metadata_snapshot, catalog, format_settings); | ||
| configuration->mutate(commands, context_, shared_from_this(), storage, metadata_snapshot, catalog, format_settings); |
There was a problem hiding this comment.
This refresh is still too late for the first ALTER ... DELETE on a lazy DataLakeCatalog table. InterpreterAlterQuery captures metadata_snapshot before it calls checkMutationIsPossible, so the default validate_mutation_query=1 path runs MutationsInterpreter::validate with a snapshot that still lacks datalake_table_state; InterpreterSelectQuery keeps that non-null snapshot, and IcebergMetadata::iterate can throw Can't extract iceberg table state from storage snapshot... before this mutate path runs. Please move the external metadata update before the mutation snapshot is captured in InterpreterAlterQuery (or refresh the snapshot after lazy initialization) so the first ALTER mutation validates and executes against a snapshot with the table state.
LLVM Coverage Report
Changed lines: 78.00% (39/50) | lost baseline coverage: 7 line(s) · Uncovered code |
This commit reverts the materialization change in src/Processors/Transforms/FinishSortingTransform.cpp added by the previous commit, and keeps only the documentation test under tests/queries/0_stateless/04300_stid_3336_finishsorting_columnreplicated.sql. The reported "Bad cast from type DB::ColumnReplicated to DB::ColumnString" exception captured in CI on PR ClickHouse#102882, PR ClickHouse#104478, PR ClickHouse#105893 does not reproduce deterministically on master HEAD on a debug build, so the preceding source change was speculative and is dropped. The test stays as a name-anchored reproducer for the query shape captured in CI. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=102882&sha=1de47ad4469490e183bd76c5dad2eddd82d61422&name_0=PR&name_1=Stateless%20tests%20%28amd_msan%2C%20WasmEdge%2C%20parallel%2C%201%2F2%29
PR ClickHouse#102882 (Smita Kulkarni, merged 2026-05-28) added table->updateExternalDynamicMetadataIfExists() in InterpreterDeleteQuery::execute before the table->supportsDelete() call. That upstream fix initializes the data lake metadata before supportsDelete reaches assertInitialized, so the Logical error path that 04238 was designed to catch is no longer reachable via DELETE FROM on master HEAD. The other five cases in 04238 (TRUNCATE, UPDATE, INSERT, ALTER DELETE, ALTER UPDATE) were documented in the test as shape-coverage-only: the corrupted-metadata setup errors with INCORRECT_DATA before reaching the supports* methods. 04240 stays. It covers the InsertDependenciesBuilder supportsParallelInsert path on MV-dependent sinks, which has no upstream lazy-init guard and which our StorageObjectStorage wrapper does fix. The StorageObjectStorage::supportsDelete wrapper is kept as defense in depth, mirroring the checkMutationIsPossible / checkAlterIsPossible wrappers added by parent PR ClickHouse#104738.
…adata_initialization_fix Fix Metadata not initialized for RestCatalog (cherry picked from commit 4d568ef)
…adata_initialization_fix Fix Metadata not initialized for RestCatalog (cherry picked from commit 4d568ef) Co-authored-by: Copilot <[email protected]>
…adata_initialization_fix Fix Metadata not initialized for RestCatalog (cherry picked from commit 4d568ef) Co-authored-by: Copilot <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix updating metadata before executing mutation resolves #96806
Documentation entry for user-facing changes
Version info
26.6.1.221