2016-01-28 01:00:27 +00:00
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <DB/Storages/AlterCommands.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
|
{
|
|
|
|
|
|
2016-03-01 17:47:53 +00:00
|
|
|
|
class StorageReplicatedMergeTree;
|
|
|
|
|
|
2016-01-28 01:00:27 +00:00
|
|
|
|
/** Описание задачи перешардирования.
|
|
|
|
|
*/
|
|
|
|
|
struct ReshardingJob final
|
|
|
|
|
{
|
|
|
|
|
public:
|
2016-03-01 17:47:53 +00:00
|
|
|
|
ReshardingJob() = default;
|
|
|
|
|
|
2016-01-28 01:00:27 +00:00
|
|
|
|
/// Создаёт описание на основе его сериализованного представления.
|
|
|
|
|
ReshardingJob(const std::string & serialized_job);
|
|
|
|
|
|
|
|
|
|
ReshardingJob(const std::string & database_name_, const std::string & table_name_,
|
|
|
|
|
const std::string & partition_, const WeightedZooKeeperPaths & paths_,
|
2016-03-01 17:47:53 +00:00
|
|
|
|
const ASTPtr & sharding_key_expr_, const std::string & coordinator_id_);
|
2016-01-28 01:00:27 +00:00
|
|
|
|
|
|
|
|
|
ReshardingJob(const ReshardingJob &) = delete;
|
|
|
|
|
ReshardingJob & operator=(const ReshardingJob &) = delete;
|
|
|
|
|
|
2016-03-01 17:47:53 +00:00
|
|
|
|
ReshardingJob(ReshardingJob &&) = default;
|
|
|
|
|
ReshardingJob & operator=(ReshardingJob &&) = default;
|
|
|
|
|
|
|
|
|
|
operator bool() const;
|
|
|
|
|
|
2016-01-28 01:00:27 +00:00
|
|
|
|
/// Сериализует описание задачи.
|
|
|
|
|
std::string toString() const;
|
|
|
|
|
|
2016-03-01 17:47:53 +00:00
|
|
|
|
bool isCoordinated() const;
|
|
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
|
|
2016-01-28 01:00:27 +00:00
|
|
|
|
public:
|
|
|
|
|
std::string database_name;
|
|
|
|
|
std::string table_name;
|
|
|
|
|
std::string partition;
|
2016-03-25 11:48:45 +00:00
|
|
|
|
std::string job_name;
|
2016-01-28 01:00:27 +00:00
|
|
|
|
WeightedZooKeeperPaths paths;
|
2016-01-28 01:00:42 +00:00
|
|
|
|
ASTPtr sharding_key_expr;
|
2016-03-01 17:47:53 +00:00
|
|
|
|
std::string coordinator_id;
|
|
|
|
|
StorageReplicatedMergeTree * storage = nullptr;
|
|
|
|
|
UInt64 block_number = 0;
|
2016-03-25 11:48:45 +00:00
|
|
|
|
bool do_copy;
|
2016-03-01 17:47:53 +00:00
|
|
|
|
bool is_aborted = false;
|
2016-01-28 01:00:27 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|