v.21.11Improvements

Add shutdown_wait_unfinished_queries Setting for Query Wait Time Management

Add shutdown_wait_unfinished_queries server setting to allowing waiting for running queries up to shutdown_wait_unfinished time. This is for #24451. #29914 (Amos Bird).
Added the shutdown_wait_unfinished_queries server setting to allow ClickHouse to wait for running queries to finish up to the configured shutdown_wait_unfinished timeout during server shutdown.

Why it matters

This feature addresses the need to gracefully handle running queries when the ClickHouse server is shutting down, preventing abrupt termination of queries and allowing them to complete within a specified timeout period, improving data consistency and user experience.

How to use it

To enable this feature, set the shutdown_wait_unfinished_queries server setting to true and configure the shutdown_wait_unfinished timeout value. During server shutdown, ClickHouse will then wait up to the specified timeout for running queries to finish before terminating.