mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 10:02:01 +00:00
Merge branch 'master' into docs-for-s3-settings
This commit is contained in:
commit
09a190b4fd
@ -18,13 +18,18 @@ bool MarkRange::operator<(const MarkRange & rhs) const
|
||||
/// We allow only consecutive non-intersecting ranges
|
||||
/// Here we check whether a beginning of one range lies inside another range
|
||||
/// (ranges are intersect)
|
||||
const bool is_intersection = (begin <= rhs.begin && rhs.begin < end) ||
|
||||
(rhs.begin <= begin && begin < rhs.end);
|
||||
if (this != &rhs)
|
||||
{
|
||||
const bool is_intersection = (begin <= rhs.begin && rhs.begin < end) ||
|
||||
(rhs.begin <= begin && begin < rhs.end);
|
||||
|
||||
if (is_intersection)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR,
|
||||
"Intersecting mark ranges are not allowed, it "
|
||||
"is a bug! First range ({}, {}), second range ({}, {})", begin, end, rhs.begin, rhs.end);
|
||||
if (is_intersection)
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR,
|
||||
"Intersecting mark ranges are not allowed, it is a bug! "
|
||||
"First range ({}, {}), second range ({}, {})",
|
||||
begin, end, rhs.begin, rhs.end);
|
||||
}
|
||||
|
||||
return begin < rhs.begin && end <= rhs.begin;
|
||||
}
|
||||
@ -49,4 +54,15 @@ std::string toString(const MarkRanges & ranges)
|
||||
return result;
|
||||
}
|
||||
|
||||
void assertSortedAndNonIntersecting(const MarkRanges & ranges)
|
||||
{
|
||||
MarkRanges ranges_copy(ranges.begin(), ranges.end());
|
||||
/// Should also throw an exception if interseting range is found during comparison.
|
||||
std::sort(ranges_copy.begin(), ranges_copy.end());
|
||||
if (ranges_copy != ranges)
|
||||
throw Exception(
|
||||
ErrorCodes::LOGICAL_ERROR, "Expected sorted and non intersecting ranges. Ranges: {}",
|
||||
toString(ranges));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -34,4 +34,6 @@ size_t getLastMark(const MarkRanges & ranges);
|
||||
|
||||
std::string toString(const MarkRanges & ranges);
|
||||
|
||||
void assertSortedAndNonIntersecting(const MarkRanges & ranges);
|
||||
|
||||
}
|
||||
|
@ -201,6 +201,10 @@ std::vector<size_t> MergeTreeReadPool::fillPerPartInfo(const RangesInDataParts &
|
||||
for (const auto i : collections::range(0, parts.size()))
|
||||
{
|
||||
const auto & part = parts[i];
|
||||
#ifndef NDEBUG
|
||||
assertSortedAndNonIntersecting(part.ranges);
|
||||
#endif
|
||||
|
||||
bool part_on_remote_disk = part.data_part->isStoredOnRemoteDisk();
|
||||
is_part_on_remote_disk[i] = part_on_remote_disk;
|
||||
do_not_steal_tasks |= part_on_remote_disk;
|
||||
|
Loading…
Reference in New Issue
Block a user