Repository navigation
Split remote database and data lake visibility settings - #109082
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.
|
Workflow [PR], commit [62139e4] Summary: ❌
AI ReviewSummaryThis PR splits Findings❌ Blockers
Tests
|
There was a problem hiding this comment.
Pull request overview
This PR splits visibility controls for external catalogs vs. remote SQL database engines by restoring show_data_lake_catalogs_in_system_tables to govern only DataLakeCatalog visibility and introducing/retuning show_remote_databases_in_system_tables to govern MySQL/PostgreSQL visibility (defaulting to enabled).
Changes:
- Reintroduces a dedicated setting for data lake catalogs and makes remote SQL database visibility a separate, default-on setting.
- Updates system tables and related code paths to filter database enumeration based on the new split (
with_datalake_catalogsvswith_remote_databases). - Updates stateless and integration tests to reflect the new setting behavior and defaults.
Reviewed changes
Copilot reviewed 42 out of 42 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.sql | Updates stateless coverage for remote DB visibility and settings exposure. |
| tests/queries/0_stateless/04210_show_remote_databases_in_system_tables.reference | Adjusts expected outputs for the updated stateless test. |
| tests/integration/test_postgresql_database_engine/test.py | Removes explicit opt-in setting usage now that remote DB visibility defaults to enabled. |
| tests/integration/test_mysql57_database_engine/test.py | Removes explicit opt-in setting usage now that remote DB visibility defaults to enabled. |
| tests/integration/test_mysql_database_engine/test.py | Removes explicit opt-in setting usage now that remote DB visibility defaults to enabled. |
| src/Storages/System/StorageSystemTables.cpp | Enumerates databases for system.tables using both datalake and remote-DB visibility settings. |
| src/Storages/System/StorageSystemReplicationQueue.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemReplicas.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemProjections.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemPartsBase.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemPartMovesBetweenShards.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemObjectStorageQueueSettings.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemMutations.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemKafkaConsumers.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemIcebergHistory.cpp | Ensures Iceberg system table sees both datalake catalogs and remote databases. |
| src/Storages/System/StorageSystemIcebergFiles.cpp | Ensures Iceberg system table sees both datalake catalogs and remote databases. |
| src/Storages/System/StorageSystemGraphite.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemDistributionQueue.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemDataSkippingIndices.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemDatabases.cpp | Keeps system.databases listing unconditional while enumerating with both flags enabled. |
| src/Storages/System/StorageSystemDatabaseReplicas.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemConstraints.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/System/StorageSystemCompletions.cpp | Uses both settings to control DB/table/column completion sources. |
| src/Storages/System/StorageSystemColumns.cpp | Uses both settings to control system.columns enumeration behavior. |
| src/Storages/System/StorageSystemClusters.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Storages/StorageMerge.cpp | Ensures Merge storage DB-regexp expansion includes both datalake catalogs and remote databases. |
| src/Storages/RocksDB/StorageSystemRocksDB.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Server/ReplicasStatusHandler.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Interpreters/ServerAsynchronousMetrics.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Interpreters/loadMetadata.cpp | Switches conversion scan DB enumeration filter from “remote” to “datalake catalogs”. |
| src/Interpreters/InterpreterSystemQuery.cpp | Switches all-DB iteration filter from “remote” to “datalake catalogs”. |
| src/Interpreters/InterpreterShowTablesQuery.cpp | Forces the relevant setting(s) on for explicit SHOW TABLES for datalake catalogs vs remote DBs. |
| src/Interpreters/InterpreterCreateQuery.cpp | Includes both datalake catalogs and remote DBs when counting databases for server limits. |
| src/Interpreters/InterpreterCheckQuery.cpp | Switches database enumeration filter from “remote” to “datalake catalogs”. |
| src/Interpreters/DatabaseCatalog.h | Splits database enumeration options into two independent flags and adds datalake helpers. |
| src/Interpreters/DatabaseCatalog.cpp | Implements datalake catalogs filtering/caching and updates hinting logic to use split flags. |
| src/Databases/IDatabase.h | Adds isDatalakeCatalog and refines isRemoteDatabase semantics. |
| src/Databases/DataLake/DatabaseDataLake.h | Marks DataLake DBs as datalake catalogs rather than remote DBs. |
| src/Core/SettingsChangesHistory.cpp | Records show_remote_databases_in_system_tables default/behavior changes across versions. |
| src/Core/Settings.cpp | Defines separate settings: datalake visibility (default off) and remote DB visibility (default on). |
| src/Client/BuzzHouse/Generator/SessionSettings.cpp | Adds the restored datalake setting to fuzz session settings generation. |
| src/Backups/BackupEntriesCollector.cpp | Ensures backups enumerate all databases including datalake catalogs and remote DBs. |
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.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 255/263 (96.96%) · Uncovered code |
Cherry pick #109082 to 26.3: Split remote database and data lake visibility settings
Cherry pick #109082 to 26.4: Split remote database and data lake visibility settings
Cherry pick #109082 to 26.5: Split remote database and data lake visibility settings
Cherry pick #109082 to 26.6: Split remote database and data lake visibility settings
Backport #109082 to 26.4: Split remote database and data lake visibility settings
Backport #109082 to 26.5: Split remote database and data lake visibility settings
Backport #109082 to 26.6: Split remote database and data lake visibility settings
Backport #109082 to 26.3: Split remote database and data lake visibility settings
The migration removed the tag by mistake. The test attaches PostgreSQL and MySQL databases pointing at an unreachable host, and while they exist any concurrent query scanning `system.tables`, `system.columns` or `system.completions` without a database filter attempts to connect and fails with `POSTGRESQL_CONNECTION_FAILURE` (the failure mode fixed by #109082). The victims are arbitrary tests, so no concurrency group can contain it.
A `DatabasePostgreSQL`/`DatabaseMySQL` pointed at an unreachable server logged the connection failure at error level on code paths that explicitly tolerate and retry it: - `DatabasePostgreSQL::getTablesIterator` — its catch exists so that `system.tables` scans do not fail on a postgres error - `DatabasePostgreSQL::removeOutdatedTables` — the background cleaner catches, reschedules and continues - `DatabaseMySQL` constructor — the connection probe failure is explicitly tolerated on `ATTACH` - `DatabaseMySQL::getCreateTableQueryImpl` with `throw_on_error = false` - `mysqlxx::Pool::allocConnection`, `mysqlxx::PoolWithFailover::get` and `postgres::PoolWithFailover::get` — they log before propagating the exception to the caller, who decides the severity The Upgrade check fails on any unexpected error message in the server log, so the leftover unreachable-host databases created by test `04210_show_remote_databases_in_system_tables` (added in ClickHouse#104416, made reachable by `system.tables` scans by default in ClickHouse#109082) tripped the check on 137 unrelated PRs in 14 days (0 on master). The new test attaches PostgreSQL and MySQL databases pointing at an unreachable host, exercises the tolerated paths, and asserts through `system.text_log` that they produce warnings but no error-level lines. Co-Authored-By: Claude Fable 5 <[email protected]>
…databases-system-tables Split remote database and data lake visibility settings
Related: #104416
The initial idea was to consolidate the behavior into a single setting:
show_data_lake_catalogs_in_system_tables. This was broadened to coverMySQLandPostgreSQLdatabases. However, this breaks backwards compatibility in a way that we'd want to avoid. This PR restores the data-lake-specific behavior and keepsremote database visibility as a separate control.
Thus, with this PR we keep the same behavior we had prior to #104416, but adding a separate setting to
avoid listing
MySQLandPostgreSQLdatabases.The new
show_remote_databases_in_system_tablessetting applies only toMySQLand
PostgreSQLdatabases. It defaults totrue, so these databases keep theirprevious visibility in
system.tables,system.columns, andsystem.completionsunless users explicitly disable it.
DataLakeCatalogdatabases remain hidden fromthose system tables by default and are still controlled only by
show_data_lake_catalogs_in_system_tables.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Restore
show_data_lake_catalogs_in_system_tablesas the setting that controls onlyDataLakeCatalogvisibility insystem.tables,system.columns, andsystem.completions. Addedshow_remote_databases_in_system_tables, enabled by default, to let users hideMySQLandPostgreSQLdatabases from those system tables separately.Version info
26.7.1.450(included in26.7and later)26.6.2.31,26.5.6.15,26.4.5.101,26.3.17.24