ClickHouse/dbms/src/Storages/MergeTree/ReplicatedMergeTreeCleanupThread.h

46 lines
843 B
C++
Raw Normal View History

2014-10-15 01:22:06 +00:00
#pragma once
2015-09-29 19:19:54 +00:00
#include <common/logger_useful.h>
2014-10-15 01:22:06 +00:00
#include <thread>
namespace DB
{
class StorageReplicatedMergeTree;
2017-04-16 15:00:33 +00:00
/** Removes obsolete data from a table of type ReplicatedMergeTree.
2014-10-15 01:22:06 +00:00
*/
class ReplicatedMergeTreeCleanupThread
{
public:
ReplicatedMergeTreeCleanupThread(StorageReplicatedMergeTree & storage_);
2014-10-15 01:22:06 +00:00
~ReplicatedMergeTreeCleanupThread()
{
if (thread.joinable())
thread.join();
}
2014-10-15 01:22:06 +00:00
private:
StorageReplicatedMergeTree & storage;
Logger * log;
std::thread thread;
2014-10-15 01:22:06 +00:00
void run();
void iterate();
2014-10-15 01:22:06 +00:00
2017-04-16 15:00:33 +00:00
/// Remove old records from ZooKeeper.
void clearOldLogs();
2014-10-15 01:22:06 +00:00
2017-04-16 15:00:33 +00:00
/// Remove old block hashes from ZooKeeper. This makes a leading replica.
void clearOldBlocks();
2017-04-16 15:00:33 +00:00
/// TODO Removing old quorum/failed_parts
/// TODO Removing old nonincrement_block_numbers
2014-10-15 01:22:06 +00:00
};
}