Better shutdown handling

This commit is contained in:
alesapin 2023-10-16 10:24:54 +02:00
parent 929e400e79
commit 26a8aa441c

View File

@ -5763,6 +5763,9 @@ void StorageReplicatedMergeTree::alter(
while (true) while (true)
{ {
if (shutdown_called || partial_shutdown_called)
throw Exception(ErrorCodes::ABORTED, "Cannot assing alter because shutdown called");
bool pulled_queue = false; bool pulled_queue = false;
std::optional<int32_t> maybe_mutations_version_after_logs_pull; std::optional<int32_t> maybe_mutations_version_after_logs_pull;
std::map<std::string, MutationCommands> unfinished_mutations; std::map<std::string, MutationCommands> unfinished_mutations;
@ -5770,6 +5773,9 @@ void StorageReplicatedMergeTree::alter(
{ {
if (command.isDropSomething()) if (command.isDropSomething())
{ {
if (shutdown_called || partial_shutdown_called)
throw Exception(ErrorCodes::ABORTED, "Cannot assing alter because shutdown called");
if (!pulled_queue) if (!pulled_queue)
{ {
auto [_, mutations_version] = queue.pullLogsToQueue(zookeeper, {}, ReplicatedMergeTreeQueue::SYNC); auto [_, mutations_version] = queue.pullLogsToQueue(zookeeper, {}, ReplicatedMergeTreeQueue::SYNC);