v.21.6Improvement

Respect lock_acquire_timeout_for_background_operations for OPTIMIZE queries

Respect lock_acquire_timeout_for_background_operations for OPTIMIZE queries. #23623 (Azat Khuzhin).
The OPTIMIZE queries now respect the lock_acquire_timeout_for_background_operations setting, ensuring that these operations obey the configured lock acquisition timeout.

Why it matters

This feature prevents OPTIMIZE queries from waiting indefinitely or too long to acquire necessary locks during background operations, improving system responsiveness and avoiding potential delays caused by lock contention.

How to use it

Set the lock_acquire_timeout_for_background_operations parameter to the desired timeout duration. This timeout will then be applied when executing OPTIMIZE queries, controlling how long they wait to acquire locks before timing out.