fix last comments

This commit is contained in:
antoniofilipovic 2024-03-23 18:24:10 +01:00
parent 68c1d2526e
commit cd6bd9e350
3 changed files with 4 additions and 7 deletions

View File

@ -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.");
});

View File

@ -39,7 +39,7 @@ auto CoordinatorStateMachine::CreateLog(nlohmann::json &&log) -> ptr<buffer> {
}
auto CoordinatorStateMachine::SerializeOpenLock() -> ptr<buffer> {
return CreateLog({{"action", RaftLogAction::OPEN_LOCK}, {"info", nullptr}});
return CreateLog({{"action", RaftLogAction::OPEN_LOCK}});
}
auto CoordinatorStateMachine::SerializeRegisterInstance(CoordinatorToReplicaConfig const &config) -> ptr<buffer> {

View File

@ -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<std::monostate, CoordinatorToReplicaConfig, std::string, utils::UUID,
CoordinatorToCoordinatorConfig, InstanceUUIDUpdate>;
using TRaftLog = std::variant<std::string, utils::UUID, CoordinatorToReplicaConfig, CoordinatorToCoordinatorConfig,
InstanceUUIDUpdate, std::monostate>;
using nuraft::buffer;
using nuraft::buffer_serializer;