2018-03-30 19:25:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-09-15 09:55:57 +00:00
|
|
|
#include <common/types.h>
|
2020-02-27 16:47:40 +00:00
|
|
|
#include <Disks/IDisk.h>
|
2019-01-10 17:06:27 +00:00
|
|
|
#include <Storages/MergeTree/MergeTreePartInfo.h>
|
2020-02-27 16:47:40 +00:00
|
|
|
#include <Storages/MutationCommands.h>
|
2018-03-30 19:25:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
/// A mutation entry for non-replicated MergeTree storage engines.
|
2019-09-04 17:26:53 +00:00
|
|
|
/// Stores information about mutation in file mutation_*.txt.
|
2018-03-30 19:25:37 +00:00
|
|
|
struct MergeTreeMutationEntry
|
|
|
|
{
|
|
|
|
time_t create_time = 0;
|
|
|
|
MutationCommands commands;
|
2018-07-11 12:43:55 +00:00
|
|
|
|
2020-02-27 16:47:40 +00:00
|
|
|
DiskPtr disk;
|
2018-07-11 12:43:55 +00:00
|
|
|
String path_prefix;
|
|
|
|
String file_name;
|
|
|
|
bool is_temp = false;
|
|
|
|
|
|
|
|
Int64 block_number = 0;
|
|
|
|
|
2019-01-10 17:06:27 +00:00
|
|
|
String latest_failed_part;
|
|
|
|
MergeTreePartInfo latest_failed_part_info;
|
|
|
|
time_t latest_fail_time = 0;
|
|
|
|
String latest_fail_reason;
|
|
|
|
|
2018-07-11 12:43:55 +00:00
|
|
|
/// Create a new entry and write it to a temporary file.
|
2020-02-27 16:47:40 +00:00
|
|
|
MergeTreeMutationEntry(MutationCommands commands_, DiskPtr disk, const String & path_prefix_, Int64 tmp_number);
|
2018-07-31 12:34:34 +00:00
|
|
|
MergeTreeMutationEntry(const MergeTreeMutationEntry &) = delete;
|
|
|
|
MergeTreeMutationEntry(MergeTreeMutationEntry &&) = default;
|
2018-07-11 12:43:55 +00:00
|
|
|
|
|
|
|
/// Commit entry and rename it to a permanent file.
|
|
|
|
void commit(Int64 block_number_);
|
|
|
|
|
|
|
|
void removeFile();
|
|
|
|
|
|
|
|
/// Load an existing entry.
|
2020-02-27 16:47:40 +00:00
|
|
|
MergeTreeMutationEntry(DiskPtr disk_, const String & path_prefix_, const String & file_name_);
|
2018-07-11 12:43:55 +00:00
|
|
|
|
|
|
|
~MergeTreeMutationEntry();
|
2018-03-30 19:25:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|