From cd6bd9e3506bc68f1e1eace67e7fb7479213d29f Mon Sep 17 00:00:00 2001 From: antoniofilipovic Date: Sat, 23 Mar 2024 18:24:10 +0100 Subject: [PATCH] fix last comments --- src/coordination/coordinator_instance.cpp | 5 +---- src/coordination/coordinator_state_machine.cpp | 2 +- .../include/nuraft/coordinator_cluster_state.hpp | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/coordination/coordinator_instance.cpp b/src/coordination/coordinator_instance.cpp index 2415b5e05..91de37e67 100644 --- a/src/coordination/coordinator_instance.cpp +++ b/src/coordination/coordinator_instance.cpp @@ -80,15 +80,12 @@ CoordinatorInstance::CoordinatorInstance() // We need to stop checks before taking a lock because deadlock can happen if instances waits // to take a lock in frequent check, and this thread already has a lock and waits for instance to // be done with frequent check - for (auto &repl_instance : repl_instances_) { - repl_instance.StopFrequentCheck(); - } - auto lock = std::unique_lock{coord_instance_lock_}; std::ranges::for_each(repl_instances_, [](auto &repl_instance) { spdlog::trace("Stopping frequent checks for instance {}", repl_instance.InstanceName()); repl_instance.StopFrequentCheck(); spdlog::trace("Stopped frequent checks for instance {}", repl_instance.InstanceName()); }); + auto lock = std::unique_lock{coord_instance_lock_}; repl_instances_.clear(); spdlog::info("Stopped all replication instance frequent checks."); }); diff --git a/src/coordination/coordinator_state_machine.cpp b/src/coordination/coordinator_state_machine.cpp index 2bc21477c..06caa05ef 100644 --- a/src/coordination/coordinator_state_machine.cpp +++ b/src/coordination/coordinator_state_machine.cpp @@ -39,7 +39,7 @@ auto CoordinatorStateMachine::CreateLog(nlohmann::json &&log) -> ptr { } auto CoordinatorStateMachine::SerializeOpenLock() -> ptr { - return CreateLog({{"action", RaftLogAction::OPEN_LOCK}, {"info", nullptr}}); + return CreateLog({{"action", RaftLogAction::OPEN_LOCK}}); } auto CoordinatorStateMachine::SerializeRegisterInstance(CoordinatorToReplicaConfig const &config) -> ptr { diff --git a/src/coordination/include/nuraft/coordinator_cluster_state.hpp b/src/coordination/include/nuraft/coordinator_cluster_state.hpp index 9b9f2fe18..d922e3af0 100644 --- a/src/coordination/include/nuraft/coordinator_cluster_state.hpp +++ b/src/coordination/include/nuraft/coordinator_cluster_state.hpp @@ -64,8 +64,8 @@ struct CoordinatorInstanceState { void to_json(nlohmann::json &j, ReplicationInstanceState const &instance_state); void from_json(nlohmann::json const &j, ReplicationInstanceState &instance_state); -using TRaftLog = std::variant; +using TRaftLog = std::variant; using nuraft::buffer; using nuraft::buffer_serializer;