2020-10-13 14:25:42 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <Storages/MergeTree/MergeTreeData.h>
|
|
|
|
#include <Common/ThreadPool.h>
|
|
|
|
#include <Storages/MergeTree/MergeTreeBackgroundJob.h>
|
|
|
|
#include <Core/BackgroundSchedulePool.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class BackgroundJobsExecutor
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
MergeTreeData & data;
|
2020-10-14 07:22:48 +00:00
|
|
|
Context & global_context;
|
2020-10-13 14:25:42 +00:00
|
|
|
ThreadPool data_processing_pool;
|
|
|
|
ThreadPool move_pool;
|
|
|
|
|
|
|
|
BackgroundSchedulePool::TaskHolder data_processing_task;
|
2020-10-14 07:22:48 +00:00
|
|
|
BackgroundSchedulePool::TaskHolder data_moving_task;
|
2020-10-13 14:25:42 +00:00
|
|
|
|
|
|
|
void dataProcessingTask();
|
2020-10-14 07:22:48 +00:00
|
|
|
void dataMovingTask();
|
2020-10-13 14:25:42 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
BackgroundJobsExecutor(
|
|
|
|
MergeTreeData & data_,
|
|
|
|
Context & global_context_);
|
|
|
|
|
2020-10-14 07:22:48 +00:00
|
|
|
void startMovingTaskIfNeeded();
|
2020-10-13 14:25:42 +00:00
|
|
|
void triggerDataProcessing();
|
|
|
|
void triggerMovesProcessing();
|
|
|
|
void start();
|
|
|
|
void finish();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|