v.21.10Improvements
Added replication_wait_for_inactive_replica_timeout setting for handling inactive replicas in queries
Addedreplication_wait_for_inactive_replica_timeoutsetting. It allows to specify how long to wait for inactive replicas to executeALTER/OPTIMZE/TRUNCATEquery (default is 120 seconds). Ifreplication_alter_partitions_syncis 2 and some replicas are not active for more thanreplication_wait_for_inactive_replica_timeoutseconds, thenUNFINISHEDwill be thrown. #27931 (tavplubix).
Why it matters
This feature addresses the issue of long waits or indefinite blocking duringALTER, 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 thereplication_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.