2016-10-30 08:15:55 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Storages/MergeTree/MergeSelector.h>
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
LevelMergeSelector(const Settings & settings) : settings(settings) {}
|
|
|
|
|
|
|
|
PartsInPartition select(
|
|
|
|
const Partitions & partitions,
|
|
|
|
const size_t max_total_size_to_merge) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const Settings settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|