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:
|
2017-04-01 07:20:54 +00:00
|
|
|
struct Settings
|
|
|
|
{
|
|
|
|
size_t parts_to_merge = 10;
|
|
|
|
};
|
2016-10-30 08:15:55 +00:00
|
|
|
|
2017-09-07 21:26:25 +00:00
|
|
|
explicit LevelMergeSelector(const Settings & settings) : settings(settings) {}
|
2016-10-30 08:15:55 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
PartsInPartition select(
|
|
|
|
const Partitions & partitions,
|
|
|
|
const size_t max_total_size_to_merge) override;
|
2016-10-30 08:15:55 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
const Settings settings;
|
2016-10-30 08:15:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|