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;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Удаляет устаревшие данные таблицы типа ReplicatedMergeTree.
|
|
|
|
|
*/
|
|
|
|
|
class ReplicatedMergeTreeCleanupThread
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
ReplicatedMergeTreeCleanupThread(StorageReplicatedMergeTree & storage_);
|
|
|
|
|
|
|
|
|
|
~ReplicatedMergeTreeCleanupThread()
|
|
|
|
|
{
|
|
|
|
|
if (thread.joinable())
|
|
|
|
|
thread.join();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
StorageReplicatedMergeTree & storage;
|
|
|
|
|
Logger * log;
|
2014-10-15 13:38:09 +00:00
|
|
|
|
std::thread thread;
|
2014-10-15 01:22:06 +00:00
|
|
|
|
|
|
|
|
|
void run();
|
|
|
|
|
void iterate();
|
|
|
|
|
|
|
|
|
|
/// Удалить старые куски с диска и из ZooKeeper.
|
|
|
|
|
void clearOldParts();
|
|
|
|
|
|
|
|
|
|
/// Удалить из ZooKeeper старые записи в логе.
|
|
|
|
|
void clearOldLogs();
|
|
|
|
|
|
|
|
|
|
/// Удалить из ZooKeeper старые хеши блоков. Это делает ведущая реплика.
|
|
|
|
|
void clearOldBlocks();
|
2015-09-20 11:02:59 +00:00
|
|
|
|
|
|
|
|
|
/// TODO Удаление старых quorum/failed_parts
|
2015-09-23 02:39:07 +00:00
|
|
|
|
/// TODO Удаление старых nonincrement_block_numbers
|
2014-10-15 01:22:06 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|