v.21.2Improvements

Fix max_number_of_merges_with_ttl_in_pool limit overrun for non-replicated MergeTree

Fix rare max_number_of_merges_with_ttl_in_pool limit overrun (more merges with TTL can be assigned) for non-replicated MergeTree. #19708 (alesapin).
Fixes a rare issue where the max_number_of_merges_with_ttl_in_pool limit could be overrun, allowing more TTL merges than configured in non-replicated MergeTree tables.

Why it matters

This fix addresses a corner case that allowed more merges with TTL (time-to-live) conditions than the configured limit max_number_of_merges_with_ttl_in_pool in non-replicated MergeTree tables. It ensures that the system correctly enforces the maximum number of concurrent TTL merges, improving stability and resource management.

How to use it

To benefit from this fix, users should upgrade to the version including this change. The configuration parameter max_number_of_merges_with_ttl_in_pool continues to control the maximum concurrent merges with TTL. No changes in usage or configuration are required.