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:
|
2017-04-01 07:20:54 +00:00
|
|
|
ReplicatedMergeTreeCleanupThread(StorageReplicatedMergeTree & storage_);
|
2014-10-15 01:22:06 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
~ReplicatedMergeTreeCleanupThread()
|
|
|
|
{
|
|
|
|
if (thread.joinable())
|
|
|
|
thread.join();
|
|
|
|
}
|
2014-10-15 01:22:06 +00:00
|
|
|
|
|
|
|
private:
|
2017-04-01 07:20:54 +00:00
|
|
|
StorageReplicatedMergeTree & storage;
|
|
|
|
Logger * log;
|
|
|
|
std::thread thread;
|
2014-10-15 01:22:06 +00:00
|
|
|
|
2017-04-01 07:20:54 +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.
|
2017-04-01 07:20:54 +00:00
|
|
|
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.
|
2017-04-01 07:20:54 +00:00
|
|
|
void clearOldBlocks();
|
2015-09-20 11:02:59 +00:00
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|