v.21.1Improvements

Use shard and replica names from Replicated database arguments in ReplicatedMergeTree macros

Use shard and replica name from Replicated database arguments when expanding macros in ReplicatedMergeTree arguments if these macros are not defined in config. Closes #31471. #31488 (tavplubix).
Enable using shard and replica names from Replicated database arguments as macros in ReplicatedMergeTree table arguments when these macros are not defined in the configuration file.

Why it matters

This feature resolves the issue where users had to explicitly define shard and replica macros in the configuration to use them in ReplicatedMergeTree table arguments. By automatically expanding these macros from the Replicated database arguments, it simplifies setup and avoids configuration duplication, improving usability and reducing errors.

How to use it

When creating or altering ReplicatedMergeTree tables inside a Replicated database, simply omit defining shard and replica macros in the config file. The system will automatically use shard and replica names provided in the Replicated database arguments to expand macros in the table's replication arguments.