Update MergeTreeData.cpp

This commit is contained in:
alexey-milovidov 2020-02-26 22:22:58 +03:00 committed by GitHub
parent 534b3b91cc
commit 0584f44a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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