From 0584f44a2fea19012fd0a628437889fa41036154 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Wed, 26 Feb 2020 22:22:58 +0300 Subject: [PATCH] Update MergeTreeData.cpp --- dbms/src/Storages/MergeTree/MergeTreeData.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dbms/src/Storages/MergeTree/MergeTreeData.cpp b/dbms/src/Storages/MergeTree/MergeTreeData.cpp index f6f27dcb867..ab6345bffe4 100644 --- a/dbms/src/Storages/MergeTree/MergeTreeData.cpp +++ b/dbms/src/Storages/MergeTree/MergeTreeData.cpp @@ -3579,10 +3579,17 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::cloneAndLoadDataPartOnSameDisk( const String & tmp_part_prefix, const MergeTreePartInfo & dst_part_info) { + /// Check that the storage policy contains the disk where the src_part is located. + bool does_storage_policy_allow_same_disk = false; for (const DiskPtr & disk : getStoragePolicy()->getDisks()) + { if (disk->getName() == src_part->disk->getName()) + { does_storage_policy_allow_same_disk = true; + break; + } + } if (!does_storage_policy_allow_same_disk) throw Exception( "Could not clone and load part " + quoteString(src_part->getFullPath()) + " because disk does not belong to storage policy", ErrorCodes::LOGICAL_ERROR);