mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-09 18:10:48 +00:00
cc7950a733
Otherwise segfaults are possible when the objects are recreated in the middle of the queue task execution.
44 lines
855 B
C++
44 lines
855 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_);
|
|
|
|
void start()
|
|
{
|
|
task->activate();
|
|
task->schedule();
|
|
}
|
|
|
|
void stop() { task->deactivate(); }
|
|
|
|
private:
|
|
void run();
|
|
|
|
StorageReplicatedMergeTree & storage;
|
|
String log_name;
|
|
Logger * log;
|
|
BackgroundSchedulePool::TaskHolder task;
|
|
};
|
|
|
|
}
|