v.21.10Improvements

Added replication_wait_for_inactive_replica_timeout setting for handling inactive replicas in queries

Added replication_wait_for_inactive_replica_timeout setting. It allows to specify how long to wait for inactive replicas to execute ALTER/OPTIMZE/TRUNCATE query (default is 120 seconds). If replication_alter_partitions_sync is 2 and some replicas are not active for more than replication_wait_for_inactive_replica_timeout seconds, then UNFINISHED will be thrown. #27931 (tavplubix).
Added the replication_wait_for_inactive_replica_timeout setting to specify how long to wait for inactive replicas when executing ALTER, OPTIMIZE, or TRUNCATE queries on replicated tables.

Why it matters

This feature addresses the issue of long waits or indefinite blocking during ALTER, OPTIMIZE, and TRUNCATE operations in replicated tables when some replicas are inactive. It allows users to set a timeout for waiting on inactive replicas in synchronous replication mode (replication_alter_partitions_sync = 2). If inactive replicas do not become active within this timeout, an UNFINISHED exception is thrown, thus providing better control and predictability over replication-altering queries.

How to use it

Set the replication_wait_for_inactive_replica_timeout setting (default: 120 seconds) to the desired timeout value in seconds. This setting takes effect when replication_alter_partitions_sync is set to 2. If inactive replicas remain unresponsive beyond this timeout during ALTER, OPTIMIZE, or TRUNCATE queries, the query will abort with an UNFINISHED exception.