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

const MergingParams & merging_params_,
    std::unique_ptr<MergeTreeSettings> storage_settings_,
    bool has_force_restore_data_flag)
    : MergeTreeData(
        table_id_,
        relative_data_path_,
        metadata_,
        context_,
        date_column_name,
        merging_params_,
        std::move(storage_settings_),
        false,      
        attach)
    , reader(*this)
    , writer(*this)
    , merger_mutator(*this, getContext()->getMergeMutateExecutor()->getMaxTasksCount())
{
    loadDataParts(has_force_restore_data_flag);
    if (!attach && !getDataPartsForInternalUsage().empty())
        throw Exception("Data directory for table already containing data parts - probably it was unclean DROP table or manual intervention. You must either clear directory by hand or use ATTACH TABLE instead of CREATE TABLE if you need to use that parts.", ErrorCodes::INCORRECT_DATA);
    increment.set(getMaxBlockNumber());
    loadMutations();
    loadDeduplicationLog();
}
void StorageMergeTree::startup()
{
    clearOldWriteAheadLogs();
    clearEmptyParts();