https://s3.amazonaws.com/clickhouse-test-reports/0/8ffd6cd22cee62790d70fa60537b771fa43daa06/stress_test__undefined__actions_.html
```
2022.07.07 20:49:35.535544 [ 731 ] {test_tlth8z.ttl_table2::all_0_3_1} <Fatal> : Logical error: 'Tried to lock part all_0_0_0 for removal second time by (1, 1, 00000000-0000-0000-0000-000000000000)'.
2022.07.07 21:02:12.199002 [ 246038 ] {} <Fatal> BaseDaemon: ########################################
2022.07.07 21:02:12.213412 [ 246038 ] {} <Fatal> BaseDaemon: (version 22.7.1.1 (official build), build id: F4D9612166EED175) (from thread 731) (query_id: test_tlth8z.ttl_table2::all_0_3_1) (query: ) Received signal Aborted (6)
2022.07.07 21:02:12.229172 [ 246038 ] {} <Fatal> BaseDaemon: 
2022.07.07 21:02:12.232432 [ 246038 ] {} <Fatal> BaseDaemon: Stack trace: 0x7f914176900b 0x7f9141748859 0xffa448b 0xffa46e5 0x24b5cd45 0x24b5a70d 0x24b5a2d3 0x248c4bcf 0x257bf1cf 0x2535563e 0x2570fbdf 0x259dda05 0x259db7b6 0x257544fd 0x257558df 0x1007ffe1 0x100836e0 0x1007e7e1 0x100813e2 0x7f9141920609 0x7f9141845133
2022.07.07 21:02:12.233593 [ 246038 ] {} <Fatal> BaseDaemon: 3. raise @ 0x7f914176900b in ?
2022.07.07 21:02:12.236520 [ 246038 ] {} <Fatal> BaseDaemon: 4. abort @ 0x7f9141748859 in ?
2022.07.07 21:02:12.359535 [ 246038 ] {} <Fatal> BaseDaemon: 5. ./build_docker/../src/Common/Exception.cpp:47: DB::abortOnFailedAssertion(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) @ 0xffa448b in /usr/bin/clickhouse
2022.07.07 21:02:12.482909 [ 246038 ] {} <Fatal> BaseDaemon: 6. ./build_docker/../src/Common/Exception.cpp:70: DB::Exception::Exception(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, bool) @ 0xffa46e5 in /usr/bin/clickhouse
2022.07.07 21:02:12.517150 [ 246038 ] {} <Fatal> BaseDaemon: 7.1. inlined from ./build_docker/../contrib/libcxx/include/string:1445: std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__is_long() const
2022.07.07 21:02:12.517503 [ 246038 ] {} <Fatal> BaseDaemon: 7.2. inlined from ../contrib/libcxx/include/string:2231: ~basic_string
2022.07.07 21:02:12.517697 [ 246038 ] {} <Fatal> BaseDaemon: 7. ../src/Common/Exception.h:37: DB::Exception::Exception<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::TransactionID const&>(int, fmt::v8::basic_format_string<char, fmt::v8::type_identity<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&>::type, fmt::v8::type_identity<DB::TransactionID const&>::type>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, DB::TransactionID const&) @ 0x24b5cd45 in /usr/bin/clickhouse
2022.07.07 21:02:12.637866 [ 246038 ] {} <Fatal> BaseDaemon: 8. ./build_docker/../src/Interpreters/TransactionVersionMetadata.cpp:99: DB::VersionMetadata::tryLockRemovalTID(DB::TransactionID const&, DB::TransactionInfoContext const&, unsigned long*) @ 0x24b5a70d in /usr/bin/clickhouse
2022.07.07 21:02:12.659558 [ 246038 ] {} <Fatal> BaseDaemon: 9. ./build_docker/../src/Interpreters/TransactionVersionMetadata.cpp:74: DB::VersionMetadata::lockRemovalTID(DB::TransactionID const&, DB::TransactionInfoContext const&) @ 0x24b5a2d3 in /usr/bin/clickhouse
2022.07.07 21:02:12.786201 [ 246038 ] {} <Fatal> BaseDaemon: 10.1. inlined from ./build_docker/../contrib/libcxx/include/__iterator/wrap_iter.h:100: std::__1::__wrap_iter<std::__1::shared_ptr<DB::IMergeTreeDataPart const> const*>::operator++()
2022.07.07 21:02:12.799174 [ 246038 ] {} <Fatal> BaseDaemon: 10. ../src/Interpreters/MergeTreeTransaction.cpp:124: DB::MergeTreeTransaction::addNewPartAndRemoveCovered(std::__1::shared_ptr<DB::IStorage> const&, std::__1::shared_ptr<DB::IMergeTreeDataPart const> const&, std::__1::vector<std::__1::shared_ptr<DB::IMergeTreeDataPart const>, std::__1::allocator<std::__1::shared_ptr<DB::IMergeTreeDataPart const> > > const&, DB::MergeTreeTransaction*) @ 0x248c4bcf in /usr/bin/clickhouse
2022.07.07 21:02:13.164713 [ 246038 ] {} <Fatal> BaseDaemon: 11. ./build_docker/../src/Storages/MergeTree/MergeTreeData.cpp:4973: DB::MergeTreeData::Transaction::commit(std::__1::unique_lock<std::__1::mutex>*) @ 0x257bf1cf in /usr/bin/clickhouse
2022.07.07 21:02:13.779254 [ 246038 ] {} <Fatal> BaseDaemon: 12. ./build_docker/../src/Storages/StorageReplicatedMergeTree.cpp:0: DB::StorageReplicatedMergeTree::checkPartChecksumsAndCommit(DB::MergeTreeData::Transaction&, std::__1::shared_ptr<DB::IMergeTreeDataPart const> const&, std::__1::optional<DB::MergeTreeData::HardlinkedFiles>) @ 0x2535563e in /usr/bin/clickhouse
2022.07.07 21:02:14.074729 [ 246038 ] {} <Fatal> BaseDaemon: 13. ./build_docker/../src/Storages/MergeTree/MergeFromLogEntryTask.cpp:0: DB::MergeFromLogEntryTask::finalize(std::__1::function<void (DB::ExecutionStatus const&)>) @ 0x2570fbdf in /usr/bin/clickhouse
2022.07.07 21:02:14.098570 [ 246038 ] {} <Fatal> BaseDaemon: 14. ./build_docker/../src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp:0: DB::ReplicatedMergeMutateTaskBase::executeImpl() @ 0x259dda05 in /usr/bin/clickhouse
2022.07.07 21:02:14.114595 [ 246038 ] {} <Fatal> BaseDaemon: 15. ./build_docker/../src/Storages/MergeTree/ReplicatedMergeMutateTaskBase.cpp:0: DB::ReplicatedMergeMutateTaskBase::executeStep() @ 0x259db7b6 in /usr/bin/clickhouse
2022.07.07 21:02:14.127018 [ 246038 ] {} <Fatal> BaseDaemon: 16. ./build_docker/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:155: DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::routine(std::__1::shared_ptr<DB::TaskRuntimeData>) @ 0x257544fd in /usr/bin/clickhouse
2022.07.07 21:02:14.138098 [ 246038 ] {} <Fatal> BaseDaemon: 17. ./build_docker/../src/Storages/MergeTree/MergeTreeBackgroundExecutor.cpp:256: DB::MergeTreeBackgroundExecutor<DB::MergeMutateRuntimeQueue>::threadFunction() @ 0x257558df in /usr/bin/clickhouse
2022.07.07 21:02:14.153188 [ 246038 ] {} <Fatal> BaseDaemon: 18.1. inlined from ./build_docker/../contrib/libcxx/include/__functional/function.h:1157: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.07.07 21:02:14.153222 [ 246038 ] {} <Fatal> BaseDaemon: 18. ../src/Common/ThreadPool.cpp:284: ThreadPoolImpl<ThreadFromGlobalPool>::worker(std::__1::__list_iterator<ThreadFromGlobalPool, void*>) @ 0x1007ffe1 in /usr/bin/clickhouse
2022.07.07 21:02:14.161679 [ 246038 ] {} <Fatal> BaseDaemon: 19. ./build_docker/../src/Common/ThreadPool.cpp:0: ThreadFromGlobalPool::ThreadFromGlobalPool<void ThreadPoolImpl<ThreadFromGlobalPool>::scheduleImpl<void>(std::__1::function<void ()>, int, std::__1::optional<unsigned long>)::'lambda0'()>(void&&)::'lambda'()::operator()() @ 0x100836e0 in /usr/bin/clickhouse
2022.07.07 21:02:14.170394 [ 246038 ] {} <Fatal> BaseDaemon: 20.1. inlined from ./build_docker/../contrib/libcxx/include/__functional/function.h:1157: std::__1::function<void ()>::operator=(std::nullptr_t)
2022.07.07 21:02:14.170412 [ 246038 ] {} <Fatal> BaseDaemon: 20. ../src/Common/ThreadPool.cpp:284: ThreadPoolImpl<std::__1::thread>::worker(std::__1::__list_iterator<std::__1::thread, void*>) @ 0x1007e7e1 in /usr/bin/clickhouse
2022.07.07 21:02:14.180843 [ 246038 ] {} <Fatal> BaseDaemon: 21. ./build_docker/../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*) @ 0x100813e2 in /usr/bin/clickhouse
2022.07.07 21:02:14.180872 [ 246038 ] {} <Fatal> BaseDaemon: 22. ? @ 0x7f9141920609 in ?
2022.07.07 21:02:14.180883 [ 246038 ] {} <Fatal> BaseDaemon: 23. clone @ 0x7f9141845133 in ?
2022.07.07 21:02:14.504259 [ 246038 ] {} <Fatal> BaseDaemon: Integrity check of the executable successfully passed (checksum: 8B99A223BCD23F732931182A123DD028)
2022.07.07 21:02:34.097344 [ 638 ] {} <Fatal> Application: Child process was terminated by signal 6.
```
{
    std::lock_guard lock(query_id_set_mutex);
    removeQueryIdNoLock(query_id);
}
void MergeTreeData::removeQueryIdNoLock(const String & query_id) const
{
    if (query_id_set.find(query_id) == query_id_set.end())
        LOG_WARNING(log, "We have query_id removed but it's not recorded. This is a bug");
    else
        query_id_set.erase(query_id);
}
ReservationPtr MergeTreeData::balancedReservation(
    const StorageMetadataPtr & metadata_snapshot,
    size_t part_size,
    size_t max_volume_index,
    const String & part_name,
    const MergeTreePartInfo & part_info,
    MergeTreeData::DataPartsVector covered_parts,
    std::optional<CurrentlySubmergingEmergingTagger> * tagger_ptr,
    const IMergeTreeDataPart::TTLInfos * ttl_infos,
    bool is_insert)