v.22.8Improvement

Improved DDL Query Result Structure for Replicated Database and Metadata Consistency Fixes

Improved structure of DDL query result table for Replicated database (separate columns with shard and replica name, more clear status) - CREATE TABLE ... ON CLUSTER queries can be normalized on initiator first if distributed_ddl_entry_format_version is set to 3 (default value). It means that ON CLUSTER queries may not work if initiator does not belong to the cluster that specified in query. Fixes #37318, #39500 - Ignore ON CLUSTER clause if database is Replicated and cluster name equals to database name. Related to #35570 - Miscellaneous minor fixes for Replicated database engine - Check metadata consistency when starting up Replicated database, start replica recovery in case of mismatch of local metadata and metadata in Keeper. Resolves #24880. #37198 (Alexander Tokmakov).
Enhanced the Replicated database engine by improving the DDL query result structure, refining CREATE TABLE ... ON CLUSTER query normalization behavior, and adding metadata consistency checks with automatic replica recovery.

Why it matters

This update addresses clarity and reliability issues in managing Replicated databases. It separates shard and replica names in DDL query results for better status visibility, ensures ON CLUSTER queries normalize correctly on the initiating host (preventing failures when the initiator is not part of the target cluster), and improves metadata consistency by verifying and recovering replicas at startup. These changes fix multiple issues related to cluster management, metadata synchronization, and user experience when working with distributed DDL operations.

How to use it

To enable improved normalization of CREATE TABLE ... ON CLUSTER queries, set the setting distributed_ddl_entry_format_version to 3 (which is the default). The system will automatically ignore the ON CLUSTER clause if the database is Replicated and the cluster name equals the database name. The metadata consistency checks and automatic recovery are applied automatically during Replicated database startup, requiring no additional user action.