aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/LevelMergeSelector.h
blob: f4080c379c460b7aaa6499dce9b3400307e58526 (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
#pragma once

#include <Storages/MergeTree/MergeSelector.h>


namespace DB
{

/** Select parts to merge based on its level.
  * Select first range of parts of parts_to_merge length with minimum level.
  */
class LevelMergeSelector : public IMergeSelector
{
public:
    struct Settings
    {
        size_t parts_to_merge = 10;
    };

    explicit LevelMergeSelector(const Settings & settings_) : settings(settings_) {}

    PartsRange select(
        const PartsRanges & parts_ranges,
        size_t max_total_size_to_merge) override;

private:
    const Settings settings;
};

}