mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Better
This commit is contained in:
parent
a5ecdf7436
commit
804ae4c58b
@ -8280,15 +8280,28 @@ MovePartsOutcome MergeTreeData::moveParts(const CurrentlyMovingPartsTaggerPtr &
|
||||
return result;
|
||||
}
|
||||
|
||||
bool MergeTreeData::partsContainSameProjections(const DataPartPtr & left, const DataPartPtr & right)
|
||||
bool MergeTreeData::partsContainSameProjections(const DataPartPtr & left, const DataPartPtr & right, String & out_reason)
|
||||
{
|
||||
if (left->getProjectionParts().size() != right->getProjectionParts().size())
|
||||
{
|
||||
out_reason = fmt::format(
|
||||
"Parts have different number of projections: {} in one part and {} in another",
|
||||
left->getProjectionParts().size(),
|
||||
right->getProjectionParts().size()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto & [name, _] : left->getProjectionParts())
|
||||
{
|
||||
if (!right->hasProjection(name))
|
||||
{
|
||||
out_reason = fmt::format(
|
||||
"Some part doesn't have projection '{}' while another does", name
|
||||
)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -425,7 +425,7 @@ public:
|
||||
static ReservationPtr tryReserveSpace(UInt64 expected_size, const IDataPartStorage & data_part_storage);
|
||||
static ReservationPtr reserveSpace(UInt64 expected_size, const IDataPartStorage & data_part_storage);
|
||||
|
||||
static bool partsContainSameProjections(const DataPartPtr & left, const DataPartPtr & right);
|
||||
static bool partsContainSameProjections(const DataPartPtr & left, const DataPartPtr & right, String & out_reason);
|
||||
|
||||
StoragePolicyPtr getStoragePolicy() const override;
|
||||
|
||||
|
@ -2403,7 +2403,7 @@ bool BaseMergePredicate<VirtualPartsT, MutationsStateT>::canMergeTwoParts(
|
||||
}
|
||||
}
|
||||
|
||||
return MergeTreeData::partsContainSameProjections(left, right);
|
||||
return MergeTreeData::partsContainSameProjections(left, right, out_reason);
|
||||
}
|
||||
|
||||
template<typename VirtualPartsT, typename MutationsStateT>
|
||||
|
@ -932,11 +932,8 @@ MergeMutateSelectedEntryPtr StorageMergeTree::selectPartsToMerge(
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!partsContainSameProjections(left, right))
|
||||
{
|
||||
disable_reason = "Some parts contains differ projections";
|
||||
if (!partsContainSameProjections(left, right, disable_reason))
|
||||
return false;
|
||||
}
|
||||
|
||||
auto max_possible_level = getMaxLevelInBetween(left, right);
|
||||
if (max_possible_level > std::max(left->info.level, right->info.level))
|
||||
|
Loading…
Reference in New Issue
Block a user