mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-19 14:11:58 +00:00
64619c614f
- We add BackgroundSchedulePool which can execute a function at a specific point in time. Basically all tasks are added in a queue and precessed by worker threads. - The most important difference between this and BackgroundProcessingPool is that we have the guarantee that the same function is not executed from many workers in the same time - Each of the following classes instead starting a thread will register a task in BackgroundSchedulePool and when they need to run will call schedule or scheduleAfter(duration) functions This commit is moving all threads created by ReplicatedMergeTree to BackgroundSchedulePool tasks NOTE: I did a minimum number of changes to be much simple to review the code
36 lines
757 B
C++
36 lines
757 B
C++
#pragma once
|
|
|
|
#include <thread>
|
|
#include <Common/BackgroundSchedulePool.h>
|
|
#include <Common/ZooKeeper/Types.h>
|
|
#include <Core/Types.h>
|
|
#include <common/logger_useful.h>
|
|
|
|
|
|
namespace DB
|
|
{
|
|
|
|
class StorageReplicatedMergeTree;
|
|
|
|
|
|
/** Keeps track of changing the table structure in ZooKeeper and performs the necessary conversions.
|
|
*
|
|
* NOTE This has nothing to do with manipulating partitions,
|
|
* which are processed through the replication queue.
|
|
*/
|
|
class ReplicatedMergeTreeAlterThread
|
|
{
|
|
public:
|
|
ReplicatedMergeTreeAlterThread(StorageReplicatedMergeTree & storage_);
|
|
~ReplicatedMergeTreeAlterThread();
|
|
|
|
private:
|
|
void run();
|
|
|
|
StorageReplicatedMergeTree & storage;
|
|
Logger * log;
|
|
BackgroundSchedulePool::TaskHandle task_handle;
|
|
};
|
|
|
|
}
|