blob: 5e406c6e4f74133236cb930773e05668074367a4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <Storages/MergeTree/AllMergeSelector.h>
#include <cmath>
namespace DB
{
AllMergeSelector::PartsRange AllMergeSelector::select(
const PartsRanges & parts_ranges,
size_t /*max_total_size_to_merge*/)
{
size_t min_partition_size = 0;
PartsRanges::const_iterator best_partition;
for (auto it = parts_ranges.begin(); it != parts_ranges.end(); ++it)
{
if (it->size() <= 1)
continue;
size_t sum_size = 0;
for (const auto & part : *it)
sum_size += part.size;
if (!min_partition_size || sum_size < min_partition_size)
{
min_partition_size = sum_size;
best_partition = it;
}
}
if (min_partition_size)
return *best_partition;
else
return {};
}
}
|