**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.

existing_part = getActiveContainingPart(entry.new_part_name);
        
        if (existing_part && getZooKeeper()->exists(fs::path(replica_path) / "parts" / existing_part->name))
        {
            if (!is_get_or_attach || entry.source_replica != replica_name)
                LOG_DEBUG(log, "Skipping action for part {} because part {} already exists.",
                    entry.new_part_name, existing_part->name);
            return true;
        }
    }
    if (entry.type == LogEntry::ATTACH_PART)
    {
        if (MutableDataPartPtr part = attachPartHelperFoundValidPart(entry))
        {
            LOG_TRACE(log, "Found valid local part for {}, preparing the transaction", part->name);
            Transaction transaction(*this, NO_TRANSACTION_RAW);
            part->version.setCreationTID(Tx::PrehistoricTID, nullptr);
            renameTempPartAndReplace(part, transaction);
            checkPartChecksumsAndCommit(transaction, part);
            writePartLog(PartLogElement::Type::NEW_PART, {}, 0 ,
                part->name, part, {} , nullptr);
            return true;
        }
        LOG_TRACE(log, "Didn't find valid local part for {} ({}), will fetch it from other replica",
            entry.new_part_name,
            entry.actual_new_part_name);
    }
    if (is_get_or_attach && entry.source_replica == replica_name)
        LOG_WARNING(log, "Part {} from own log doesn't exist.", entry.new_part_name);