2016-10-30 08:15:55 +00:00
|
|
|
#pragma once
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Storages/MergeTree/MergeSelector.h>
|
2016-10-30 08:15:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-10-31 19:32:08 +00:00
|
|
|
/** Select parts to merge based on its level.
|
2016-12-05 21:34:46 +00:00
|
|
|
* Select first range of parts of parts_to_merge length with minimum level.
|
2016-10-31 19:32:08 +00:00
|
|
|
*/
|
2016-10-30 08:15:55 +00:00
|
|
|
class LevelMergeSelector : public IMergeSelector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Settings
|
|
|
|
{
|
2016-12-05 21:34:46 +00:00
|
|
|
size_t parts_to_merge = 10;
|
2016-10-30 08:15:55 +00:00
|
|
|
};
|
|
|
|
|
2019-08-03 11:02:40 +00:00
|
|
|
explicit LevelMergeSelector(const Settings & settings_) : settings(settings_) {}
|
2016-10-30 08:15:55 +00:00
|
|
|
|
2020-09-03 13:29:18 +00:00
|
|
|
PartsRange select(
|
|
|
|
const PartsRanges & parts_ranges,
|
2022-03-13 12:23:51 +00:00
|
|
|
size_t max_total_size_to_merge) override;
|
2016-10-30 08:15:55 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Settings settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|