From 86d945a6933d676bf066ec0dcefaf96f4e28387f Mon Sep 17 00:00:00 2001 From: lzydmxy <13126752315@163.com> Date: Wed, 22 Nov 2023 22:14:51 +0800 Subject: [PATCH] reorder raft server shutdown --- src/Service/KeeperServer.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Service/KeeperServer.cpp b/src/Service/KeeperServer.cpp index e8013fd75e..23cc22f419 100644 --- a/src/Service/KeeperServer.cpp +++ b/src/Service/KeeperServer.cpp @@ -103,15 +103,18 @@ int32 KeeperServer::getLeader() void KeeperServer::shutdown() { - LOG_INFO(log, "Shutting down keeper server."); - state_machine->shutdown(); + LOG_INFO(log, "Shutting down raft core."); + if (!launcher.shutdown(settings->raft_settings->shutdown_timeout)) + LOG_WARNING(log, "Failed to shutdown raft server in {} seconds", 5); + + LOG_INFO(log, "Flush Log store."); if (state_manager->load_log_store() && !state_manager->load_log_store()->flush()) LOG_WARNING(log, "Log store flush error while server shutdown."); dynamic_cast(*state_manager->load_log_store()).shutdown(); - if (!launcher.shutdown(settings->raft_settings->shutdown_timeout)) - LOG_WARNING(log, "Failed to shutdown RAFT server in {} seconds", 5); + LOG_INFO(log, "Shutting down state machine."); + state_machine->shutdown(); LOG_INFO(log, "Shut down keeper server done!"); }