dbms: Server: queries with several replicas: development [#METR-14410]

This commit is contained in:
Alexey Arno 2015-01-21 15:24:29 +03:00
parent 1b48a66c6d
commit 2201c073a8

View File

@ -254,13 +254,15 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
RangesInDataParts * final_parts_with_ranges = nullptr;
if (settings.parallel_replicas_count > 0)
if (settings.parallel_replicas_count > 1)
{
PartsWithRangesSplitter splitter(parts_with_ranges, sum_marks, data.settings.min_rows_for_seek,
settings.parallel_replicas_count);
auto per_replica_parts_with_ranges = splitter.perform();
if ((per_replica_parts_with_ranges.size() > 1) && (settings.parallel_replica_offset < per_replica_parts_with_ranges.size()))
if (settings.parallel_replica_offset < per_replica_parts_with_ranges.size())
{
if (per_replica_parts_with_ranges.size() > 1)
{
/// Для каждого элемента массива per_replica_parts_with_ranges, вычисляем его хэш
/// Сортируем массив per_replica_parts_with_ranges по хэшу.
@ -292,9 +294,16 @@ BlockInputStreams MergeTreeDataSelectExecutor::read(
sum_marks += range.end - range.begin;
}
}
else
final_parts_with_ranges = &parts_with_ranges;
}
if (final_parts_with_ranges == nullptr)
else
{
BlockInputStreams res;
return res;
}
}
else
final_parts_with_ranges = &parts_with_ranges;
LOG_DEBUG(log, "Selected " << parts.size() << " parts by date, " << final_parts_with_ranges->size() << " parts by key, "