mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 00:22:29 +00:00
Merge pull request #9383 from excitoon-favorites/attachpart
Added a check for storage policy in `cloneAndLoadDataPartOnSameDisk()`
This commit is contained in:
commit
b655190c2d
@ -3591,6 +3591,21 @@ MergeTreeData::MutableDataPartPtr MergeTreeData::cloneAndLoadDataPartOnSameDisk(
|
|||||||
const String & tmp_part_prefix,
|
const String & tmp_part_prefix,
|
||||||
const MergeTreePartInfo & dst_part_info)
|
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);
|
||||||
|
|
||||||
String dst_part_name = src_part->getNewName(dst_part_info);
|
String dst_part_name = src_part->getNewName(dst_part_info);
|
||||||
String tmp_dst_part_name = tmp_part_prefix + dst_part_name;
|
String tmp_dst_part_name = tmp_part_prefix + dst_part_name;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user