From 3fff07cb3c5160dd02be45c850af126dd015a273 Mon Sep 17 00:00:00 2001 From: Jie Yao Date: Mon, 18 Nov 2024 02:37:50 -0700 Subject: [PATCH] in nuobject test, a removed member will try to get the info of itself, but ATM , it is not in the configuration of this raft group. this PR aims to handle this case. --- conanfile.py | 2 +- src/lib/repl_service_ctx.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/conanfile.py b/conanfile.py index 41b4092..577d3cf 100644 --- a/conanfile.py +++ b/conanfile.py @@ -10,7 +10,7 @@ class NuRaftMesgConan(ConanFile): name = "nuraft_mesg" - version = "3.6.3" + version = "3.6.4" homepage = "https://github.com/eBay/nuraft_mesg" description = "A gRPC service for NuRAFT" diff --git a/src/lib/repl_service_ctx.cpp b/src/lib/repl_service_ctx.cpp index e8dbc42..438dd13 100644 --- a/src/lib/repl_service_ctx.cpp +++ b/src/lib/repl_service_ctx.cpp @@ -111,12 +111,17 @@ std::vector< peer_info > repl_service_ctx::get_raft_status() const { } } - auto my_id = _server->get_id(); - auto my_peer_id = _server->get_srv_config(my_id)->get_endpoint(); + auto my_config = _server->get_srv_config(_server->get_id()); - // add the peer info of itself(leader or follower) , which is useful for upper layer - // from the view a node itself, last_succ_resp_us_ make no sense, so set it to 0 - peers.emplace_back(my_peer_id, _server->get_last_log_idx(), 0); + // if I am the removed memeber, I can not find myself in the configuration. this will happen when a removed member + // tries to get the raft status + if (my_config) { + auto my_peer_id = my_config->get_endpoint(); + + // add the peer info of itself(leader or follower) , which is useful for upper layer + // from the view a node itself, last_succ_resp_us_ make no sense, so set it to 0 + peers.emplace_back(my_peer_id, _server->get_last_log_idx(), 0); + } return peers; }