It appeared in https://github.com/ClickHouse/ClickHouse/pull/33958 CI but it doesn't seem related to the changes and I couldn't reproduce it locally by running these same tests.

CI run: https://s3.amazonaws.com/clickhouse-test-reports/33958/a48b9ca349e01f9ae1b8b1abbefa1be987341d51/stateless_tests__ubsan__actions_.html

Stderr: https://s3.amazonaws.com/clickhouse-test-reports/33958/a48b9ca349e01f9ae1b8b1abbefa1be987341d51/stateless_tests__ubsan__actions_/stderr.log

UBSan error message:
```
../contrib/libcxx/include/__tree:2543:22: runtime error: downcast of misaligned address 0x000000000055 for type 'std::__tree_node<std::__value_type<std::string, std::shared_ptr<DB::ReplicatedMergeTreeLogEntry>>, void *>', which requires 8 byte alignment
0x000000000055: note: pointer points here
<memory cannot be printed>
    #0 0x209cdcb0 in std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::__lower_bound<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>*) obj-x86_64-linux-gnu/../contrib/libcxx/include/__tree:2543:22
    #1 0x209cdb09 in std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::find<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__tree:2466:20
    #2 0x209b5df8 in unsigned long std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::__erase_unique<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__tree:2442:20
    #3 0x209b5df8 in std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::erase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/map:1306:25
    #4 0x209b5df8 in DB::ReplicatedMergeTreeQueue::CurrentlyExecuting::~CurrentlyExecuting() obj-x86_64-linux-gnu/../src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp:1433:33
    #5 0x209ce2fc in std::__1::default_delete<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting>::operator()(DB::ReplicatedMergeTreeQueue::CurrentlyExecuting*) const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1397:5
    #6 0x209ce2fc in std::__1::unique_ptr<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting, std::__1::default_delete<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting> >::reset(DB::ReplicatedMergeTreeQueue::CurrentlyExecuting*) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1658:7
    #7 0x209ce2fc in std::__1::unique_ptr<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting, std::__1::default_delete<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting> >::~unique_ptr() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1612:19
    #8 0x209ce2fc in DB::ReplicatedMergeTreeQueue::SelectedEntry::~SelectedEntry() obj-x86_64-linux-gnu/../src/Storages/MergeTree/ReplicatedMergeTreeQueue.h:342:12
    #9 0x209ce2fc in std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>::destroy(DB::ReplicatedMergeTreeQueue::SelectedEntry*) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:891:15
    #10 0x209ce2fc in void std::__1::allocator_traits<std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::__destroy<DB::ReplicatedMergeTreeQueue::SelectedEntry>(std::__1::integral_constant<bool, true>, std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>&, DB::ReplicatedMergeTreeQueue::SelectedEntry*) obj-x86_64-linux-gnu/../contrib/libcxx/include/__memory/allocator_traits.h:539:21
    #11 0x209ce2fc in void std::__1::allocator_traits<std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::destroy<DB::ReplicatedMergeTreeQueue::SelectedEntry>(std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>&, DB::ReplicatedMergeTreeQueue::SelectedEntry*) obj-x86_64-linux-gnu/../contrib/libcxx/include/__memory/allocator_traits.h:487:14
    #12 0x209ce2fc in std::__1::__shared_ptr_emplace<DB::ReplicatedMergeTreeQueue::SelectedEntry, std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::__on_zero_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2611:9
    #13 0xe6bdb75 in std::__1::__shared_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2475:9
    #14 0xe6bdaa4 in std::__1::__shared_weak_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517:27
    #15 0x206e520d in DB::MergeFromLogEntryTask::~MergeFromLogEntryTask() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeFromLogEntryTask.h:16:7
    #16 0x2042976d in std::__1::default_delete<DB::MergeFromLogEntryTask>::operator()(DB::MergeFromLogEntryTask*) const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1397:5
    #17 0x2042976d in std::__1::__shared_ptr_pointer<DB::MergeFromLogEntryTask*, std::__1::shared_ptr<DB::MergeFromLogEntryTask>::__shared_ptr_default_delete<DB::MergeFromLogEntryTask, DB::MergeFromLogEntryTask>, std::__1::allocator<DB::MergeFromLogEntryTask> >::__on_zero_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2565:5
    #18 0xe6bdb75 in std::__1::__shared_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2475:9
    #19 0xe6bdaa4 in std::__1::__shared_weak_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517:27
    #20 0xe6bdb75 in std::__1::__shared_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2475:9
    #21 0xe6bda3d in std::__1::__shared_weak_count::__release_shared() obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517:27
    #22 0x20722e60 in DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(std::__1::shared_ptr<DB::TaskRuntimeData>)::'lambda'()::~() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:77:30
    #23 0x20722e60 in DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(std::__1::shared_ptr<DB::TaskRuntimeData>) obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:150:1
    #24 0x207232b0 in DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::threadFunction() obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:176:13
    #25 0xe779b98 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #26 0xe779b98 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #27 0xe779b98 in ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #28 0xe77d447 in void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #29 0xe77d447 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke_constexpr<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3682:1
    #30 0xe77d447 in decltype(auto) std::__1::__apply_tuple_impl<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&, std::__1::tuple<>&>(void&&, std::__1::tuple<>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1415:1
    #31 0xe77d447 in decltype(auto) std::__1::apply<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&, std::__1::tuple<>&>(void&&, std::__1::tuple<>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/tuple:1424:1
    #32 0xe77d447 in ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()::operator()() obj-x86_64-linux-gnu/../src/Common/ThreadPool.h:188:13
    #33 0xe778539 in std::__1::__function::__policy_func<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16
    #34 0xe778539 in std::__1::function<void ()>::operator()() const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12
    #35 0xe778539 in ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:274:17
    #36 0xe77b0e1 in void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()::operator()() const obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:139:73
    #37 0xe77b0e1 in decltype(std::__1::forward<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1
    #38 0xe77b0e1 in void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>&, std::__1::__tuple_indices<>) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:280:5
    #39 0xe77b0e1 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) obj-x86_64-linux-gnu/../contrib/libcxx/include/thread:291:5
    #40 0x7f3719247608 in start_thread (/lib/x86_64-linux-gnu/libpthread.so.0+0x9608)
    #41 0x7f371916e292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../contrib/libcxx/include/__tree:2543:22 in 
```

CH error:
```
2022.01.25 12:28:17.363604 [ 242573 ] {} <Fatal> BaseDaemon: ########################################
2022.01.25 12:28:17.363635 [ 242573 ] {} <Fatal> BaseDaemon: (version 22.2.1.3246, build id: CBDB113AD207E3F3) (from thread 390) (no query) Received signal Unknown signal (-3)
2022.01.25 12:28:17.363646 [ 242573 ] {} <Fatal> BaseDaemon: Sanitizer trap.
2022.01.25 12:28:17.363673 [ 242573 ] {} <Fatal> BaseDaemon: Stack trace: 0xe6d558a 0x1eb1af71 0xe695e56 0xe6a281f 0x209cdcb1 0x209cdb0a 0x209b5df9 0x209ce2fd 0xe6bdb76 0xe6bdaa5 0x206e520e 0x2042976e 0xe6bdb76 0xe6bdaa5 0xe6bdb76 0xe6bda3e 0x20722e61 0x207232b1 0xe779b99 0xe77d448 0xe77853a 0xe77b0e2 0x7f3719247609 0x7f371916e293
2022.01.25 12:28:17.371653 [ 242573 ] {} <Fatal> BaseDaemon: 0.1. inlined from ./obj-x86_64-linux-gnu/../src/Common/StackTrace.cpp:305: StackTrace::tryCapture()
2022.01.25 12:28:17.371671 [ 242573 ] {} <Fatal> BaseDaemon: 0. ../src/Common/StackTrace.cpp:266: StackTrace::StackTrace() @ 0xe6d558a in /usr/bin/clickhouse
2022.01.25 12:28:17.389134 [ 242573 ] {} <Fatal> BaseDaemon: 1. ./obj-x86_64-linux-gnu/../base/daemon/BaseDaemon.cpp:392: sanitizerDeathCallback() @ 0x1eb1af71 in /usr/bin/clickhouse
2022.01.25 12:28:18.243362 [ 242573 ] {} <Fatal> BaseDaemon: 2. __sanitizer::Die() @ 0xe695e56 in /usr/bin/clickhouse
2022.01.25 12:28:19.104127 [ 242573 ] {} <Fatal> BaseDaemon: 3. ? @ 0xe6a281f in /usr/bin/clickhouse
2022.01.25 12:28:19.193385 [ 242573 ] {} <Fatal> BaseDaemon: 4. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/__tree:0: std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::__lower_bound<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>*) @ 0x209cdcb1 in /usr/bin/clickhouse
2022.01.25 12:28:19.267029 [ 242573 ] {} <Fatal> BaseDaemon: 5.1. inlined from ./obj-x86_64-linux-gnu/../contrib/libcxx/include/__tree:861: std::__1::operator==(std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> const&, std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> const&)
2022.01.25 12:28:19.267071 [ 242573 ] {} <Fatal> BaseDaemon: 5.2. inlined from ../contrib/libcxx/include/__tree:864: std::__1::operator!=(std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> const&, std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> const&)
2022.01.25 12:28:19.267086 [ 242573 ] {} <Fatal> BaseDaemon: 5. ../contrib/libcxx/include/__tree:2467: std::__1::__tree_iterator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*>*, long> std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::find<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0x209cdb0a in /usr/bin/clickhouse
2022.01.25 12:28:19.337758 [ 242573 ] {} <Fatal> BaseDaemon: 6.1. inlined from ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1243: std::__1::__compressed_pair_elem<std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>, 0, false>::__get()
2022.01.25 12:28:19.337794 [ 242573 ] {} <Fatal> BaseDaemon: 6.2. inlined from ../contrib/libcxx/include/memory:1329: std::__1::__compressed_pair<std::__1::__tree_end_node<std::__1::__tree_node_base<void*>*>, std::__1::allocator<std::__1::__tree_node<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, void*> > >::first()
2022.01.25 12:28:19.337814 [ 242573 ] {} <Fatal> BaseDaemon: 6.3. inlined from ../contrib/libcxx/include/__tree:1038: std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::__end_node()
2022.01.25 12:28:19.337845 [ 242573 ] {} <Fatal> BaseDaemon: 6.4. inlined from ../contrib/libcxx/include/__tree:1117: std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::end()
2022.01.25 12:28:19.337865 [ 242573 ] {} <Fatal> BaseDaemon: 6.5. inlined from ../contrib/libcxx/include/__tree:2443: unsigned long std::__1::__tree<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::__map_value_compare<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::__erase_unique<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
2022.01.25 12:28:19.337884 [ 242573 ] {} <Fatal> BaseDaemon: 6.6. inlined from ../contrib/libcxx/include/map:1306: std::__1::map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry>, std::__1::less<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const, std::__1::shared_ptr<DB::ReplicatedMergeTreeLogEntry> > > >::erase(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
2022.01.25 12:28:19.337896 [ 242573 ] {} <Fatal> BaseDaemon: 6. ../src/Storages/MergeTree/ReplicatedMergeTreeQueue.cpp:1433: DB::ReplicatedMergeTreeQueue::CurrentlyExecuting::~CurrentlyExecuting() @ 0x209b5df9 in /usr/bin/clickhouse
2022.01.25 12:28:19.423153 [ 242573 ] {} <Fatal> BaseDaemon: 7.1. inlined from ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:1397: std::__1::default_delete<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting>::operator()(DB::ReplicatedMergeTreeQueue::CurrentlyExecuting*) const
2022.01.25 12:28:19.423204 [ 242573 ] {} <Fatal> BaseDaemon: 7.2. inlined from ../contrib/libcxx/include/memory:1658: std::__1::unique_ptr<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting, std::__1::default_delete<DB::ReplicatedMergeTreeQueue::CurrentlyExecuting> >::reset(DB::ReplicatedMergeTreeQueue::CurrentlyExecuting*)
2022.01.25 12:28:19.423246 [ 242573 ] {} <Fatal> BaseDaemon: 7.3. inlined from ../contrib/libcxx/include/memory:1612: ~unique_ptr
2022.01.25 12:28:19.423265 [ 242573 ] {} <Fatal> BaseDaemon: 7.4. inlined from ../src/Storages/MergeTree/ReplicatedMergeTreeQueue.h:342: ~SelectedEntry
2022.01.25 12:28:19.423293 [ 242573 ] {} <Fatal> BaseDaemon: 7.5. inlined from ../contrib/libcxx/include/memory:891: std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>::destroy(DB::ReplicatedMergeTreeQueue::SelectedEntry*)
2022.01.25 12:28:19.423309 [ 242573 ] {} <Fatal> BaseDaemon: 7.6. inlined from ../contrib/libcxx/include/__memory/allocator_traits.h:539: void std::__1::allocator_traits<std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::__destroy<DB::ReplicatedMergeTreeQueue::SelectedEntry>(std::__1::integral_constant<bool, true>, std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>&, DB::ReplicatedMergeTreeQueue::SelectedEntry*)
2022.01.25 12:28:19.423326 [ 242573 ] {} <Fatal> BaseDaemon: 7.7. inlined from ../contrib/libcxx/include/__memory/allocator_traits.h:487: void std::__1::allocator_traits<std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::destroy<DB::ReplicatedMergeTreeQueue::SelectedEntry>(std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry>&, DB::ReplicatedMergeTreeQueue::SelectedEntry*)
2022.01.25 12:28:19.423345 [ 242573 ] {} <Fatal> BaseDaemon: 7. ../contrib/libcxx/include/memory:2611: std::__1::__shared_ptr_emplace<DB::ReplicatedMergeTreeQueue::SelectedEntry, std::__1::allocator<DB::ReplicatedMergeTreeQueue::SelectedEntry> >::__on_zero_shared() @ 0x209ce2fd in /usr/bin/clickhouse
2022.01.25 12:28:19.437988 [ 242573 ] {} <Fatal> BaseDaemon: 8. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2474: std::__1::__shared_count::__release_shared() @ 0xe6bdb76 in /usr/bin/clickhouse
2022.01.25 12:28:19.450863 [ 242573 ] {} <Fatal> BaseDaemon: 9. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517: std::__1::__shared_weak_count::__release_shared() @ 0xe6bdaa5 in /usr/bin/clickhouse
2022.01.25 12:28:19.469671 [ 242573 ] {} <Fatal> BaseDaemon: 10. ./obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeFromLogEntryTask.h:16: DB::MergeFromLogEntryTask::~MergeFromLogEntryTask() @ 0x206e520e in /usr/bin/clickhouse
2022.01.25 12:28:19.682020 [ 242573 ] {} <Fatal> BaseDaemon: 11. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2566: std::__1::__shared_ptr_pointer<DB::MergeFromLogEntryTask*, std::__1::shared_ptr<DB::MergeFromLogEntryTask>::__shared_ptr_default_delete<DB::MergeFromLogEntryTask, DB::MergeFromLogEntryTask>, std::__1::allocator<DB::MergeFromLogEntryTask> >::__on_zero_shared() @ 0x2042976e in /usr/bin/clickhouse
2022.01.25 12:28:19.694965 [ 242573 ] {} <Fatal> BaseDaemon: 12. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2474: std::__1::__shared_count::__release_shared() @ 0xe6bdb76 in /usr/bin/clickhouse
2022.01.25 12:28:19.707715 [ 242573 ] {} <Fatal> BaseDaemon: 13. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517: std::__1::__shared_weak_count::__release_shared() @ 0xe6bdaa5 in /usr/bin/clickhouse
2022.01.25 12:28:19.720459 [ 242573 ] {} <Fatal> BaseDaemon: 14. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2474: std::__1::__shared_count::__release_shared() @ 0xe6bdb76 in /usr/bin/clickhouse
2022.01.25 12:28:19.733931 [ 242573 ] {} <Fatal> BaseDaemon: 15. ./obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2517: std::__1::__shared_weak_count::__release_shared() @ 0xe6bda3e in /usr/bin/clickhouse
2022.01.25 12:28:19.742836 [ 242573 ] {} <Fatal> BaseDaemon: 16.1. inlined from ./obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:0: ~
2022.01.25 12:28:19.742861 [ 242573 ] {} <Fatal> BaseDaemon: 16. ../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:150: DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(std::__1::shared_ptr<DB::TaskRuntimeData>) @ 0x20722e61 in /usr/bin/clickhouse
2022.01.25 12:28:19.751757 [ 242573 ] {} <Fatal> BaseDaemon: 17. ./obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:177: DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::threadFunction() @ 0x207232b1 in /usr/bin/clickhouse
2022.01.25 12:28:19.762377 [ 242573 ] {} <Fatal> BaseDaemon: 18.1. inlined from ./obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2533: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.01.25 12:28:19.762400 [ 242573 ] {} <Fatal> BaseDaemon: 18. ../src/Common/ThreadPool.cpp:277: ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0xe779b99 in /usr/bin/clickhouse
2022.01.25 12:28:19.771177 [ 242573 ] {} <Fatal> BaseDaemon: 19. ./obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:0: ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&, void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()&&...)::'lambda'()::operator()() @ 0xe77d448 in /usr/bin/clickhouse
2022.01.25 12:28:19.780906 [ 242573 ] {} <Fatal> BaseDaemon: 20.1. inlined from ./obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2533: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.01.25 12:28:19.780924 [ 242573 ] {} <Fatal> BaseDaemon: 20. ../src/Common/ThreadPool.cpp:277: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0xe77853a in /usr/bin/clickhouse
2022.01.25 12:28:19.792294 [ 242573 ] {} <Fatal> BaseDaemon: 21. ./obj-x86_64-linux-gnu/../src/Common/ThreadPool.cpp:0: void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()> >(void*) @ 0xe77b0e2 in /usr/bin/clickhouse
2022.01.25 12:28:19.792318 [ 242573 ] {} <Fatal> BaseDaemon: 22. ? @ 0x7f3719247609 in ?
2022.01.25 12:28:19.792330 [ 242573 ] {} <Fatal> BaseDaemon: 23. clone @ 0x7f371916e293 in ?
2022.01.25 12:28:20.048797 [ 242573 ] {} <Fatal> BaseDaemon: Calculated checksum of the binary: 0B6C984AB34C1DC6F2804859892DB93B. There is no information about the reference checksum.
```

{
    std::lock_guard lock(mutex);
    
    if (new_threads_count < threads_count)
    {
        LOG_WARNING(log, "Loaded new threads count for {}Executor from top level config, but new value ({}) is not greater than current {}", name, new_threads_count, threads_count);
        return;
    }
    if (new_max_tasks_count < max_tasks_count)
    {
        LOG_WARNING(log, "Loaded new max tasks count for {}Executor from top level config, but new value ({}) is not greater than current {}", name, new_max_tasks_count, max_tasks_count);
        return;
    }
    LOG_INFO(log, "Loaded new threads count ({}) and max tasks count ({}) for {}Executor", new_threads_count, new_max_tasks_count, name);
    pending.setCapacity(new_max_tasks_count);
    active.set_capacity(new_max_tasks_count);
    pool.setMaxThreads(std::max(1UL, new_threads_count));
    pool.setMaxFreeThreads(std::max(1UL, new_threads_count));
    pool.setQueueSize(std::max(1UL, new_threads_count));
    for (size_t number = threads_count; number < new_threads_count; ++number)
        pool.scheduleOrThrowOnError([this] { threadFunction(); });
    max_tasks_count = new_max_tasks_count;
    threads_count = new_threads_count;
}
template <class Queue>
size_t MergeTreeBackgroundExecutor<Queue>::getMaxTasksCount() const