| 1 | #pragma once | 
|---|---|
| 2 | |
| 3 | #include <Core/Types.h> | 
| 4 | #include <Storages/MutationCommands.h> | 
| 5 | #include <Storages/MergeTree/MergeTreePartInfo.h> | 
| 6 | |
| 7 | |
| 8 | namespace DB | 
| 9 | { | 
| 10 | |
| 11 | /// A mutation entry for non-replicated MergeTree storage engines. | 
| 12 | /// Stores information about mutation in file mutation_*.txt. | 
| 13 | struct MergeTreeMutationEntry | 
| 14 | { | 
| 15 | time_t create_time = 0; | 
| 16 | MutationCommands commands; | 
| 17 | |
| 18 | String path_prefix; | 
| 19 | String file_name; | 
| 20 | bool is_temp = false; | 
| 21 | |
| 22 | Int64 block_number = 0; | 
| 23 | |
| 24 | String latest_failed_part; | 
| 25 | MergeTreePartInfo latest_failed_part_info; | 
| 26 | time_t latest_fail_time = 0; | 
| 27 | String latest_fail_reason; | 
| 28 | |
| 29 | /// Create a new entry and write it to a temporary file. | 
| 30 | MergeTreeMutationEntry(MutationCommands commands_, const String & path_prefix_, Int64 tmp_number); | 
| 31 | MergeTreeMutationEntry(const MergeTreeMutationEntry &) = delete; | 
| 32 | MergeTreeMutationEntry(MergeTreeMutationEntry &&) = default; | 
| 33 | |
| 34 | /// Commit entry and rename it to a permanent file. | 
| 35 | void commit(Int64 block_number_); | 
| 36 | |
| 37 | void removeFile(); | 
| 38 | |
| 39 | /// Load an existing entry. | 
| 40 | MergeTreeMutationEntry(const String & path_prefix_, const String & file_name_); | 
| 41 | |
| 42 | ~MergeTreeMutationEntry(); | 
| 43 | }; | 
| 44 | |
| 45 | } | 
| 46 | 
