aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/ReplicatedMergeTreeMutationEntry.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/ReplicatedMergeTreeMutationEntry.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/ReplicatedMergeTreeMutationEntry.h')
-rw-r--r--contrib/clickhouse/src/Storages/MergeTree/ReplicatedMergeTreeMutationEntry.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Storages/MergeTree/ReplicatedMergeTreeMutationEntry.h b/contrib/clickhouse/src/Storages/MergeTree/ReplicatedMergeTreeMutationEntry.h
new file mode 100644
index 0000000000..3c7c9097a2
--- /dev/null
+++ b/contrib/clickhouse/src/Storages/MergeTree/ReplicatedMergeTreeMutationEntry.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include <Common/Exception.h>
+#include <base/types.h>
+#include <IO/WriteHelpers.h>
+#include <Storages/MutationCommands.h>
+#include <map>
+
+
+namespace DB
+{
+
+class ReadBuffer;
+class WriteBuffer;
+class IBackupEntry;
+
+/// Mutation entry in /mutations path in zookeeper. This record contains information about blocks
+/// in patitions. We will mutatate all parts with left number less than this numbers.
+///
+/// These entries processed separately from main replication /log, and produce other entries
+/// -- MUTATE_PART in main replication log.
+struct ReplicatedMergeTreeMutationEntry
+{
+ void writeText(WriteBuffer & out) const;
+ void readText(ReadBuffer & in);
+
+ String toString() const;
+ static ReplicatedMergeTreeMutationEntry parse(const String & str, String znode_name);
+
+ /// Name of znode (mutation-xxxxxxx)
+ String znode_name;
+
+ /// Create time of znode
+ time_t create_time = 0;
+
+ /// Replica which initiated mutation
+ String source_replica;
+
+ /// Acquired block numbers
+ /// partition_id -> block_number
+ using BlockNumbersType = std::map<String, Int64>;
+ BlockNumbersType block_numbers;
+
+ /// List of partitions that do not have relevant uncommitted blocks to mutate
+ mutable std::unordered_set<String> checked_partitions_cache;
+
+ /// Mutation commands which will give to MUTATE_PART entries
+ MutationCommands commands;
+
+ /// Version of metadata. Not equal to -1 only if this mutation
+ /// was created by ALTER MODIFY/DROP queries.
+ int alter_version = -1;
+
+ bool isAlterMutation() const { return alter_version != -1; }
+
+ std::shared_ptr<const IBackupEntry> backup() const;
+
+ String getBlockNumbersForLogs() const;
+};
+
+using ReplicatedMergeTreeMutationEntryPtr = std::shared_ptr<const ReplicatedMergeTreeMutationEntry>;
+
+}