Repository navigation
Cherry pick #109082 to 26.3: Split remote database and data lake visibility settings - #109218
Merged
robot-ch-test-poll3 merged 10 commits intoJul 3, 2026
Merged
Conversation
Restore `show_data_lake_catalogs_in_system_tables` for `DataLakeCatalog` visibility in system introspection tables. Add `show_remote_databases_in_system_tables`, enabled by default, for `MySQL` and `PostgreSQL` databases only. Keep separate `IDatabase` APIs so data lake catalogs and remote databases are classified independently.
Record `show_remote_databases_in_system_tables` with default `true` where the setting is introduced, and update the `26.6` settings reference accordingly.
Keep the existing remote database integration tests focused on the `system.columns` visibility behavior restored by this PR. The explicit `SHOW COLUMNS` and `SHOW INDEX` checks were added together with the original `show_remote_databases_in_system_tables` change, but they are not needed for the default remote database visibility coverage.
Add a `show_remote_databases_in_system_tables` entry to the 26.7 settings changes history block so the Upgrade check passes: the baseline release is 26.6, and the check requires an entry in a version block newer than the baseline. Keep the values as `true, true` so `compatibility` mode does not roll the restored default back to `false`. Tag `04210_show_remote_databases_in_system_tables` as `no-parallel`. The test registers `PostgreSQL` and `MySQL` databases on an unreachable host; with the new default `show_remote_databases_in_system_tables = true` they are visible in `system.tables`, `system.columns` and `system.completions`, so concurrent tests that scan those tables without a database filter timed out with `POSTGRESQL_CONNECTION_FAILURE`. This caused failures in 00564_temporary_table_management, 01518_cast_nullable_virtual_system_column, 03566_system_completions_table, 03602_query_system_tables_definer and 00696_system_columns_limit. CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109082&sha=latest&name_0=PR
Keep `show_remote_databases_in_system_tables` as a single `26.6` settings-history entry with default value `true`. This avoids duplicate history entries while keeping the restored default visible in the generated compatibility reference.
Revert commit e79fd5f and return to the layout from commit 9c7c5ab and commit 1fc129c: `show_remote_databases_in_system_tables` is recorded as `{true, true}` in both the `26.2` and the `26.7` settings-history blocks. The `26.2` entry covers the planned backports to 26.2+ release branches, and the `26.7` entry satisfies the Upgrade check, which requires an entry in a block newer than the 26.6 baseline release. Keeping both values `true` means `compatibility` mode never rolls the restored default back to `false`, matching the pre-#104416 behavior where `MySQL` and `PostgreSQL` databases were always visible.
…system-tables Split remote database and data lake visibility settings
…ypick/26.3/109082 # Conflicts: # src/Core/Settings.cpp # src/Interpreters/InterpreterSystemQuery.cpp # src/Storages/System/StorageSystemConstraints.cpp # src/Storages/System/StorageSystemIcebergFiles.cpp # tests/queries/0_stateless/02995_settings_26_2_1.tsv # tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.sql
Contributor
There was a problem hiding this comment.
Pull request overview
Backports the change that separates visibility controls for DataLake catalogs vs remote MySQL/PostgreSQL databases in system.tables, system.columns, and system.completions, restoring the prior data-lake-specific behavior while keeping remote DB visibility configurable (default enabled).
Changes:
- Split database-catalog filtering into
with_datalake_catalogsvswith_remote_databases, and update system tables to consult the corresponding settings. - Add/adjust settings:
show_data_lake_catalogs_in_system_tables(defaultfalse) andshow_remote_databases_in_system_tables(defaulttrue), plus update settings history and tests. - Update various places that iterate databases to use the new options and/or ensure explicit
SHOW TABLESincludes the requested remote/data-lake database.
Reviewed changes
Copilot reviewed 41 out of 41 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.sh | Adjusts stateless test to reflect the split settings and adds no-parallel to avoid cross-test interference. |
| tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.reference | Updates expected output for the revised test queries/results. |
| tests/queries/0_stateless/02995_settings_26_2_1.tsv | Adds show_remote_databases_in_system_tables to the expected settings list. |
| tests/integration/test_postgresql_database_engine/test.py | Removes explicit settings overrides relying on new default visibility (but leaves a stray debug print). |
| tests/integration/test_mysql57_database_engine/test.py | Removes explicit settings overrides relying on new default visibility. |
| tests/integration/test_mysql_database_engine/test.py | Removes explicit settings overrides relying on new default visibility. |
| src/Storages/System/StorageSystemTables.cpp | Filters databases in system.tables based on both data-lake and remote DB visibility settings. |
| src/Storages/System/StorageSystemReplicationQueue.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemReplicas.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemProjections.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemPartsBase.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemPartMovesBetweenShards.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemObjectStorageQueueSettings.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemMutations.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemKafkaConsumers.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemIcebergHistory.cpp | Ensures Iceberg history can iterate both data-lake catalogs and remote DBs where needed. |
| src/Storages/System/StorageSystemGraphite.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemDistributionQueue.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemDataSkippingIndices.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemDatabases.cpp | Keeps system.databases showing all DBs unconditionally (both data-lake and remote). |
| src/Storages/System/StorageSystemDatabaseReplicas.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/System/StorageSystemCompletions.cpp | Filters completion candidates based on both visibility settings. |
| src/Storages/System/StorageSystemColumns.cpp | Filters databases in system.columns based on both visibility settings. |
| src/Storages/System/StorageSystemClusters.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Storages/StorageMerge.cpp | Ensures merge storage DB iteration includes data-lake catalogs and remote DBs where appropriate. |
| src/Storages/RocksDB/StorageSystemRocksDB.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Server/ReplicasStatusHandler.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Interpreters/ServerAsynchronousMetrics.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Interpreters/loadMetadata.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Interpreters/InterpreterSystemQuery.cpp | Updates system-query DB iteration to the new options (some paths need tighter filtering to avoid remote enumeration). |
| src/Interpreters/InterpreterShowTablesQuery.cpp | Ensures explicit SHOW TABLES includes requested remote/data-lake DBs by overriding settings in query context. |
| src/Interpreters/InterpreterCreateQuery.cpp | Counts databases including both data-lake catalogs and remote DBs for limit enforcement. |
| src/Interpreters/InterpreterCheckQuery.cpp | Updates database iteration to the new GetDatabasesOptions flag naming. |
| src/Interpreters/DatabaseCatalog.h | Introduces split flags in GetDatabasesOptions and new data-lake catalog helpers. |
| src/Interpreters/DatabaseCatalog.cpp | Implements split filtering/caches for databases and updates table-name hint logic accordingly. |
| src/Databases/IDatabase.h | Splits isDatalakeCatalog from isRemoteDatabase. |
| src/Databases/DataLake/DatabaseDataLake.h | Marks DataLake as isDatalakeCatalog rather than isRemoteDatabase. |
| src/Core/SettingsChangesHistory.cpp | Updates settings change history to reflect the new setting semantics/defaults. |
| src/Core/Settings.cpp | Splits the settings declarations and sets new defaults. |
| src/Client/BuzzHouse/Generator/SessionSettings.cpp | Adds show_data_lake_catalogs_in_system_tables to fuzzing session settings. |
| src/Backups/BackupEntriesCollector.cpp | Ensures backup metadata collection sees both data-lake catalogs and remote DBs when backing up all databases. |
Comments suppressed due to low confidence (2)
src/Interpreters/DatabaseCatalog.cpp:2094
DatabaseCatalog::reloadDisksTaskshould only iterate local ClickHouse databases/tables. WithGetDatabasesOptions{.with_datalake_catalogs = false}and the new defaultwith_remote_databases = true, remote databases may be included andgetTablesIteratorcan trigger remote enumeration / exceptions. Filter out remote databases and skipisExternalengines.
for (auto & database : getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}))
{
// WARNING: In case of `async_load_databases = true` getTablesIterator() call wait for all table in the database to be loaded.
// WARNING: It means that no database will be able to update configuration until all databases are fully loaded.
// TODO: We can split this task by table or by database to make loaded table operate as usual.
auto it = database.second->getTablesIterator(getContext());
src/Storages/System/StorageSystemKafkaConsumers.cpp:273
- This system table iterates
getTablesIteratoracross all databases. After splittingGetDatabasesOptions,GetDatabasesOptions{.with_datalake_catalogs = false}still includes remoteMySQL/PostgreSQLdatabases by default, potentially triggering remote calls/exceptions while readingsystem.kafka_consumers. Exclude remote databases and skipisExternaldatabases before iterating tables.
auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false});
for (const auto & db : databases)
{
for (auto it = db.second->getTablesIterator(context); it->isValid(); it->next())
{
Comment on lines
+263
to
266
| for (auto & elem : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false})) | ||
| { | ||
| startStopActionInDatabase(action_type, start, elem.first, elem.second, getContext(), log); | ||
| } |
| else if (query.is_drop_whole_replica) | ||
| { | ||
| auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_remote_databases = false}); | ||
| auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}); |
Comment on lines
+1449
to
1452
| for (auto & elem : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false})) | ||
| { | ||
| DatabasePtr & database = elem.second; | ||
| for (auto iterator = database->getTablesIterator(getContext()); iterator->isValid(); iterator->next()) |
Comment on lines
+61
to
64
| auto databases = DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false}); | ||
| for (const auto & db : databases) | ||
| { | ||
| for (auto iterator = db.second->getTablesIterator(context); iterator->isValid(); iterator->next()) |
Comment on lines
+1959
to
1962
| for (auto & database : DatabaseCatalog::instance().getDatabases(GetDatabasesOptions{.with_datalake_catalogs = false})) | ||
| { | ||
| for (auto it = database.second->getTablesIterator(getContext()); it->isValid(); it->next()) | ||
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original pull-request #109082
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job