v.20.7Improvement

Implement RENAME DATABASE and RENAME DICTIONARY for Atomic Database Engine with UUID Macro

Implement RENAME DATABASE and RENAME DICTIONARY for Atomic database engine - Add implicit {uuid} macro, which can be used in ZooKeeper path for ReplicatedMergeTree. It works with CREATE ... ON CLUSTER ... queries. Set show_table_uuid_in_table_create_query_if_not_nil to true to use it. - Make ReplicatedMergeTree engine arguments optional, /clickhouse/tables/{uuid}/{shard}/ and {replica} are used by default. Closes #12135. - Minor fixes. - These changes break backward compatibility of Atomic database engine. Previously created Atomic databases must be manually converted to new format. Atomic database is an experimental feature. #12343 (tavplubix).
Introduced RENAME DATABASE and RENAME DICTIONARY commands for the Atomic database engine, added an implicit {uuid} macro for ZooKeeper paths in ReplicatedMergeTree, and made ReplicatedMergeTree engine arguments optional with sensible defaults.

Why it matters

This feature simplifies management of Atomic databases by allowing renaming of databases and dictionaries directly. The implicit {uuid} macro eliminates the need for manually specifying UUIDs in ZooKeeper paths, which enhances usability and consistency, especially in CREATE ... ON CLUSTER ... queries. Making ReplicatedMergeTree engine arguments optional reduces configuration complexity by using default paths and replica identifiers. Overall, it improves operation flexibility and usability of Atomic databases and replicated table engines.

How to use it

To use this feature:

- Rename databases or dictionaries with the new commands:

RENAME DATABASE old_db TO new_db;
RENAME DICTIONARY old_dict TO new_dict;


- Use the implicit {uuid} macro in ZooKeeper paths for ReplicatedMergeTree engines. Enable displaying UUID in CREATE TABLE queries by setting the setting:

SET show_table_uuid_in_table_create_query_if_not_nil = true;


- When creating ReplicatedMergeTree tables, you may omit engine arguments; the default path /clickhouse/tables/{uuid}/{shard}/ and replica name will be used automatically.

Note: Existing Atomic databases must be manually converted to the new format due to backward compatibility changes.