From 2c0390f32617a78d46948fd072efd4455e921c35 Mon Sep 17 00:00:00 2001 From: Azat Khuzhin Date: Mon, 30 Aug 2021 21:07:26 +0300 Subject: [PATCH] Fix removing of parts in a Temporary state (v2 followup) CI reports [1]: : Logical error: 'Deleting data part all_0_0_0_3 doesn't exist'. ... BaseDaemon: 8. ./obj-x86_64-linux-gnu/../src/Storages/MergeTree/MergeTreeData.cpp:1254: DB::MergeTreeData::removePartsFinally() @ 0x1f94dffa in /usr/bin/clickhouse [1]: https://clickhouse-test-reports.s3.yandex.net/0/855a53ff8160c4638fe345b0d26e062804ba790a/stress_test_(debug).html#fail1 Follow-up for: #28221 --- src/Storages/MergeTree/MergeTreeData.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index 36ebcf825e5..0be6cc2091f 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -1249,6 +1249,10 @@ void MergeTreeData::removePartsFinally(const MergeTreeData::DataPartsVector & pa /// TODO: use data_parts iterators instead of pointers for (const auto & part : parts) { + /// Temporary does not present in data_parts_by_info. + if (part->getState() == DataPartState::Temporary) + continue; + auto it = data_parts_by_info.find(part->info); if (it == data_parts_by_info.end()) throw Exception("Deleting data part " + part->name + " doesn't exist", ErrorCodes::LOGICAL_ERROR);