Repository navigation
Conversation
…bases_in_system_tables Broaden the setting to also hide MySQL and PostgreSQL databases from system.tables / system.columns / system.completions when disabled, since they too require remote calls to enumerate tables. The old name is preserved as an alias. Internal renames: GetDatabasesOptions::with_datalake_catalogs -> with_external_databases; DatabaseCatalog::isDatalakeCatalog -> isExternalDatabase; hasDatalakeCatalogs -> hasExternalDatabases; databases_without_datalake_catalogs -> databases_without_external.
Each assertion in the test now prints a short marker describing what it checks, so a failure in the reference diff is self-explanatory.
|
Workflow [PR], commit [bd8316a] AI ReviewSummaryThis PR expands Findings
Final VerdictStatus: |
There was a problem hiding this comment.
Pull request overview
This PR changes how ClickHouse enumerates databases for system.tables, system.columns, and system.completions to avoid expensive per-table round trips when external database engines (PostgreSQL/MySQL and data lake catalogs) are present but slow/unavailable. It introduces a new setting name with an alias to preserve backwards compatibility while broadening the default filtering behavior.
Changes:
- Renames
show_data_lake_catalogs_in_system_tablestoshow_external_databases_in_system_tables(keeps the old name as an alias) and extends filtering to PostgreSQL/MySQL database engines. - Updates
DatabaseCatalogand multiple system-table implementations to useGetDatabasesOptions{.with_external_databases = ...}consistently. - Adds a stateless regression test ensuring external DBs are hidden from
system.tables/system.columnsby default and that the alias is visible insystem.settings.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/queries/0_stateless/04210_show_external_databases_in_system_tables.sh | New stateless test for default hiding + setting alias behavior. |
| tests/queries/0_stateless/04210_show_external_databases_in_system_tables.reference | Expected output for the new stateless test. |
| tests/queries/0_stateless/03913_datalake_restful_catalog_bad_format.sh | Updates test to use the new setting name. |
| src/Storages/System/StorageSystemTables.cpp | Switches filtering to the new show_external_databases_in_system_tables setting. |
| src/Storages/System/StorageSystemReplicationQueue.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemReplicas.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemProjections.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemPartsBase.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemPartMovesBetweenShards.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemObjectStorageQueueSettings.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemMutations.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemKafkaConsumers.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemIcebergHistory.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemGraphite.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemDistributionQueue.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemDataSkippingIndices.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemDatabases.cpp | Ensures system.databases continues to include external DBs unconditionally. |
| src/Storages/System/StorageSystemDatabaseReplicas.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/System/StorageSystemCompletions.cpp | Uses the new setting to filter external DBs from completions by default. |
| src/Storages/System/StorageSystemColumns.cpp | Switches filtering to the new show_external_databases_in_system_tables setting. |
| src/Storages/System/StorageSystemClusters.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/StorageMerge.cpp | Updates database enumeration option name (with_external_databases). |
| src/Storages/RocksDB/StorageSystemRocksDB.cpp | Updates database enumeration option name (with_external_databases). |
| src/Server/ReplicasStatusHandler.cpp | Updates database enumeration option name (with_external_databases). |
| src/Interpreters/ServerAsynchronousMetrics.cpp | Updates database enumeration option name (with_external_databases). |
| src/Interpreters/loadMetadata.cpp | Updates database enumeration option name (with_external_databases). |
| src/Interpreters/InterpreterSystemQuery.cpp | Updates database enumeration option name (with_external_databases). |
| src/Interpreters/InterpreterShowTablesQuery.cpp | Forces the new setting on for SHOW TABLES when targeting an external DB. |
| src/Interpreters/InterpreterCreateQuery.cpp | Updates database counting to use the renamed option field. |
| src/Interpreters/InterpreterCheckQuery.cpp | Updates database enumeration option name (with_external_databases). |
| src/Interpreters/DatabaseCatalog.h | Renames options/flags to “external databases” terminology and updates API. |
| src/Interpreters/DatabaseCatalog.cpp | Implements external-DB classification and caches filtered DB maps. |
| src/Core/SettingsChangesHistory.cpp | Records the renamed/broadened setting behavior in settings history. |
| src/Core/Settings.cpp | Adds show_external_databases_in_system_tables with alias to the old name. |
| src/Client/BuzzHouse/Generator/SessionSettings.cpp | Updates fuzzing setting list to the new setting name. |
| src/Backups/BackupEntriesCollector.cpp | Updates database enumeration option name (with_external_databases). |
The test only exercised the PostgreSQL engine path. MySQL takes the same code path in DatabaseCatalog::isExternalDatabase, but a regression that special-cases PostgreSQL would have slipped through. Add a MySQL case using ATTACH (CREATE DATABASE ... ENGINE = MySQL connects eagerly, ATTACH does not) with a short connect_timeout so the tolerated failure is fast.
- DatabaseCatalog.h: fix grammar in the renamed comment ("are implement"
-> "are implemented", "protect ourself" -> "protect ourselves").
- DatabaseCatalog.cpp:2244: update outdated TableNameHints comment that
still said "Skip datalake catalogs" to reflect the broader scope.
- 04210: add an assertion that system.completions also does not list
external databases by default.
The new stateless test runs in about 5 seconds and remains stable across repeated runs, so it should be eligible for fasttest to improve CI coverage.\n\nRef: ClickHouse#104416
Per review feedback from @nikitamikhaylov on PR ClickHouse#104416: replace the free helper with engine-name string compare in DatabaseCatalog.cpp by a virtual method on IDatabase. DataLake / MySQL / PostgreSQL override to return true; the default is false, so other engines (Atomic, Replicated, MaterializedPostgreSQL, ...) keep the right behavior without needing to be aware of the new classification. The naming is intentionally distinct from the existing isExternal() ("engine does not support ClickHouse internal tables") and isDatalakeCatalog() (narrower). See the doc comment in IDatabase.h.
Fast test does not build libpq or libmysql, so CREATE DATABASE ENGINE = PostgreSQL/MySQL silently does nothing in that environment, and the test's reference no longer matches the actual output. This is the same reason 01114_mysql_database_engine_segfault.sql and 03790_materialized_postgresql_nullptr_dereference.sql carry the tag. Reverts removal in 527e58e. CI fast-test failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104416&sha=527e58ed25888cbc3061c7c1de91e18777c227ae&name_0=PR
Co-authored-by: Kseniia Sumarokova <[email protected]>
Rename the database-level helper to avoid confusion with IDatabase::isExternal and include MaterializedPostgreSQL in remote database filtering.
Pass through the test client API for integration tests that intentionally inspect MySQL and PostgreSQL metadata in and . PR: ClickHouse#104416 CI: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=104416&sha=158f2327e19aebbbfd2e588f15754e44210183a7&name_0=PR
Rename the new setting and `DatabaseCatalog` filtering option to use remote database terminology consistently, while keeping `show_data_lake_catalogs_in_system_tables` as the compatibility alias. Convert the stateless coverage from `.sh` to `.sql` now that the SQL test runner can provide unique database names. PR: ClickHouse#104416
Use remote database terminology consistently in comments changed by the PR and avoid the old external database wording near `isRemoteDatabase`. PR: ClickHouse#104416
Explain `isExternal` in terms of database engines that do not own ClickHouse table metadata instead of using vague wording. PR: ClickHouse#104416
…l-databases-setting
Cherry pick #104416 to 26.5: Hide MySQL and PostgreSQL databases from system.tables by default
…stem.tables by default
Cherry pick #104416 to 26.3: Hide MySQL and PostgreSQL databases from system.tables by default
…stem.tables by default
Cherry pick #104416 to 26.4: Hide MySQL and PostgreSQL databases from system.tables by default
…stem.tables by default
Backport #104416 to 26.5: Hide MySQL and PostgreSQL databases from system.tables by default
Remove accidentally backported `allow_experimental_geo_types_in_iceberg` so `02995_new_settings_history` only sees the setting from PR #104416. Update `test_database_glue/test_system_tables` to match the intended `system.databases` behavior: remote database names are local metadata and stay visible while table and column enumeration stays hidden by default. PR: #106046
Backport #104416 to 26.4: Hide MySQL and PostgreSQL databases from system.tables by default
Backport #104416 to 26.3: Hide MySQL and PostgreSQL databases from system.tables by default
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.
…e-check connection errors The merged allowlist (PR ClickHouse#108560) covers the DatabasePostgreSQL cleaner task (removeOutdatedTables) and the DatabaseMySQL engine, but the same leftover DatabasePostgreSQL engine from 04210_show_remote_databases_in_system_tables reaches the unreachable 192.0.2.1:5432 host through two more code paths that also log the benign connection failure at <Error>: - DatabasePostgreSQL::getTablesIterator: a system.tables scan probes the pool and logs the swallowed error via tryLogCurrentException. - AsyncLoader::worker: the post-upgrade startup asynchronously loads the leftover engine and re-logs the POSTGRESQL_CONNECTION_FAILURE (Code: 614). Both leak past the current matchers and keep the Upgrade check (amd_release) red across many unrelated PRs (0 on master). Add two matchers mirroring the existing removeOutdatedTables one: each requires the PostgreSQL code-path context AND the connection-failure symptom together (the AsyncLoader matcher additionally pins the PostgreSQL-specific Code: 614), so genuine PostgreSQL regressions and unrelated async-load errors are not masked. Related: ClickHouse#104416 Co-Authored-By: Claude Opus 4.8 <[email protected]>
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]>
…es from system.tables by default
Remove accidentally backported `allow_experimental_geo_types_in_iceberg` so `02995_new_settings_history` only sees the setting from PR ClickHouse#104416. Update `test_database_glue/test_system_tables` to match the intended `system.databases` behavior: remote database names are local metadata and stay visible while table and column enumeration stays hidden by default. PR: ClickHouse#106046
…4416 Backport ClickHouse#104416 to 26.4: Hide MySQL and PostgreSQL databases from system.tables by default
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-ClickHouse#104416 behavior where `MySQL` and `PostgreSQL` databases were always visible.
…e-check connection errors The merged allowlist (PR ClickHouse#108560) covers the DatabasePostgreSQL cleaner task (removeOutdatedTables) and the DatabaseMySQL engine, but the same leftover DatabasePostgreSQL engine from 04210_show_remote_databases_in_system_tables reaches the unreachable 192.0.2.1:5432 host through two more code paths that also log the benign connection failure at <Error>: - DatabasePostgreSQL::getTablesIterator: a system.tables scan probes the pool and logs the swallowed error via tryLogCurrentException. - AsyncLoader::worker: the post-upgrade startup asynchronously loads the leftover engine and re-logs the POSTGRESQL_CONNECTION_FAILURE (Code: 614). Both leak past the current matchers and keep the Upgrade check (amd_release) red across many unrelated PRs (0 on master). Add two matchers mirroring the existing removeOutdatedTables one: each requires the PostgreSQL code-path context AND the connection-failure symptom together (the AsyncLoader matcher additionally pins the PostgreSQL-specific Code: 614), so genuine PostgreSQL regressions and unrelated async-load errors are not masked. Related: ClickHouse#104416 Co-Authored-By: Claude Opus 4.8 <[email protected]>
Avoid implicit remote-table enumeration for remote database engines in
system.tables,system.columns, andsystem.completions.This prevents slow or unavailable
MySQL/PostgreSQLupstreams from blocking startup dictionaries, backup metadata queries, and interactive system-table reads.system.databasesstill shows database names unconditionally, andSHOW TABLES FROM <db>still opts in for the requested remote database.The old
show_data_lake_catalogs_in_system_tablessetting is kept as an alias. The new setting isshow_remote_databases_in_system_tables.Closes https://github.com/ClickHouse/clickhouse-private/issues/53621
Changelog category (leave one):
Changelog entry:
The setting
show_data_lake_catalogs_in_system_tableshas been renamed toshow_remote_databases_in_system_tablesand broadened: when its value is 0 (the default),MySQLandPostgreSQLdatabases are also hidden fromsystem.tables,system.columns, andsystem.completions, in addition to data lake catalogs. The old setting name is kept as an alias.Documentation entry for user-facing changes
Note
Medium Risk
Changes default visibility of MySQL/PostgreSQL/DataLakeCatalog databases in
system.tables,system.columns, andsystem.completions, which can affect tooling and queries that previously relied on implicit enumeration. Behavior is gated by a renamed setting with an alias, reducing but not eliminating upgrade risk.Overview
Prevents implicit enumeration of remote database engines by excluding data lake catalogs,
MySQL, andPostgreSQLdatabases fromsystem.tables,system.columns, andsystem.completionsunless the newshow_remote_databases_in_system_tablessetting is enabled.Renames and broadens
show_data_lake_catalogs_in_system_tablestoshow_remote_databases_in_system_tables(old name kept as an alias), and introducesIDatabase::isRemoteDatabase()with implementations for DataLake/MySQL/PostgreSQL plusDatabaseCatalogfiltering support.Ensures explicit
SHOW TABLES/SHOW COLUMNS/SHOW INDEXagainst a remote database still works by forcing the setting on for those queries, and updates backups and tests to use the new setting and verify the new default behavior.Reviewed by Cursor Bugbot for commit 980b830. Bugbot is set up for automated code reviews on this repo. Configure here.
Version info
26.6.1.21226.5.2.16,26.4.4.24,26.3.13.22