2018-06-07 13:28:39 +00:00
|
|
|
#pragma once
|
|
|
|
|
2021-10-02 07:13:14 +00:00
|
|
|
#include <base/types.h>
|
2020-07-22 12:36:19 +00:00
|
|
|
#include <Core/Names.h>
|
|
|
|
#include <optional>
|
2018-06-07 13:28:39 +00:00
|
|
|
#include <map>
|
2020-07-23 08:00:18 +00:00
|
|
|
#include <ctime>
|
2018-06-07 13:28:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-07-22 12:36:19 +00:00
|
|
|
|
2018-06-07 13:28:39 +00:00
|
|
|
struct MergeTreeMutationStatus
|
|
|
|
{
|
|
|
|
String id;
|
|
|
|
String command;
|
|
|
|
time_t create_time = 0;
|
|
|
|
std::map<String, Int64> block_numbers;
|
2018-06-18 12:17:46 +00:00
|
|
|
|
2019-12-12 16:24:03 +00:00
|
|
|
/// Parts that should be mutated/merged or otherwise moved to Obsolete state for this mutation to complete.
|
|
|
|
Names parts_to_do_names;
|
2018-06-21 13:27:36 +00:00
|
|
|
|
|
|
|
/// If the mutation is done. Note that in case of ReplicatedMergeTree parts_to_do == 0 doesn't imply is_done == true.
|
|
|
|
bool is_done = false;
|
2019-01-10 17:06:27 +00:00
|
|
|
|
|
|
|
String latest_failed_part;
|
|
|
|
time_t latest_fail_time = 0;
|
|
|
|
String latest_fail_reason;
|
2018-06-07 13:28:39 +00:00
|
|
|
};
|
|
|
|
|
2020-07-22 12:36:19 +00:00
|
|
|
/// Check mutation status and throw exception in case of error during mutation
|
|
|
|
/// (latest_fail_reason not empty) or if mutation was killed (status empty
|
2020-07-22 15:19:54 +00:00
|
|
|
/// optional). mutation_ids passed separately, because status may be empty and
|
|
|
|
/// we can execute multiple mutations at once
|
2020-07-31 11:37:16 +00:00
|
|
|
void checkMutationStatus(std::optional<MergeTreeMutationStatus> & status, const std::set<String> & mutation_ids);
|
2020-07-22 12:36:19 +00:00
|
|
|
|
2018-06-07 13:28:39 +00:00
|
|
|
}
|