Merge pull request #28366 from azat/remove-Temporary-part-fix-v2

Fix removing of parts in a Temporary state (v2 followup)
This commit is contained in:
alesapin 2021-08-31 19:13:15 +03:00 committed by GitHub
commit 2c7a51d816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);