v.24.1Improvement

Allow KILL QUERY to Cancel Backups/Restores and New Shutdown Setting in ClickHouse

Allow KILL QUERY to cancel backups / restores. This PR also makes running backups and restores visible in system.processes. Also, there is a new setting in the server configuration now - shutdown_wait_backups_and_restores (default=true) which makes the server either wait on shutdown for all running backups and restores to finish or just cancel them. #58804 (Vitaly Baranov).
Enable cancellation of backups and restores using KILL QUERY, with visibility of these operations in system.processes, and a new server setting to control shutdown behavior regarding backups and restores.

Why it matters

This feature provides users with the ability to cancel running backup and restore operations using the KILL QUERY command, improving control over long-running maintenance tasks. It also enhances monitoring by making backups and restores visible in the system.processes table. Additionally, the new shutdown_wait_backups_and_restores setting allows the server to either wait for these operations to finish on shutdown or cancel them immediately, thereby improving operational flexibility and graceful shutdown handling.

How to use it

Users can cancel ongoing backups or restores by executing the KILL QUERY command with the corresponding query ID visible in system.processes. To configure shutdown behavior, set the shutdown_wait_backups_and_restores setting in the server configuration file (default is true, which waits for backup and restore operations to complete before shutting down).