2016-10-27 22:50:02 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <DB/Storages/MergeTree/MergeSelector.h>
|
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class SimpleMergeSelector : public IMergeSelector
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct Settings
|
|
|
|
{
|
2016-10-30 03:12:25 +00:00
|
|
|
/** Minimum ratio of size of one part to all parts in set of parts to merge (for usual cases).
|
|
|
|
* For example, if all parts have equal size, it means, that at least 'base' number of parts should be merged.
|
|
|
|
* If parts has non-uniform sizes, then minumum number of parts to merge is effectively increased.
|
|
|
|
* This behaviour balances merge-tree workload.
|
|
|
|
* It called 'base', because merge-tree depth could be estimated as logarithm with that base.
|
|
|
|
*/
|
2016-11-01 19:20:24 +00:00
|
|
|
double base = 2;
|
2016-11-01 08:38:55 +00:00
|
|
|
|
2016-11-01 19:20:24 +00:00
|
|
|
time_t lower_base_after_seconds = 300;
|
2016-11-01 08:38:55 +00:00
|
|
|
size_t lower_base_after_num_parts = 20;
|
2016-10-27 23:28:35 +00:00
|
|
|
|
2016-10-30 03:12:25 +00:00
|
|
|
/// Zero means unlimited.
|
|
|
|
size_t max_parts_to_merge_at_once = 100;
|
2016-10-27 22:50:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
SimpleMergeSelector(const Settings & settings) : settings(settings) {}
|
|
|
|
|
|
|
|
PartsInPartition select(
|
|
|
|
const Partitions & partitions,
|
2016-10-30 03:12:25 +00:00
|
|
|
const size_t max_total_size_to_merge) override;
|
2016-10-27 22:50:02 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const Settings settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|