Symptoms: all threads in BackgroundScheduledPool busy, lot of tasks in replication queue, none of the tasks is executing. 

![Screenshot from 2021-04-16 16-21-44_](https://user-images.githubusercontent.com/1549571/115193796-e767d600-a0ec-11eb-887c-5c9c2412e50c.png)

Related to #16895

Possible workarounds (poor options): increasing the background_schedule_pool_size to huge values, or restart server every time when that happens etc. - 

std::unique_ptr<MergeTreeDeduplicationLog> deduplication_log;
    
    SimpleIncrement increment;
    
    AtomicStopwatch time_after_previous_cleanup;
    
    
    mutable std::mutex currently_processing_in_background_mutex;
    mutable std::condition_variable currently_processing_in_background_condition;
    
    
    DataParts currently_merging_mutating_parts;
    std::map<String, MergeTreeMutationEntry> current_mutations_by_id;
    std::multimap<Int64, MergeTreeMutationEntry &> current_mutations_by_version;
    std::atomic<bool> shutdown_called {false};
    void loadMutations();
    
    
    void loadDeduplicationLog();
    /** Determines what parts should be merged and merges it.
      * If aggressive - when selects parts don't takes into account their ratio size and novelty (used for OPTIMIZE query).
      * Returns true if merge is finished successfully.
      */
    bool merge(bool aggressive, const String & partition_id, bool final, bool deduplicate, const Names & deduplicate_by_columns, String * out_disable_reason = nullptr, bool optimize_skip_merged_partitions = false);
    
    
    
    MergeTreeDataPartPtr outdatePart(const String & part_name, bool force);
    ActionLock stopMergesAndWait();