1#pragma once
2
3#include <Storages/MergeTree/MergeSelector.h>
4
5
6namespace DB
7{
8
9/** Select parts to merge based on its level.
10 * Select first range of parts of parts_to_merge length with minimum level.
11 */
12class LevelMergeSelector : public IMergeSelector
13{
14public:
15 struct Settings
16 {
17 size_t parts_to_merge = 10;
18 };
19
20 explicit LevelMergeSelector(const Settings & settings_) : settings(settings_) {}
21
22 PartsInPartition select(
23 const Partitions & partitions,
24 const size_t max_total_size_to_merge) override;
25
26private:
27 const Settings settings;
28};
29
30}
31