ClickHouse/dbms/src/Storages/MergeTree/ReplicatedMergeTreeAlterThread.h
Alexey Zatelepin b6aa7542d0 add BackgroundSchedulePool::TaskInfo::activateAndSchedule() method
Almost always it (and not activate()) is precisely what is needed.
2018-08-22 16:43:27 +03:00

40 lines
822 B
C++

#pragma once
#include <thread>
#include <Core/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_);
void start() { task->activateAndSchedule(); }
void stop() { task->deactivate(); }
private:
void run();
StorageReplicatedMergeTree & storage;
String log_name;
Logger * log;
BackgroundSchedulePool::TaskHolder task;
};
}