v.23.7Improvement

Introduce wait_for_unique_parts_send_before_shutdown_ms and Fix Shutdown Order for Tables and Handlers

Introduce a table setting wait_for_unique_parts_send_before_shutdown_ms which specify the amount of time replica will wait before closing interserver handler for replicated sends. Also fix inconsistency with shutdown of tables and interserver handlers: now server shutdown tables first and only after it shut down interserver handlers. #51851 (alesapin).
Introduces a new table setting wait_for_unique_parts_send_before_shutdown_ms that controls how long a replica waits before closing the interserver handler for replicated sends during shutdown. Also resolves inconsistencies by ensuring tables shut down before interserver handlers.

Why it matters

This feature addresses the problem of replicas potentially closing replication communication channels too early during server shutdown, which could interrupt data synchronization. By specifying a wait time, it helps ensure all unique parts are properly sent before shutdown, improving replication reliability and consistency.

How to use it

To apply this feature, set the wait_for_unique_parts_send_before_shutdown_ms table setting with the desired wait time in milliseconds. This setting governs the replica's wait period before closing the interserver handler during shutdown, ensuring smooth replication termination.