diff --git a/src/Storages/MergeTree/MergeTreeData.cpp b/src/Storages/MergeTree/MergeTreeData.cpp index d98ea6170ec..ec9be3bf436 100644 --- a/src/Storages/MergeTree/MergeTreeData.cpp +++ b/src/Storages/MergeTree/MergeTreeData.cpp @@ -2328,6 +2328,9 @@ MergeTreeData::DataPartsVector MergeTreeData::removePartsInRangeFromWorkingSet(c for (const DataPartPtr & part : partition_range) { + if (part->info.partition_id != drop_range.partition_id) + throw Exception("Unexpected partition_id of part " + part->name + ". This is a bug.", ErrorCodes::LOGICAL_ERROR); + /// It's a DROP PART and it's already executed by fetching some covering part if (part->info != drop_range && part->info.contains(drop_range)) { @@ -2335,9 +2338,6 @@ MergeTreeData::DataPartsVector MergeTreeData::removePartsInRangeFromWorkingSet(c return {}; } - if (part->info.partition_id != drop_range.partition_id) - throw Exception("Unexpected partition_id of part " + part->name + ". This is a bug.", ErrorCodes::LOGICAL_ERROR); - if (part->info.min_block < drop_range.min_block) { if (drop_range.min_block <= part->info.max_block)