aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationStatus.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/MergeTreeMutationStatus.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/MergeTreeMutationStatus.h')
-rw-r--r--contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationStatus.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationStatus.h b/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationStatus.h
new file mode 100644
index 0000000000..b6f62e1218
--- /dev/null
+++ b/contrib/clickhouse/src/Storages/MergeTree/MergeTreeMutationStatus.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include <base/types.h>
+#include <Core/Names.h>
+#include <optional>
+#include <map>
+#include <ctime>
+
+
+namespace DB
+{
+
+
+struct MergeTreeMutationStatus
+{
+ String id = "";
+ String command = "";
+ time_t create_time = 0;
+ std::map<String, Int64> block_numbers{};
+
+ /// Parts that should be mutated/merged or otherwise moved to Obsolete state for this mutation to complete.
+ Names parts_to_do_names = {};
+
+ /// 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;
+
+ String latest_failed_part = "";
+ time_t latest_fail_time = 0;
+ String latest_fail_reason = "";
+
+ /// FIXME: currently unused, but would be much better to report killed mutations with this flag.
+ bool is_killed = false;
+};
+
+/// Check mutation status and throw exception in case of error during mutation
+/// (latest_fail_reason not empty) or if mutation was killed (status empty
+/// optional). mutation_ids passed separately, because status may be empty and
+/// we can execute multiple mutations at once
+void checkMutationStatus(std::optional<MergeTreeMutationStatus> & status, const std::set<String> & mutation_ids);
+
+}