**Describe the unexpected behaviour**
see steps below

**How to reproduce**
- decrease `background_pool_size` to 3 (relevantly decreasing `number_of_free_entries_in_pool_to_execute_mutation`, `number_of_free_entries_in_pool_to_lower_max_size_of_merge`)
- restart server
- increase  `background_pool_size` to 8
- SYSTEM RELOAD CONFIG
- see error log below

* Which ClickHouse server version to use
22.9

**Expected behavior**
`background_pool_size` be increased with no errors in log

**Error message and/or stacktrace**
```
2022.12.15 11:01:11.335190 [ 271 ] {} <Error> business.rdp_log_local: ReplicatedMergeTreeQueue::SelectedEntryPtr DB::StorageReplicatedMergeTree::selectQueueEntry(): Code: 49. DB::Exception: Logical error: invalid argument passed to getMaxSourcePartsSize: scheduled_tasks_count = 4 > max_count = 3. (LOGICAL_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa3dbe3a in /usr/bin/clickhouse
1. DB::Exception::Exception<unsigned long&, unsigned long&>(int, fmt::v8::basic_format_string<char, fmt::v8::type_identity<unsigned long&>::type, fmt::v8::type_identity<unsigned long&>::type>, unsigned long&, unsigned long&) @ 0xa42f7cc in /usr/bin/clickhouse
2. DB::MergeTreeDataMergerMutator::getMaxSourcePartsSizeForMerge(unsigned long, unsigned long) const @ 0x158dc048 in /usr/bin/clickhouse
3. DB::ReplicatedMergeTreeQueue::shouldExecuteLogEntry(DB::ReplicatedMergeTreeLogEntry const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, DB::MergeTreeDataMergerMutator&, DB::MergeTreeData&, std::__1::unique_lock<std::__1::mutex>&) const @ 0x15a8daed in /usr/bin/clickhouse
4. DB::ReplicatedMergeTreeQueue::selectEntryToProcess(DB::MergeTreeDataMergerMutator&, DB::MergeTreeData&) @ 0x15a90a80 in /usr/bin/clickhouse
5. DB::StorageReplicatedMergeTree::selectQueueEntry() @ 0x1553eaea in /usr/bin/clickhouse
6. DB::StorageReplicatedMergeTree::scheduleDataProcessingJob(DB::BackgroundJobsAssignee&) @ 0x1553f91f in /usr/bin/clickhouse
7. DB::BackgroundJobsAssignee::threadFunc() @ 0x15781bc7 in /usr/bin/clickhouse
8. DB::BackgroundSchedulePoolTaskInfo::execute() @ 0x13f0bd38 in /usr/bin/clickhouse
9. DB::BackgroundSchedulePool::threadFunction() @ 0x13f0e616 in /usr/bin/clickhouse
10. ? @ 0x13f0f34c in /usr/bin/clickhouse
11. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xa49fb08 in /usr/bin/clickhouse
12. ? @ 0xa4a2d1d in /usr/bin/clickhouse
13. ? @ 0x7eff93ec1609 in ?
14. clone @ 0x7eff93de6133 in ?
 (version 22.9.1.4)
2022.12.15 11:01:11.369129 [ 251 ] {} <Error> void DB::BackgroundJobsAssignee::threadFunc(): Code: 49. DB::Exception: Logical error: invalid argument passed to getMaxSourcePartsSize: scheduled_tasks_count = 4 > max_count = 3. (LOGICAL_ERROR), Stack trace (when copying this message, always include the lines below):

0. DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xa3dbe3a in /usr/bin/clickhouse
1. DB::Exception::Exception<unsigned long&, unsigned long&>(int, fmt::v8::basic_format_string<char, fmt::v8::type_identity<unsigned long&>::type, fmt::v8::type_identity<unsigned long&>::type>, unsigned long&, unsigned long&) @ 0xa42f7cc in /usr/bin/clickhouse
2. DB::MergeTreeDataMergerMutator::getMaxSourcePartsSizeForMerge(unsigned long, unsigned long) const @ 0x158dc048 in /usr/bin/clickhouse
3. DB::StorageMergeTree::selectPartsToMerge(std::__1::shared_ptr<DB::StorageInMemoryMetadata const> const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::shared_ptr<DB::RWLockImpl::LockHolderImpl>&, std::__1::unique_lock<std::__1::mutex>&, std::__1::shared_ptr<DB::MergeTreeTransaction> const&, bool, DB::SelectPartsDecision*) @ 0x155fafca in /usr/bin/clickhouse
4. DB::StorageMergeTree::scheduleDataProcessingJob(DB::BackgroundJobsAssignee&) @ 0x155fecee in /usr/bin/clickhouse
5. DB::BackgroundJobsAssignee::threadFunc() @ 0x15781bc7 in /usr/bin/clickhouse
6. DB::BackgroundSchedulePoolTaskInfo::execute() @ 0x13f0bd38 in /usr/bin/clickhouse
7. DB::BackgroundSchedulePool::threadFunction() @ 0x13f0e616 in /usr/bin/clickhouse
8. ? @ 0x13f0f34c in /usr/bin/clickhouse
9. ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xa49fb08 in /usr/bin/clickhouse
10. ? @ 0xa4a2d1d in /usr/bin/clickhouse
11. ? @ 0x7eff93ec1609 in ?
12. clone @ 0x7eff93de6133 in ?
 (version 22.9.1.4)
```

After inspecting source code for some while, the problem may resides in `src/Storages/StorageReplicatedMergeTree.h`, where  max_tasks_count of `merger_mutator`is not reconfigured.

}
        reserved_space = storage.balancedReservation(
            metadata_snapshot,
            total_size,
            max_volume_index,
            future_part->name,
            future_part->part_info,
            future_part->parts,
            &tagger,
            &ttl_infos);
        if (!reserved_space)
            reserved_space
                = storage.tryReserveSpacePreferringTTLRules(metadata_snapshot, total_size, ttl_infos, time(nullptr), max_volume_index);
    }
    if (!reserved_space)
    {
        if (is_mutation)
            throw Exception("Not enough space for mutating part '" + future_part->parts[0]->name + "'", ErrorCodes::NOT_ENOUGH_SPACE);
        else
            throw Exception("Not enough space for merging parts", ErrorCodes::NOT_ENOUGH_SPACE);
    }
    future_part->updatePath(storage, reserved_space.get());
    for (const auto & part : future_part->parts)
    {
        if (storage.currently_merging_mutating_parts.contains(part))
            throw Exception("Tagging already tagged part " + part->name + ". This is a bug.", ErrorCodes::LOGICAL_ERROR);
    }
    storage.currently_merging_mutating_parts.insert(future_part->parts.begin(), future_part->parts.end());
}
CurrentlyMergingPartsTagger::~CurrentlyMergingPartsTagger()