Repository navigation
Conversation
|
Workflow [PR], commit [ae9e9bb] Summary: ❌
AI Review
|
…asts, close proxy metadata gaps
…y-load-tables-fixes
…ep graphite and dropped-parts tables
… system-table schema reference
…fixes # Conflicts: # src/Storages/StorageProxy.h
…eProxy` Master added this virtual and overrides it in `StorageObjectStorage`, which is deferrable, so the `storage_proxy_forwards` style check failed: a lazily loaded table answered it from the proxy rather than from the nested storage. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…atusRequest` An ordinary native session could send a `TablesStatusRequest` for a table it has no rights on, and a deferred replicated table was constructed and started to report its delay. Check the access with `checkAccessBeforeLoadingLazyTable`, like the other paths that load a lazy table by name. The interserver mode is authenticated with the cluster secret and is not changed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…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]>
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=4 K_base=14 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
…e_query_plan` In the `distributed plan` CI job (`serialize_query_plan = 1`) the remote server executes the deserialized query plan, and the tables of such a plan are resolved without the access checks of the interpreter. The query of the user without rights succeeded, and the table was loaded by the initiator while building the plan, so the test did not exercise `TablesStatusRequest`. Disable `serialize_query_plan` for the two distributed queries of the test. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=113389&sha=6ecfcfe6eb1931bab16abbcb8d153b7bddd6bd78&name_0=PR&name_1=Stateless%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20distributed%20plan%2C%20targeted%29 ClickHouse#113389 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
|
||
| auto nested_storage = get_nested(); | ||
| /// A storage built for a `DROP` that did not go through is started and used from here on. | ||
| auto nested_storage = built_for_drop ? std::exchange(built_for_drop, nullptr) : get_nested(getStorageID()); |
There was a problem hiding this comment.
[Blocker] RENAME TABLE / EXCHANGE TABLES still construct newly deferred external/streaming storages under the old StorageID
DatabaseAtomic::renameTable now force-loads lazy tables before it updates their catalog name, so this path materializes an untouched deferred table while getStorageID() is still the old one. That changes real behavior for the engines this PR newly allows to stay lazy: StorageKafka / StorageKafka2 bake {database} / {table} macro expansion and the default kafka_client_id in their constructors, and StorageRabbitMQ computes queue_base / sharding_exchange there while its renameInMemory only renames the registry entry. After a restart, RENAME TABLE on an untouched lazy Kafka/RabbitMQ table can therefore keep talking to the old external identity until the table is recreated.
This needs either an opt-out from deferred load for storages whose rename is not fully in-memory, or a way to rebuild that constructor-derived state when the rename path preloads the proxy.
AI review of a later commit does not approve the PR, see the AI Review comment.
…ading, and the deferred-engine audit - `checkAccessBeforeLoadingLazyTable` and `loadTableIfLazy` follow an `Alias` to the last table of its chain, which the alias loads before checking the rights on it. This covers `SELECT`, `EXPLAIN`, `INSERT` (also asynchronous), and `SHOW COLUMNS` / `SHOW INDEXES` through an alias. `ALTER` and `DELETE FROM` through an alias check `ALTER` / `ALTER DELETE` on the target first. The `TablesStatusRequest` does not load the target of an alias, so it keeps checking the named table. - `RENAME DATABASE` no longer loads the deferred tables to ask `checkTableCanBeRenamedByDatabaseRename`. An engine answers it from the definition through `StorageFactory::CheckDatabaseRenameFn` instead, which `S3Queue` and `AzureQueue` implement without reading Keeper or starting the queue. - `check_deferrable_engines_are_audited` follows the creator passed to `registerStorage` and the helpers it returns through (`createStorageObjectStorage`, `createQueueStorage`), and fails when it cannot tell which class a registration creates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Conflict in `src/Storages/StorageKeeperMap.cpp`: master removed
`.supports_parallel_insert` from the `KeeperMap` registration ("Preserve input
order for order-sensitive insert destinations"), the branch added
`.supports_deferred_load` next to it. Keep `.supports_deferred_load` only.
Adaptations to master that did not show up as textual conflicts:
- `IStorage::getSerializationHints` now takes the metadata snapshot; update the
overrides in `StorageProxy` and `StorageTableProxy`.
- Master added `StorageProxy::supportsStreaming`, which the branch also added;
drop the duplicate.
- The test `05816_streaming_queries_lazy_load_source`, added on master, pinned
`system.tables.engine` of a table that is not loaded yet to `TableProxy`.
This branch intentionally reports the real engine there, so the test now
checks `engine` together with the new `is_loaded` column.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 Merged
The only red checks on the previous commit were the two
|
The test failed in `Integration tests (amd_asan_ubsan, flaky)` and `Integration tests (amd_msan, targeted)` with `assert 0 == 2450`: no row reached `lazy.dest` within the 60 seconds the test waits. A Kafka consumer is closed without leaving its consumer group (`RD_KAFKA_DESTROY_F_NO_CONSUMER_CLOSE`), so the group keeps the consumer of a detached table as a member until its session expires, and the consumer created after `ATTACH DATABASE` gets no partition before that. The test passed only when `DETACH DATABASE` came before the streaming task noticed the materialized view, which it does within 500 ms, so that no consumer existed yet. In the failed runs the consumer was created 2 ms before the `DETACH`, was closed in the middle of joining the group, and the next consumer logged `No assignment` for the rest of the test. Wait for the first consumer to get its assignment before the reload, so that it is always closed in the same state, and lower the session timeout of the consumers in this test to the minimum the broker accepts (6 seconds instead of the default 45), so that the consumer created after the reload gets the partition in about 5 seconds. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=113389&sha=0dfec0e3f5ae00b302c1ab5fe1591cd9632178dd&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20flaky%29 ClickHouse#113389 Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 The only test failure was the PR's own Fixed in f8280dd: the test waits for the first consumer to get its assignment before the reload, and the consumers in this test use a 6 second session timeout instead of the default 45. Locally the consumer created after the reload now gets the partition in about 5 seconds (44 seconds without the shorter timeout), and both engine variants pass.
|
… EMPTY` `TRUNCATE TABLE alias IF EMPTY` asks the `Alias` for its row count, which the alias takes from its target. A deferred table of a `lazy_load_tables` database reports an unknown count until it is loaded, and an unknown count passed the emptiness check, so a nonempty target was truncated through the alias instead of `TABLE_NOT_EMPTY`. The target is now loaded before it is counted. `TRUNCATE` requires the right to truncate the target to load it. `DROP` and `DETACH` remove only the alias, so they load the target for a user who can see it, which is what the alias requires to report the count of a loaded target. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…STOP` loads it `SYSTEM STOP|START|PAUSE|CANCEL|REFRESH db.table` requires `SYSTEM STREAMING ENGINES` for a streaming engine and `SYSTEM VIEWS` for a refreshable materialized view. For a deferred table of a `lazy_load_tables` database only a user with neither grant was rejected before the table was loaded, so a user with only `SYSTEM VIEWS` could load (construct and start) a streaming table and got `ACCESS_DENIED` only after that. The streaming engines are now registered with the `is_streaming` storage feature, and a table that is not loaded yet is never a view, so the same decision is made from the engine in the `CREATE` query before the table is loaded. Co-Authored-By: Claude Fable 5.2 <[email protected]>
…by name again `InterpreterAlterQuery` resolves the table by name a second time, because a concurrent `EXCHANGE` can put another table under the name. If that table is a deferred table of a `lazy_load_tables` database, it was loaded before the access check. It now gets the same checks as the first resolution before it is loaded. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… the restricted user The positive branch of `05838_lazy_load_tables_alias_access_before_load` ran as the default user, so it did not cover a user who holds the rights on the target without being a superuser. Co-Authored-By: Claude Fable 5.2 <[email protected]>
… what it observes The stand-in of a lazily loaded table reports the engine from the `CREATE` query and forwards everything else to the loaded storage, so SQL cannot tell which of the two objects the catalog holds. The test no longer claims to check when the stand-in is replaced. It checks that `system.tables` and a read of the table give the same answers while a query holds the stand-in and after that query is gone. Co-Authored-By: Claude Fable 5.2 <[email protected]>
|
🕵 Pushed ae9e9bb: the seven open review threads are addressed (replies in the threads), and
The only red check on the previous commit, |
Closes: #117426
Closes: #117440
Related: #121332
Related: #96283
Related: #117490
Related: #118135
Related: #118152
lazy_load_tableskeeps a table behindStorageTableProxyuntil its first access, and the catalog keeps handing out the proxy afterwards. #121332 made the casts on catalog pointers look through it. This PR fixes what the proxy itself answers wrongly and defers only the engines that are known to be safe.supports_deferred_load, shown insystem.table_engines) instead of the engine-name lists inDatabaseOrdinary, so an engine that has not opted in is loaded eagerly.StorageProxyforwards theIStoragemethods a deferrable engine overrides.BACKUPno longer produces an empty archive that reports success, mutations,DELETE FROMand lightweightUPDATEare no longer rejected, and parallel replicas, trivial count and the table-levelasync_insertsetting are no longer silently disabled.supportsReplicationandstoresDataOnDiskfrom theCREATEquery until the table is loaded.system.tables.engineshows the real engine instead ofTableProxy, a nondeterministic mutation is rejected again on a replicated table, and/replicas_statusloads only the replicated tables instead of skipping the unloaded ones. A newsystem.tables.is_loadedcolumn shows which tables are loaded.SYSTEM STOP MERGES db.t(and the other action locks) loads a deferred table it names, so the lock is really taken, and a deferred data lake table answerssupportsReplicationlike the loaded one.SHOW COLUMNSandSHOW INDEXESload the table to report its keys and indices.StorageProxymust forward everyIStoragevirtual that a deferrable engine overrides, and an engine that opts in must list its class in the cast check.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix data loss and several silent behaviour changes in databases created with
lazy_load_tables = 1:BACKUPproduced empty backups,SYSTEM STOP MERGESon a table that was not accessed yet had no effect, mutations andDELETE FROMwere rejected,SHOW COLUMNSandSHOW INDEXESreported no keys, and parallel replicas, trivial count and the table-levelasync_insertsetting were disabled. Only the engines that support it are now loaded lazily, andsystem.tablesreports the real engine name and a newis_loadedcolumn.Workflow [PR]
Sync PR [sync-upstream/pr/113389]