From 26a8aa441cf81a4dd5a329e0fc0a0de0b6f6dbe3 Mon Sep 17 00:00:00 2001 From: alesapin Date: Mon, 16 Oct 2023 10:24:54 +0200 Subject: [PATCH] Better shutdown handling --- src/Storages/StorageReplicatedMergeTree.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Storages/StorageReplicatedMergeTree.cpp b/src/Storages/StorageReplicatedMergeTree.cpp index 0485fe687e8..91c004e0883 100644 --- a/src/Storages/StorageReplicatedMergeTree.cpp +++ b/src/Storages/StorageReplicatedMergeTree.cpp @@ -5763,6 +5763,9 @@ void StorageReplicatedMergeTree::alter( while (true) { + if (shutdown_called || partial_shutdown_called) + throw Exception(ErrorCodes::ABORTED, "Cannot assing alter because shutdown called"); + bool pulled_queue = false; std::optional maybe_mutations_version_after_logs_pull; std::map unfinished_mutations; @@ -5770,6 +5773,9 @@ void StorageReplicatedMergeTree::alter( { if (command.isDropSomething()) { + if (shutdown_called || partial_shutdown_called) + throw Exception(ErrorCodes::ABORTED, "Cannot assing alter because shutdown called"); + if (!pulled_queue) { auto [_, mutations_version] = queue.pullLogsToQueue(zookeeper, {}, ReplicatedMergeTreeQueue::SYNC);