aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h
diff options
context:
space:
mode:
authorvitalyisaev <vitalyisaev@ydb.tech>2023-11-14 09:58:56 +0300
committervitalyisaev <vitalyisaev@ydb.tech>2023-11-14 10:20:20 +0300
commitc2b2dfd9827a400a8495e172a56343462e3ceb82 (patch)
treecd4e4f597d01bede4c82dffeb2d780d0a9046bd0 /contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h
parentd4ae8f119e67808cb0cf776ba6e0cf95296f2df7 (diff)
downloadydb-c2b2dfd9827a400a8495e172a56343462e3ceb82.tar.gz
YQ Connector: move tests from yql to ydb (OSS)
Перенос папки с тестами на Коннектор из папки yql в папку ydb (синхронизируется с github).
Diffstat (limited to 'contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h')
-rw-r--r--contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h b/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h
new file mode 100644
index 0000000000..04297f2852
--- /dev/null
+++ b/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationEntry.h
@@ -0,0 +1,64 @@
+#pragma once
+
+#include <base/types.h>
+#include <Disks/IDisk.h>
+#include <Storages/MergeTree/MergeTreePartInfo.h>
+#include <Storages/MutationCommands.h>
+#include <Common/TransactionID.h>
+
+
+namespace DB
+{
+class IBackupEntry;
+
+/// A mutation entry for non-replicated MergeTree storage engines.
+/// Stores information about mutation in file mutation_*.txt.
+struct MergeTreeMutationEntry
+{
+ time_t create_time = 0;
+ MutationCommands commands;
+
+ DiskPtr disk;
+ String path_prefix;
+ String file_name;
+ bool is_temp = false;
+
+ UInt64 block_number = 0;
+
+ String latest_failed_part;
+ MergeTreePartInfo latest_failed_part_info;
+ time_t latest_fail_time = 0;
+ String latest_fail_reason;
+
+ /// ID of transaction which has created mutation.
+ TransactionID tid = Tx::PrehistoricTID;
+ /// CSN of transaction which has created mutation
+ /// or UnknownCSN if it's not committed (yet) or RolledBackCSN if it's rolled back or PrehistoricCSN if there is no transaction.
+ CSN csn = Tx::UnknownCSN;
+
+ /// Create a new entry and write it to a temporary file.
+ MergeTreeMutationEntry(MutationCommands commands_, DiskPtr disk, const String & path_prefix_, UInt64 tmp_number,
+ const TransactionID & tid_, const WriteSettings & settings);
+ MergeTreeMutationEntry(const MergeTreeMutationEntry &) = delete;
+ MergeTreeMutationEntry(MergeTreeMutationEntry &&) = default;
+
+ /// Commit entry and rename it to a permanent file.
+ void commit(UInt64 block_number_);
+
+ void removeFile();
+
+ void writeCSN(CSN csn_);
+
+ std::shared_ptr<const IBackupEntry> backup() const;
+
+ static String versionToFileName(UInt64 block_number_);
+ static UInt64 tryParseFileName(const String & file_name_);
+ static UInt64 parseFileName(const String & file_name_);
+
+ /// Load an existing entry.
+ MergeTreeMutationEntry(DiskPtr disk_, const String & path_prefix_, const String & file_name_);
+
+ ~MergeTreeMutationEntry();
+};
+
+}