v.20.7Improvement
Implement RENAME DATABASE and RENAME DICTIONARY for Atomic Database Engine with UUID Macro
ImplementRENAME DATABASEandRENAME DICTIONARYforAtomicdatabase engine - Add implicit{uuid}macro, which can be used in ZooKeeper path forReplicatedMergeTree. It works withCREATE ... ON CLUSTER ...queries. Setshow_table_uuid_in_table_create_query_if_not_niltotrueto use it. - MakeReplicatedMergeTreeengine arguments optional,/clickhouse/tables/{uuid}/{shard}/and{replica}are used by default. Closes #12135. - Minor fixes. - These changes break backward compatibility ofAtomicdatabase engine. Previously createdAtomicdatabases must be manually converted to new format. Atomic database is an experimental feature. #12343 (tavplubix).
Why it matters
This feature simplifies management ofAtomic 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.