1#pragma once
2
3#include <thread>
4#include <Core/BackgroundSchedulePool.h>
5#include <Common/ZooKeeper/Types.h>
6#include <Common/ZooKeeper/ZooKeeperNodeCache.h>
7#include <Core/Types.h>
8#include <common/logger_useful.h>
9
10
11namespace DB
12{
13
14class StorageReplicatedMergeTree;
15
16
17/** Keeps track of changing the table structure in ZooKeeper and performs the necessary conversions.
18 *
19 * NOTE This has nothing to do with manipulating partitions,
20 * which are processed through the replication queue.
21 */
22class ReplicatedMergeTreeAlterThread
23{
24public:
25 ReplicatedMergeTreeAlterThread(StorageReplicatedMergeTree & storage_);
26
27 void start() { task->activateAndSchedule(); }
28
29 void stop() { task->deactivate(); }
30
31private:
32 void run();
33
34 StorageReplicatedMergeTree & storage;
35 zkutil::ZooKeeperNodeCache zk_node_cache;
36 String log_name;
37 Logger * log;
38 BackgroundSchedulePool::TaskHolder task;
39 bool force_recheck_parts = true;
40};
41
42}
43