https://s3.amazonaws.com/clickhouse-test-reports/42362/80867cb1fe616607ee985ab429113045f0a2e1f3/integration_tests__tsan__[2/4].html
```
WARNING: ThreadSanitizer: data race (pid=1)
  Write of size 8 at 0x7b8c000038f8 by main thread (mutexes: write M0):
    #0 std::__1::enable_if<is_move_constructible<zkutil::ZooKeeper*>::value && is_move_assignable<zkutil::ZooKeeper*>::value, void>::type std::__1::swap<zkutil::ZooKeeper*>(zkutil::ZooKeeper*&, zkutil::ZooKeeper*&) build_docker/../contrib/libcxx/include/__utility/swap.h:37:7 (clickhouse+0x1b6c826e) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::shared_ptr<zkutil::ZooKeeper>::swap(std::__1::shared_ptr<zkutil::ZooKeeper>&) build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:762:9 (clickhouse+0x1b6c826e)
    #2 std::__1::shared_ptr<zkutil::ZooKeeper>::reset() build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:769:22 (clickhouse+0x1b6c826e)
    #3 DB::ContextSharedPart::shutdown() build_docker/../src/Interpreters/Context.cpp:508:23 (clickhouse+0x1b6c826e)
    #4 DB::Context::shutdown() build_docker/../src/Interpreters/Context.cpp:2975:13 (clickhouse+0x1b6ba807) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #5 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)::$_10::operator()() const build_docker/../programs/server/Server.cpp:1488:5 (clickhouse+0x1330dd29) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #6 BasicScopeGuard<DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)::$_10>::invoke() build_docker/../base/base/scope_guard.h:99:9 (clickhouse+0x1330dd29)
    #7 BasicScopeGuard<DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&)::$_10>::~BasicScopeGuard() build_docker/../base/base/scope_guard.h:48:26 (clickhouse+0x1330dd29)
    #8 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_docker/../programs/server/Server.cpp:1851:1 (clickhouse+0x133041e5) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #9 Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x20bc5fbd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #10 DB::Server::run() build_docker/../programs/server/Server.cpp:481:25 (clickhouse+0x132f0f60) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #11 Poco::Util::ServerApplication::run(int, char**) build_docker/../contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x20be54d6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #12 mainEntryClickHouseServer(int, char**) build_docker/../programs/server/Server.cpp:187:20 (clickhouse+0x132edef4) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #13 main build_docker/../programs/main.cpp:482:12 (clickhouse+0xb968dcc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)

  Previous write of size 8 at 0x7b8c000038f8 by thread T190 (mutexes: write M1, write M2):
    #0 std::__1::enable_if<is_move_constructible<zkutil::ZooKeeper*>::value && is_move_assignable<zkutil::ZooKeeper*>::value, void>::type std::__1::swap<zkutil::ZooKeeper*>(zkutil::ZooKeeper*&, zkutil::ZooKeeper*&) build_docker/../contrib/libcxx/include/__utility/swap.h:37:7 (clickhouse+0x1b6af939) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::shared_ptr<zkutil::ZooKeeper>::swap(std::__1::shared_ptr<zkutil::ZooKeeper>&) build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:762:9 (clickhouse+0x1b6af939)
    #2 std::__1::shared_ptr<zkutil::ZooKeeper>::operator=(std::__1::shared_ptr<zkutil::ZooKeeper>&&) build_docker/../contrib/libcxx/include/__memory/shared_ptr.h:724:38 (clickhouse+0x1b6af939)
    #3 DB::Context::getZooKeeper() const build_docker/../src/Interpreters/Context.cpp:2064:27 (clickhouse+0x1b6af939)
    #4 DB::DDLWorker::getAndSetZooKeeper() build_docker/../src/Interpreters/DDLWorker.cpp:152:38 (clickhouse+0x1b72d3ff) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #5 DB::DDLWorker::initializeMainThread() build_docker/../src/Interpreters/DDLWorker.cpp:1030:30 (clickhouse+0x1b73e99e) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #6 DB::DDLWorker::runMainThread() build_docker/../src/Interpreters/DDLWorker.cpp:1087:22 (clickhouse+0x1b72b2e6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 decltype(*static_cast<DB::DDLWorker*&>(fp0).*fp()) std::__1::__invoke_constexpr<void (DB::DDLWorker::*&)(), DB::DDLWorker*&, void>(void (DB::DDLWorker::*&)(), DB::DDLWorker*&) build_docker/../contrib/libcxx/include/type_traits:3574:23 (clickhouse+0x1b7411ef) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 decltype(auto) std::__1::__apply_tuple_impl<void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&, 0ul>(void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&, std::__1::__tuple_indices<0ul>) build_docker/../contrib/libcxx/include/tuple:1595:1 (clickhouse+0x1b7411ef)
    #9 decltype(auto) std::__1::apply<void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&>(void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&) build_docker/../contrib/libcxx/include/tuple:1604:1 (clickhouse+0x1b7411ef)
    #10 ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()::operator()() build_docker/../src/Common/ThreadPool.h:193:13 (clickhouse+0x1b7411ef)
    #11 decltype(static_cast<void (DB::DDLWorker::*>(fp)(static_cast<DB::DDLWorker*>(fp0))) std::__1::__invoke<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&) build_docker/../contrib/libcxx/include/type_traits:3640:23 (clickhouse+0x1b7411ef)
    #12 void std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&>(ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&) build_docker/../contrib/libcxx/include/__functional/invoke.h:61:9 (clickhouse+0x1b741141) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #13 std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'(), void ()>::operator()() build_docker/../contrib/libcxx/include/__functional/function.h:230:12 (clickhouse+0x1b741141)
    #14 void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'(), void ()>>(std::__1::__function::__policy_storage const*) build_docker/../contrib/libcxx/include/__functional/function.h:711:16 (clickhouse+0x1b741141)
    #15 std::__1::__function::__policy_func<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:843:16 (clickhouse+0x1332bcee) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #16 std::__1::function<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:1184:12 (clickhouse+0x1332bcee)
    #17 ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) build_docker/../src/Common/ThreadPool.cpp:294:17 (clickhouse+0x1332bcee)
    #18 void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()::operator()() const build_docker/../src/Common/ThreadPool.cpp:144:73 (clickhouse+0x133302f1) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #19 decltype(static_cast<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&) build_docker/../contrib/libcxx/include/type_traits:3640:23 (clickhouse+0x133302f1)
    #20 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>, bool)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()>&, std::__1::__tuple_indices<>) build_docker/../contrib/libcxx/include/thread:282:5 (clickhouse+0x133302f1)
    #21 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>, bool)::'lambda0'()>>(void*) build_docker/../contrib/libcxx/include/thread:293:5 (clickhouse+0x133302f1)

  Location is heap block of size 7008 at 0x7b8c00003800 allocated by main thread:
    #0 operator new(unsigned long) <null> (clickhouse+0xb967406) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::__unique_if<DB::ContextSharedPart>::__unique_single std::__1::make_unique<DB::ContextSharedPart>() build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:725:28 (clickhouse+0x1b69a3fc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #2 DB::Context::createShared() build_docker/../src/Interpreters/Context.cpp:591:32 (clickhouse+0x1b69a3fc)
    #3 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_docker/../programs/server/Server.cpp:703:27 (clickhouse+0x132f3247) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #4 Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x20bc5fbd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #5 DB::Server::run() build_docker/../programs/server/Server.cpp:481:25 (clickhouse+0x132f0f60) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #6 Poco::Util::ServerApplication::run(int, char**) build_docker/../contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x20be54d6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 mainEntryClickHouseServer(int, char**) build_docker/../programs/server/Server.cpp:187:20 (clickhouse+0x132edef4) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 main build_docker/../programs/main.cpp:482:12 (clickhouse+0xb968dcc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)

  Mutex M0 (0x7b8c00003808) created at:
    #0 pthread_mutex_init <null> (clickhouse+0xb8e928f) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::__libcpp_recursive_mutex_init(pthread_mutex_t*) build_docker/../contrib/libcxx/include/__threading_support:268:10 (clickhouse+0x245c9b04) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #2 std::__1::recursive_mutex::recursive_mutex() build_docker/../contrib/libcxx/src/mutex.cpp:56:14 (clickhouse+0x245c9b04)
    #3 DB::ContextSharedPart::ContextSharedPart() build_docker/../src/Interpreters/Context.cpp:310:5 (clickhouse+0x1b6d557c) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #4 std::__1::__unique_if<DB::ContextSharedPart>::__unique_single std::__1::make_unique<DB::ContextSharedPart>() build_docker/../contrib/libcxx/include/__memory/unique_ptr.h:725:32 (clickhouse+0x1b69a407) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #5 DB::Context::createShared() build_docker/../src/Interpreters/Context.cpp:591:32 (clickhouse+0x1b69a407)
    #6 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_docker/../programs/server/Server.cpp:703:27 (clickhouse+0x132f3247) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x20bc5fbd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 DB::Server::run() build_docker/../programs/server/Server.cpp:481:25 (clickhouse+0x132f0f60) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #9 Poco::Util::ServerApplication::run(int, char**) build_docker/../contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x20be54d6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #10 mainEntryClickHouseServer(int, char**) build_docker/../programs/server/Server.cpp:187:20 (clickhouse+0x132edef4) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #11 main build_docker/../programs/main.cpp:482:12 (clickhouse+0xb968dcc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)

  Mutex M1 (0x7b5000003a68) created at:
    #0 pthread_mutex_lock <null> (clickhouse+0xb90579a) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::__libcpp_mutex_lock(pthread_mutex_t*) build_docker/../contrib/libcxx/include/__threading_support:303:10 (clickhouse+0x245c99f9) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #2 std::__1::mutex::lock() build_docker/../contrib/libcxx/src/mutex.cpp:33:14 (clickhouse+0x245c99f9)
    #3 std::__1::lock_guard<std::__1::mutex>::lock_guard(std::__1::mutex&) build_docker/../contrib/libcxx/include/__mutex_base:91:27 (clickhouse+0x1b72d3c5) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #4 DB::DDLWorker::getAndSetZooKeeper() build_docker/../src/Interpreters/DDLWorker.cpp:149:21 (clickhouse+0x1b72d3c5)
    #5 DB::DDLWorker::initializeMainThread() build_docker/../src/Interpreters/DDLWorker.cpp:1030:30 (clickhouse+0x1b73e99e) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #6 DB::DDLWorker::runMainThread() build_docker/../src/Interpreters/DDLWorker.cpp:1087:22 (clickhouse+0x1b72b2e6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 decltype(*static_cast<DB::DDLWorker*&>(fp0).*fp()) std::__1::__invoke_constexpr<void (DB::DDLWorker::*&)(), DB::DDLWorker*&, void>(void (DB::DDLWorker::*&)(), DB::DDLWorker*&) build_docker/../contrib/libcxx/include/type_traits:3574:23 (clickhouse+0x1b7411ef) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 decltype(auto) std::__1::__apply_tuple_impl<void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&, 0ul>(void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&, std::__1::__tuple_indices<0ul>) build_docker/../contrib/libcxx/include/tuple:1595:1 (clickhouse+0x1b7411ef)
    #9 decltype(auto) std::__1::apply<void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&>(void (DB::DDLWorker::*&)(), std::__1::tuple<DB::DDLWorker*>&) build_docker/../contrib/libcxx/include/tuple:1604:1 (clickhouse+0x1b7411ef)
    #10 ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()::operator()() build_docker/../src/Common/ThreadPool.h:193:13 (clickhouse+0x1b7411ef)
    #11 decltype(static_cast<void (DB::DDLWorker::*>(fp)(static_cast<DB::DDLWorker*>(fp0))) std::__1::__invoke<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&) build_docker/../contrib/libcxx/include/type_traits:3640:23 (clickhouse+0x1b7411ef)
    #12 void std::__1::__invoke_void_return_wrapper<void, true>::__call<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&>(ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'()&) build_docker/../contrib/libcxx/include/__functional/invoke.h:61:9 (clickhouse+0x1b741141) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #13 std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'(), void ()>::operator()() build_docker/../contrib/libcxx/include/__functional/function.h:230:12 (clickhouse+0x1b741141)
    #14 void std::__1::__function::__policy_invoker<void ()>::__call_impl<std::__1::__function::__default_alloc_func<ThreadFromGlobalPoolImpl<true>::ThreadFromGlobalPoolImpl<void (DB::DDLWorker::*)(), DB::DDLWorker*>(void (DB::DDLWorker::*&&)(), DB::DDLWorker*&&)::'lambda'(), void ()>>(std::__1::__function::__policy_storage const*) build_docker/../contrib/libcxx/include/__functional/function.h:711:16 (clickhouse+0x1b741141)
    #15 std::__1::__function::__policy_func<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:843:16 (clickhouse+0x1332bcee) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #16 std::__1::function<void ()>::operator()() const build_docker/../contrib/libcxx/include/__functional/function.h:1184:12 (clickhouse+0x1332bcee)
    #17 ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) build_docker/../src/Common/ThreadPool.cpp:294:17 (clickhouse+0x1332bcee)
    #18 void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()::operator()() const build_docker/../src/Common/ThreadPool.cpp:144:73 (clickhouse+0x133302f1) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #19 decltype(static_cast<void>(fp)()) std::__1::__invoke<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&) build_docker/../contrib/libcxx/include/type_traits:3640:23 (clickhouse+0x133302f1)
    #20 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>, bool)::'lambda0'()>(std::__1::tuple<void, void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()>&, std::__1::__tuple_indices<>) build_docker/../contrib/libcxx/include/thread:282:5 (clickhouse+0x133302f1)
    #21 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>, bool)::'lambda0'()>>(void*) build_docker/../contrib/libcxx/include/thread:293:5 (clickhouse+0x133302f1)

  Mutex M2 (0x7b8c000038d0) created at:
    #0 pthread_mutex_lock <null> (clickhouse+0xb90579a) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::__libcpp_mutex_lock(pthread_mutex_t*) build_docker/../contrib/libcxx/include/__threading_support:303:10 (clickhouse+0x245c99f9) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #2 std::__1::mutex::lock() build_docker/../contrib/libcxx/src/mutex.cpp:33:14 (clickhouse+0x245c99f9)
    #3 std::__1::lock_guard<std::__1::mutex>::lock_guard(std::__1::mutex&) build_docker/../contrib/libcxx/include/__mutex_base:91:27 (clickhouse+0x1b6b177a) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #4 DB::Context::setSystemZooKeeperLogAfterInitializationIfNeeded() build_docker/../src/Interpreters/Context.cpp:2147:21 (clickhouse+0x1b6b177a)
    #5 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_docker/../programs/server/Server.cpp:1580:25 (clickhouse+0x13301631) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #6 Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x20bc5fbd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 DB::Server::run() build_docker/../programs/server/Server.cpp:481:25 (clickhouse+0x132f0f60) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 Poco::Util::ServerApplication::run(int, char**) build_docker/../contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x20be54d6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #9 mainEntryClickHouseServer(int, char**) build_docker/../programs/server/Server.cpp:187:20 (clickhouse+0x132edef4) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #10 main build_docker/../programs/main.cpp:482:12 (clickhouse+0xb968dcc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)

  Thread T190 'DDLWorker' (tid=197, running) created by main thread at:
    #0 pthread_create <null> (clickhouse+0xb8e7abd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #1 std::__1::__libcpp_thread_create(unsigned long*, void* (*)(void*), void*) build_docker/../contrib/libcxx/include/__threading_support:375:10 (clickhouse+0x1332fbfb) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #2 std::__1::thread::thread<void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'(), void>(void&&) build_docker/../contrib/libcxx/include/thread:309:16 (clickhouse+0x1332fbfb)
    #3 void ThreadPoolImpl<std::__1::thread>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool) build_docker/../src/Common/ThreadPool.cpp:144:35 (clickhouse+0x1332a619) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #4 ThreadPoolImpl<std::__1::thread>::scheduleOrThrow(std::__1::function<void ()>, int, unsigned long, bool) build_docker/../src/Common/ThreadPool.cpp:180:5 (clickhouse+0x13332825) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #5 ThreadFromGlobalPoolImpl<false>::ThreadFromGlobalPoolImpl<void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool)::'lambda0'()>(void&&) build_docker/../src/Common/ThreadPool.h:176:38 (clickhouse+0x13332825)
    #6 void ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>, bool) build_docker/../src/Common/ThreadPool.cpp:144:35 (clickhouse+0x1332ce26) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #7 ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>::scheduleOrThrowOnError(std::__1::function<void ()>, int) build_docker/../src/Common/ThreadPool.cpp:168:5 (clickhouse+0x1332ca85) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #8 DB::DatabaseOrdinary::startupTables(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, DB::LoadingStrictnessLevel) build_docker/../src/Databases/DatabaseOrdinary.cpp:279:25 (clickhouse+0x1b0020f5) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #9 DB::DatabaseAtomic::startupTables(ThreadPoolImpl<ThreadFromGlobalPoolImpl<false>>&, DB::LoadingStrictnessLevel) build_docker/../src/Databases/DatabaseAtomic.cpp:453:23 (clickhouse+0x1aff77ec) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #10 DB::startupSystemTables() build_docker/../src/Interpreters/loadMetadata.cpp:427:54 (clickhouse+0x1c313aa3) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #11 DB::Server::main(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) build_docker/../programs/server/Server.cpp:1592:9 (clickhouse+0x13301a06) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #12 Poco::Util::Application::run() build_docker/../contrib/poco/Util/src/Application.cpp:334:8 (clickhouse+0x20bc5fbd) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #13 DB::Server::run() build_docker/../programs/server/Server.cpp:481:25 (clickhouse+0x132f0f60) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #14 Poco::Util::ServerApplication::run(int, char**) build_docker/../contrib/poco/Util/src/ServerApplication.cpp:611:9 (clickhouse+0x20be54d6) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #15 mainEntryClickHouseServer(int, char**) build_docker/../programs/server/Server.cpp:187:20 (clickhouse+0x132edef4) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)
    #16 main build_docker/../programs/main.cpp:482:12 (clickhouse+0xb968dcc) (BuildId: 3ac312d7eb4dee3919b34cbbb20009cd0ba7438b)

SUMMARY: ThreadSanitizer: data race build_docker/../contrib/libcxx/include/__utility/swap.h:37:7 in std::__1::enable_if<is_move_constructible<zkutil::ZooKeeper*>::value && is_move_assignable<zkutil::ZooKeeper*>::value, void>::type std::__1::swap<zkutil::ZooKeeper*>(zkutil::ZooKeeper*&, zkutil::ZooKeeper*&)
==================
```
#include <base/EnumReflection.h>
#include <Common/RemoteHostFilter.h>
#include <Interpreters/AsynchronousInsertQueue.h>
#include <Interpreters/DatabaseCatalog.h>
#include <Interpreters/JIT/CompiledExpressionCache.h>
#include <Storages/MergeTree/BackgroundJobsAssignee.h>
#include <Storages/MergeTree/MergeTreeBackgroundExecutor.h>
#include <Storages/MergeTree/MergeTreeDataPartUUID.h>
#include <Storages/MergeTree/MergeTreeMetadataCache.h>
#include <Interpreters/SynonymsExtensions.h>
#include <Interpreters/Lemmatizers.h>
#include <Interpreters/ClusterDiscovery.h>
#include <Interpreters/TransactionLog.h>
#include <filesystem>
#include <re2/re2.h>
#if USE_ROCKSDB
#include <rocksdb/table.h>
#endif
namespace fs = std::filesystem;
namespace ProfileEvents
{
    extern const Event ContextLock;
}
namespace CurrentMetrics
{
    extern const Metric ContextLockWait;
    extern const Metric BackgroundMovePoolTask;
    extern const Metric BackgroundSchedulePoolTask;
    extern const Metric BackgroundBufferFlushSchedulePoolTask;
    extern const Metric BackgroundDistributedSchedulePoolTask;