v.23.3Improvement

Added STRICT Modifier for SYSTEM SYNC REPLICA to Wait for Replication Queue

Added an optional STRICT modifier for SYSTEM SYNC REPLICA which makes the query wait for the replication queue to become empty (just like it worked before https://github.com/ClickHouse/ClickHouse/pull/45648). #47659 (Alexander Tokmakov).
Added an optional STRICT modifier to the SYSTEM SYNC REPLICA command, enabling it to wait until the replication queue is completely empty before returning.

Why it matters

This feature restores the original behavior of SYSTEM SYNC REPLICA prior to the changes introduced in PR #45648. It ensures that users can force synchronization that waits for all replication tasks to finish, providing stronger consistency guarantees and better control over replication status.

How to use it

Use the STRICT modifier with the SYSTEM SYNC REPLICA command as follows:

SYSTEM SYNC REPLICA table_name STRICT

This will block the query until the replication queue is fully empty for the specified replica.