提交 3c2ddc5a 编写于 作者: V Vladimir Chebotarev

Improved check for parts on different disks.

上级 b17048f0
......@@ -208,6 +208,31 @@ StoragePolicy::StoragePolicy(String name_, Volumes volumes_, double move_factor_
}
bool StoragePolicy::isDefaultPolicy() const
{
/// Guessing if this policy is default, not 100% correct though.
if (getName() != "default")
return false;
const auto & volumes = getVolumes();
if (volumes.size != 1)
return false;
if (volumes[0]->getName() != "default")
return false;
const auto & disks = volumes[0]->disks;
if (disks.size != 1)
return false;
if (disks[0]->getName() != "default")
return false;
return true;
}
Disks StoragePolicy::getDisks() const
{
Disks res;
......
......@@ -103,6 +103,8 @@ public:
StoragePolicy(String name_, Volumes volumes_, double move_factor_);
bool isDefaultPolicy() const;
/// Returns disks ordered by volumes priority
Disks getDisks() const;
......
......@@ -803,7 +803,8 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks)
auto disks = storage_policy->getDisks();
if (getStoragePolicy()->getName() != "default")
/// Only check if user did touch storage configuration for this table.
if (getStoragePolicy()->isDefaultPolicy() && !skip_sanity_checks)
{
/// Check extra parts at different disks, in order to not allow to miss data parts at undefined disks.
std::unordered_set<String> defined_disk_names;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册