This commit is contained in:
Alexander Kuzmenkov 2020-07-28 19:58:19 +03:00
parent 297cf65f1f
commit 1b9269ae0c

View File

@ -565,10 +565,9 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
useful_indices.emplace_back(index_helper, condition);
}
/// Let's find what range to read from each part.
size_t sum_marks_pk = 0;
RangesInDataParts parts_with_ranges(parts.size());
size_t sum_marks = 0;
std::atomic<size_t> sum_marks_pk = 0;
size_t sum_ranges = 0;
/// Let's find what range to read from each part.
@ -592,8 +591,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
}
}
if (!ranges.ranges.empty())
sum_marks_pk += ranges.getMarksCount();
sum_marks_pk.fetch_add(ranges.getMarksCount(), std::memory_order_relaxed);
for (const auto & index_and_condition : useful_indices)
ranges.ranges = filterMarksUsingIndex(
@ -641,7 +639,7 @@ Pipes MergeTreeDataSelectExecutor::readFromParts(
parts_with_ranges.resize(next_part);
}
LOG_DEBUG(log, "Selected {} parts by date, {} parts by key, {} marks by primary key, {} marks to read from {} ranges", parts.size(), parts_with_ranges.size(), sum_marks_pk, sum_marks, sum_ranges);
LOG_DEBUG(log, "Selected {} parts by date, {} parts by key, {} marks by primary key, {} marks to read from {} ranges", parts.size(), parts_with_ranges.size(), sum_marks_pk.load(std::memory_order_relaxed), sum_marks, sum_ranges);
if (parts_with_ranges.empty())
return {};