diff --git a/src/interface/raftex.thrift b/src/interface/raftex.thrift index 27d9405c641..5904c9876a7 100644 --- a/src/interface/raftex.thrift +++ b/src/interface/raftex.thrift @@ -133,6 +133,7 @@ struct GetStateResponse { 6: LogID last_log_id; 7: TermID last_log_term; 8: Status status; + 9: list peers; } service RaftexService { diff --git a/src/kvstore/raftex/RaftPart.cpp b/src/kvstore/raftex/RaftPart.cpp index d2eb5ac2e51..c187cb3cf53 100644 --- a/src/kvstore/raftex/RaftPart.cpp +++ b/src/kvstore/raftex/RaftPart.cpp @@ -1067,6 +1067,15 @@ void RaftPart::getState(cpp2::GetStateResponse& resp) { resp.last_log_id_ref() = lastLogId_; resp.last_log_term_ref() = lastLogTerm_; resp.status_ref() = status_; + std::vector peers; + for (auto& h : hosts_) { + std::string str = h->address().toString(); + if (h->isLearner()) { + str += "_learner"; + } + peers.emplace_back(str); + } + resp.peers_ref() = peers; } bool RaftPart::processElectionResponses(const RaftPart::ElectionResponses& results,