https://clickhouse-test-reports.s3.yandex.net/0/1c9778603ff49563d1d3d0d357de0608167e504d/stress_test_(thread).html
```
==================
WARNING: ThreadSanitizer: data race (pid=485)
  Read of size 8 at 0x7b5001280bd8 by thread T567 (mutexes: write M612061890855345680):
    #0 std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>::get() const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2835:49 (clickhouse+0x159140a6)
    #1 std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>::operator bool() const obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2851:62 (clickhouse+0x159140a6)
    #2 bool std::__1::operator!=<DB::BackgroundSchedulePoolTaskInfo>(std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo> const&, std::nullptr_t) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:3447:30 (clickhouse+0x159140a6)
    #3 DB::BackgroundSchedulePoolTaskHolder::operator bool() const obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.h:164:46 (clickhouse+0x159140a6)
    #4 DB::StorageBuffer::flush() obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:675:10 (clickhouse+0x159140a6)
    #5 DB::InterpreterDropQuery::executeToDatabaseImpl(DB::ASTDropQuery const&, std::__1::shared_ptr<DB::IDatabase>&, std::__1::vector<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag>, std::__1::allocator<StrongTypedef<wide::integer<128ul, unsigned int>, DB::UUIDTag> > >&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:344:40 (clickhouse+0x14d868c7)
    #6 DB::InterpreterDropQuery::executeToDatabase(DB::ASTDropQuery const&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:280:15 (clickhouse+0x14d835b8)
    #7 DB::InterpreterDropQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterDropQuery.cpp:64:16 (clickhouse+0x14d82e4d)
    #8 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32 (clickhouse+0x1537ec71)
    #9 DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:993:30 (clickhouse+0x1537c7f5)
    #10 DB::TCPHandler::runImpl() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:289:24 (clickhouse+0x15e229f6)
    #11 DB::TCPHandler::run() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:1660:9 (clickhouse+0x15e323e7)
    #12 Poco::Net::TCPServerConnection::start() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3 (clickhouse+0x1921ff82)
    #13 Poco::Net::TCPServerDispatcher::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20 (clickhouse+0x19220792)
    #14 Poco::PooledThread::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14 (clickhouse+0x193a24b5)
    #15 Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x193a068f)
    #16 Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x1939ed67)

  Previous write of size 8 at 0x7b5001280bd8 by thread T586 (mutexes: write M191819750614415520):
    #0 std::__1::enable_if<(is_move_constructible<DB::BackgroundSchedulePoolTaskInfo*>::value) && (is_move_assignable<DB::BackgroundSchedulePoolTaskInfo*>::value), void>::type std::__1::swap<DB::BackgroundSchedulePoolTaskInfo*>(DB::BackgroundSchedulePoolTaskInfo*&, DB::BackgroundSchedulePoolTaskInfo*&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3935:9 (clickhouse+0x15913e22)
    #1 std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>::swap(std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>&) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:3299:5 (clickhouse+0x15913e22)
    #2 std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>::operator=(std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>&&) obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:3243:34 (clickhouse+0x15913e22)
    #3 DB::BackgroundSchedulePoolTaskHolder::operator=(DB::BackgroundSchedulePoolTaskHolder&&) obj-x86_64-linux-gnu/../src/Core/BackgroundSchedulePool.h:156:110 (clickhouse+0x15913e22)
    #4 DB::StorageBuffer::startup() obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:668:18 (clickhouse+0x15913e22)
    #5 DB::InterpreterCreateQuery::doCreateTable(DB::ASTCreateQuery&, DB::InterpreterCreateQuery::TableProperties const&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1092:10 (clickhouse+0x149bef7b)
    #6 DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:952:20 (clickhouse+0x149ba9f5)
    #7 DB::InterpreterCreateQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1302:16 (clickhouse+0x149c1086)
    #8 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32 (clickhouse+0x1537ec71)
    #9 DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::__1::shared_ptr<DB::Context>, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>, std::__1::optional<DB::FormatSettings> const&, std::__1::function<void ()>) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:1065:30 (clickhouse+0x15381cb4)
    #10 DB::DDLWorker::tryExecuteQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::DDLTaskBase&, std::__1::shared_ptr<zkutil::ZooKeeper> const&) obj-x86_64-linux-gnu/../src/Interpreters/DDLWorker.cpp:522:9 (clickhouse+0x1489ffcc)
    #11 DB::DDLWorker::processTask(DB::DDLTaskBase&, std::__1::shared_ptr<zkutil::ZooKeeper> const&) obj-x86_64-linux-gnu/../src/Interpreters/DDLWorker.cpp:682:17 (clickhouse+0x1489e54c)
    #12 DB::DatabaseReplicatedDDLWorker::tryEnqueueAndExecuteEntry(DB::DDLLogEntry&, std::__1::shared_ptr<DB::Context const>) obj-x86_64-linux-gnu/../src/Databases/DatabaseReplicatedWorker.cpp:178:5 (clickhouse+0x1471531e)
    #13 DB::DatabaseReplicated::tryEnqueueReplicatedDDL(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>) obj-x86_64-linux-gnu/../src/Databases/DatabaseReplicated.cpp:439:36 (clickhouse+0x147067d9)
    #14 DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:944:25 (clickhouse+0x149bac44)
    #15 DB::InterpreterCreateQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1302:16 (clickhouse+0x149c1086)
    #16 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32 (clickhouse+0x1537ec71)
    #17 DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:993:30 (clickhouse+0x1537c7f5)
    #18 DB::TCPHandler::runImpl() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:289:24 (clickhouse+0x15e229f6)
    #19 DB::TCPHandler::run() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:1660:9 (clickhouse+0x15e323e7)
    #20 Poco::Net::TCPServerConnection::start() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3 (clickhouse+0x1921ff82)
    #21 Poco::Net::TCPServerDispatcher::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20 (clickhouse+0x19220792)
    #22 Poco::PooledThread::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14 (clickhouse+0x193a24b5)
    #23 Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x193a068f)
    #24 Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x1939ed67)

  Location is heap block of size 488 at 0x7b5001280a00 allocated by thread T586:
    #0 operator new(unsigned long) <null> (clickhouse+0x96f0fe8)
    #1 std::__1::shared_ptr<DB::StorageBuffer> shared_ptr_helper<DB::StorageBuffer>::create<DB::StorageID const&, DB::ColumnsDescription const&, DB::ConstraintsDescription const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, unsigned long&, DB::StorageBuffer::Thresholds&, DB::StorageBuffer::Thresholds&, DB::StorageBuffer::Thresholds&, DB::StorageID&, bool>(DB::StorageID const&, DB::ColumnsDescription const&, DB::ConstraintsDescription const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>&&, unsigned long&, DB::StorageBuffer::Thresholds&, DB::StorageBuffer::Thresholds&, DB::StorageBuffer::Thresholds&, DB::StorageID&, bool&&) obj-x86_64-linux-gnu/../base/common/../common/shared_ptr_helper.h:17:35 (clickhouse+0x15919d2a)
    #2 DB::registerStorageBuffer(DB::StorageFactory&)::$_5::operator()(DB::StorageFactory::Arguments const&) const obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:1142:16 (clickhouse+0x15919d2a)
    #3 decltype(std::__1::forward<DB::registerStorageBuffer(DB::StorageFactory&)::$_5&>(fp)(std::__1::forward<DB::StorageFactory::Arguments const&>(fp0))) std::__1::__invoke<DB::registerStorageBuffer(DB::StorageFactory&)::$_5&, DB::StorageFactory::Arguments const&>(DB::registerStorageBuffer(DB::StorageFactory&)::$_5&, DB::StorageFactory::Arguments const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/type_traits:3676:1 (clickhouse+0x15919d2a)
    #4 std::__1::shared_ptr<DB::IStorage> std::__1::__invoke_void_return_wrapper<std::__1::shared_ptr<DB::IStorage> >::__call<DB::registerStorageBuffer(DB::StorageFactory&)::$_5&, DB::StorageFactory::Arguments const&>(DB::registerStorageBuffer(DB::StorageFactory&)::$_5&, DB::StorageFactory::Arguments const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/__functional_base:317:16 (clickhouse+0x15919d2a)
    #5 std::__1::__function::__default_alloc_func<DB::registerStorageBuffer(DB::StorageFactory&)::$_5, std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)>::operator()(DB::StorageFactory::Arguments const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:1608:12 (clickhouse+0x15919d2a)
    #6 std::__1::shared_ptr<DB::IStorage> std::__1::__function::__policy_invoker<std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)>::__call_impl<std::__1::__function::__default_alloc_func<DB::registerStorageBuffer(DB::StorageFactory&)::$_5, std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)> >(std::__1::__function::__policy_storage const*, DB::StorageFactory::Arguments const&) obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2089:16 (clickhouse+0x15919d2a)
    #7 std::__1::__function::__policy_func<std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)>::operator()(DB::StorageFactory::Arguments const&) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2221:16 (clickhouse+0x156e5595)
    #8 std::__1::function<std::__1::shared_ptr<DB::IStorage> (DB::StorageFactory::Arguments const&)>::operator()(DB::StorageFactory::Arguments const&) const obj-x86_64-linux-gnu/../contrib/libcxx/include/functional:2560:12 (clickhouse+0x156e5595)
    #9 DB::StorageFactory::get(DB::ASTCreateQuery const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, std::__1::shared_ptr<DB::Context>, DB::ColumnsDescription const&, DB::ConstraintsDescription const&, bool) const obj-x86_64-linux-gnu/../src/Storages/StorageFactory.cpp:215:16 (clickhouse+0x156e5595)
    #10 DB::InterpreterCreateQuery::doCreateTable(DB::ASTCreateQuery&, DB::InterpreterCreateQuery::TableProperties const&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1058:42 (clickhouse+0x149bed84)
    #11 DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:952:20 (clickhouse+0x149ba9f5)
    #12 DB::InterpreterCreateQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1302:16 (clickhouse+0x149c1086)
    #13 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32 (clickhouse+0x1537ec71)
    #14 DB::executeQuery(DB::ReadBuffer&, DB::WriteBuffer&, bool, std::__1::shared_ptr<DB::Context>, std::__1::function<void (std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)>, std::__1::optional<DB::FormatSettings> const&, std::__1::function<void ()>) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:1065:30 (clickhouse+0x15381cb4)
    #15 DB::DDLWorker::tryExecuteQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::DDLTaskBase&, std::__1::shared_ptr<zkutil::ZooKeeper> const&) obj-x86_64-linux-gnu/../src/Interpreters/DDLWorker.cpp:522:9 (clickhouse+0x1489ffcc)
    #16 DB::DDLWorker::processTask(DB::DDLTaskBase&, std::__1::shared_ptr<zkutil::ZooKeeper> const&) obj-x86_64-linux-gnu/../src/Interpreters/DDLWorker.cpp:682:17 (clickhouse+0x1489e54c)
    #17 DB::DatabaseReplicatedDDLWorker::tryEnqueueAndExecuteEntry(DB::DDLLogEntry&, std::__1::shared_ptr<DB::Context const>) obj-x86_64-linux-gnu/../src/Databases/DatabaseReplicatedWorker.cpp:178:5 (clickhouse+0x1471531e)
    #18 DB::DatabaseReplicated::tryEnqueueReplicatedDDL(std::__1::shared_ptr<DB::IAST> const&, std::__1::shared_ptr<DB::Context const>) obj-x86_64-linux-gnu/../src/Databases/DatabaseReplicated.cpp:439:36 (clickhouse+0x147067d9)
    #19 DB::InterpreterCreateQuery::createTable(DB::ASTCreateQuery&) obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:944:25 (clickhouse+0x149bac44)
    #20 DB::InterpreterCreateQuery::execute() obj-x86_64-linux-gnu/../src/Interpreters/InterpreterCreateQuery.cpp:1302:16 (clickhouse+0x149c1086)
    #21 DB::executeQueryImpl(char const*, char const*, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum, DB::ReadBuffer*) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:633:32 (clickhouse+0x1537ec71)
    #22 DB::executeQuery(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::shared_ptr<DB::Context>, bool, DB::QueryProcessingStage::Enum) obj-x86_64-linux-gnu/../src/Interpreters/executeQuery.cpp:993:30 (clickhouse+0x1537c7f5)
    #23 DB::TCPHandler::runImpl() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:289:24 (clickhouse+0x15e229f6)
    #24 DB::TCPHandler::run() obj-x86_64-linux-gnu/../src/Server/TCPHandler.cpp:1660:9 (clickhouse+0x15e323e7)
    #25 Poco::Net::TCPServerConnection::start() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerConnection.cpp:43:3 (clickhouse+0x1921ff82)
    #26 Poco::Net::TCPServerDispatcher::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:115:20 (clickhouse+0x19220792)
    #27 Poco::PooledThread::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:199:14 (clickhouse+0x193a24b5)
    #28 Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x193a068f)
    #29 Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x1939ed67)

  Mutex M612061890855345680 is already destroyed.

  Mutex M191819750614415520 is already destroyed.

  Thread T567 'TCPHandler' (tid=20770, running) created by thread T240 at:
    #0 pthread_create <null> (clickhouse+0x965aeed)
    #1 Poco::ThreadImpl::startImpl(Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable> >) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:202:6 (clickhouse+0x1939e7f8)
    #2 Poco::Thread::start(Poco::Runnable&) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:128:2 (clickhouse+0x1939ffcc)
    #3 Poco::PooledThread::start() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:85:10 (clickhouse+0x193a42a6)
    #4 Poco::ThreadPool::getThread() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:461:14 (clickhouse+0x193a42a6)
    #5 Poco::ThreadPool::startWithPriority(Poco::Thread::Priority, Poco::Runnable&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:365:2 (clickhouse+0x193a4687)
    #6 Poco::Net::TCPServerDispatcher::enqueue(Poco::Net::StreamSocket const&) obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:152:17 (clickhouse+0x19220c6e)
    #7 Poco::Net::TCPServer::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServer.cpp:148:21 (clickhouse+0x1921f807)
    #8 Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x193a068f)
    #9 Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x1939ed67)

  Thread T586 'TCPHandler' (tid=7657, running) created by thread T240 at:
    #0 pthread_create <null> (clickhouse+0x965aeed)
    #1 Poco::ThreadImpl::startImpl(Poco::SharedPtr<Poco::Runnable, Poco::ReferenceCounter, Poco::ReleasePolicy<Poco::Runnable> >) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:202:6 (clickhouse+0x1939e7f8)
    #2 Poco::Thread::start(Poco::Runnable&) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:128:2 (clickhouse+0x1939ffcc)
    #3 Poco::PooledThread::start() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:85:10 (clickhouse+0x193a42a6)
    #4 Poco::ThreadPool::getThread() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:461:14 (clickhouse+0x193a42a6)
    #5 Poco::ThreadPool::startWithPriority(Poco::Thread::Priority, Poco::Runnable&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/ThreadPool.cpp:365:2 (clickhouse+0x193a4687)
    #6 Poco::Net::TCPServerDispatcher::enqueue(Poco::Net::StreamSocket const&) obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServerDispatcher.cpp:152:17 (clickhouse+0x19220c6e)
    #7 Poco::Net::TCPServer::run() obj-x86_64-linux-gnu/../contrib/poco/Net/src/TCPServer.cpp:148:21 (clickhouse+0x1921f807)
    #8 Poco::(anonymous namespace)::RunnableHolder::run() obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread.cpp:55:11 (clickhouse+0x193a068f)
    #9 Poco::ThreadImpl::runnableEntry(void*) obj-x86_64-linux-gnu/../contrib/poco/Foundation/src/Thread_POSIX.cpp:345:27 (clickhouse+0x1939ed67)

SUMMARY: ThreadSanitizer: data race obj-x86_64-linux-gnu/../contrib/libcxx/include/memory:2835:49 in std::__1::shared_ptr<DB::BackgroundSchedulePoolTaskInfo>::get() const
==================
```
{
    return std::make_shared<BufferSink>(*this, metadata_snapshot);
}
bool StorageBuffer::mayBenefitFromIndexForIn(
    const ASTPtr & left_in_operand, ContextPtr query_context, const StorageMetadataPtr & ) const
{
    if (!destination_id)
        return false;
    auto destination = DatabaseCatalog::instance().getTable(destination_id, query_context);
    if (destination.get() == this)
        throw Exception("Destination table is myself. Read will cause infinite loop.", ErrorCodes::INFINITE_LOOP);
    return destination->mayBenefitFromIndexForIn(left_in_operand, query_context, destination->getInMemoryMetadataPtr());
}
void StorageBuffer::startup()
{
    if (getContext()->getSettingsRef().readonly)
    {
        LOG_WARNING(log, "Storage {} is run with readonly settings, it will not be able to insert data. Set appropriate buffer_profile to fix this.", getName());
    }
    flush_handle = bg_pool.createTask(log->name() + "/Bg", [this]{ backgroundFlush(); });
    flush_handle->activateAndSchedule();
}
void StorageBuffer::flush()