mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 08:40:50 +00:00
Parallel replicas (perf): announcement response handling improvement
This commit is contained in:
parent
0c29e8094a
commit
4ccf4e11a8
@ -161,11 +161,10 @@ void DefaultCoordinator::updateReadingState(InitialAllRangesAnnouncement announc
|
||||
PartRefs parts_diff;
|
||||
|
||||
/// To get rid of duplicates
|
||||
for (auto && part: announcement.description)
|
||||
for (auto && part_ranges: announcement.description)
|
||||
{
|
||||
auto the_same_it = std::find_if(all_parts_to_read.begin(), all_parts_to_read.end(),
|
||||
[&part] (const Part & other) { return other.description.info.getPartNameV1() == part.info.getPartNameV1(); });
|
||||
|
||||
Part part{.description = std::move(part_ranges), .replicas = {announcement.replica_num}};
|
||||
auto the_same_it = all_parts_to_read.find(part);
|
||||
/// We have the same part - add the info about presence on current replica to it
|
||||
if (the_same_it != all_parts_to_read.end())
|
||||
{
|
||||
@ -174,13 +173,13 @@ void DefaultCoordinator::updateReadingState(InitialAllRangesAnnouncement announc
|
||||
}
|
||||
|
||||
auto covering_or_the_same_it = std::find_if(all_parts_to_read.begin(), all_parts_to_read.end(),
|
||||
[&part] (const Part & other) { return !other.description.info.isDisjoint(part.info); });
|
||||
[&part] (const Part & other) { return !other.description.info.isDisjoint(part.description.info); });
|
||||
|
||||
/// It is covering part or we have covering - skip it
|
||||
if (covering_or_the_same_it != all_parts_to_read.end())
|
||||
continue;
|
||||
|
||||
auto [insert_it, _] = all_parts_to_read.emplace(Part{.description = std::move(part), .replicas = {announcement.replica_num}});
|
||||
auto [insert_it, _] = all_parts_to_read.emplace(part);
|
||||
parts_diff.push_back(insert_it);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user