2016-10-27 22:50:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Storages/MergeTree/MergeSelector.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-10-27 23:28:35 +00:00
|
|
|
struct Estimator;
|
|
|
|
|
2016-10-27 22:50:02 +00:00
|
|
|
class SimpleMergeSelector : public IMergeSelector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Settings
|
|
|
|
{
|
|
|
|
size_t min_parts_to_merge_at_once = 8;
|
|
|
|
size_t max_parts_to_merge_at_once = 100;
|
|
|
|
|
|
|
|
double max_nonuniformity_of_sizes_to_merge = 2;
|
2016-10-27 23:28:35 +00:00
|
|
|
|
|
|
|
time_t lower_min_parts_to_merge_at_once_starting_at_time = 300;
|
|
|
|
size_t lower_min_parts_to_merge_at_once_base_of_exponent = 4;
|
2016-10-27 22:50:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SimpleMergeSelector(const Settings & settings) : settings(settings) {}
|
|
|
|
|
|
|
|
PartsInPartition select(
|
|
|
|
const Partitions & partitions,
|
|
|
|
CanMergePart can_merge_part,
|
|
|
|
CanMergeAdjacent can_merge_adjacent,
|
|
|
|
const size_t max_total_size_to_merge,
|
2016-10-27 23:28:35 +00:00
|
|
|
bool aggressive_mode) override;
|
2016-10-27 22:50:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Settings settings;
|
|
|
|
|
|
|
|
void selectWithinPartition(
|
|
|
|
const PartsInPartition & parts,
|
|
|
|
CanMergePart can_merge_part,
|
|
|
|
CanMergeAdjacent can_merge_adjacent,
|
|
|
|
const size_t max_total_size_to_merge,
|
|
|
|
bool aggressive_mode,
|
2016-10-27 23:28:35 +00:00
|
|
|
Estimator & estimator);
|
2016-10-27 22:50:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|