mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 07:31:57 +00:00
More respect to min_number_of_marks
in ParallelReplicasReadingCoordinator
(#57763)
This commit is contained in:
parent
78773157b6
commit
560e66f3ca
@ -300,20 +300,20 @@ void DefaultCoordinator::selectPartsAndRanges(const PartRefs & container, size_t
|
||||
while (!part->description.ranges.empty() && current_mark_size < min_number_of_marks)
|
||||
{
|
||||
auto & range = part->description.ranges.front();
|
||||
const size_t needed = min_number_of_marks - current_mark_size;
|
||||
|
||||
if (range.getNumberOfMarks() > min_number_of_marks)
|
||||
if (range.getNumberOfMarks() > needed)
|
||||
{
|
||||
auto new_range = range;
|
||||
range.begin += min_number_of_marks;
|
||||
new_range.end = new_range.begin + min_number_of_marks;
|
||||
auto range_we_take = MarkRange{range.begin, range.begin + needed};
|
||||
response.description.back().ranges.emplace_back(range_we_take);
|
||||
current_mark_size += range_we_take.getNumberOfMarks();
|
||||
|
||||
response.description.back().ranges.emplace_back(new_range);
|
||||
current_mark_size += new_range.getNumberOfMarks();
|
||||
continue;
|
||||
range.begin += needed;
|
||||
break;
|
||||
}
|
||||
|
||||
current_mark_size += part->description.ranges.front().getNumberOfMarks();
|
||||
response.description.back().ranges.emplace_back(part->description.ranges.front());
|
||||
response.description.back().ranges.emplace_back(range);
|
||||
current_mark_size += range.getNumberOfMarks();
|
||||
part->description.ranges.pop_front();
|
||||
}
|
||||
}
|
||||
@ -473,23 +473,21 @@ ParallelReadResponse InOrderCoordinator<mode>::handleRequest(ParallelReadRequest
|
||||
{
|
||||
while (!global_part_it->description.ranges.empty() && current_mark_size < request.min_number_of_marks)
|
||||
{
|
||||
auto range = global_part_it->description.ranges.back();
|
||||
auto & range = global_part_it->description.ranges.back();
|
||||
const size_t needed = request.min_number_of_marks - current_mark_size;
|
||||
|
||||
if (range.getNumberOfMarks() > request.min_number_of_marks)
|
||||
if (range.getNumberOfMarks() > needed)
|
||||
{
|
||||
auto new_range = range;
|
||||
range.end -= request.min_number_of_marks;
|
||||
new_range.begin = new_range.end - request.min_number_of_marks;
|
||||
auto range_we_take = MarkRange{range.end - needed, range.end};
|
||||
part.ranges.emplace_front(range_we_take);
|
||||
current_mark_size += range_we_take.getNumberOfMarks();
|
||||
|
||||
global_part_it->description.ranges.back() = range;
|
||||
|
||||
part.ranges.emplace_front(new_range);
|
||||
current_mark_size += new_range.getNumberOfMarks();
|
||||
continue;
|
||||
range.end -= needed;
|
||||
break;
|
||||
}
|
||||
|
||||
current_mark_size += global_part_it->description.ranges.back().getNumberOfMarks();
|
||||
part.ranges.emplace_front(global_part_it->description.ranges.back());
|
||||
part.ranges.emplace_front(range);
|
||||
current_mark_size += range.getNumberOfMarks();
|
||||
global_part_it->description.ranges.pop_back();
|
||||
}
|
||||
}
|
||||
@ -497,23 +495,21 @@ ParallelReadResponse InOrderCoordinator<mode>::handleRequest(ParallelReadRequest
|
||||
{
|
||||
while (!global_part_it->description.ranges.empty() && current_mark_size < request.min_number_of_marks)
|
||||
{
|
||||
auto range = global_part_it->description.ranges.front();
|
||||
auto & range = global_part_it->description.ranges.front();
|
||||
const size_t needed = request.min_number_of_marks - current_mark_size;
|
||||
|
||||
if (range.getNumberOfMarks() > request.min_number_of_marks)
|
||||
if (range.getNumberOfMarks() > needed)
|
||||
{
|
||||
auto new_range = range;
|
||||
range.begin += request.min_number_of_marks;
|
||||
new_range.end = new_range.begin + request.min_number_of_marks;
|
||||
auto range_we_take = MarkRange{range.begin, range.begin + needed};
|
||||
part.ranges.emplace_back(range_we_take);
|
||||
current_mark_size += range_we_take.getNumberOfMarks();
|
||||
|
||||
global_part_it->description.ranges.front() = range;
|
||||
|
||||
part.ranges.emplace_back(new_range);
|
||||
current_mark_size += new_range.getNumberOfMarks();
|
||||
continue;
|
||||
range.begin += needed;
|
||||
break;
|
||||
}
|
||||
|
||||
current_mark_size += global_part_it->description.ranges.front().getNumberOfMarks();
|
||||
part.ranges.emplace_back(global_part_it->description.ranges.front());
|
||||
part.ranges.emplace_back(range);
|
||||
current_mark_size += range.getNumberOfMarks();
|
||||
global_part_it->description.ranges.pop_front();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user