mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #8440 from excitoon-favorites/bettercheckforpartsonanotherdisks
Improved check for parts on different disks
This commit is contained in:
commit
6830d7fa2d
@ -208,6 +208,30 @@ 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;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -823,7 +823,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;
|
||||
|
Loading…
Reference in New Issue
Block a user