javeme commented on code in PR #2112:
URL:
https://github.com/apache/incubator-hugegraph/pull/2112#discussion_r1108435191
##########
hugegraph-core/src/main/java/org/apache/hugegraph/backend/store/raft/RaftGroupManagerImpl.java:
##########
@@ -133,16 +143,20 @@ public String addPeer(String endpoint) {
@Override
public String removePeer(String endpoint) {
- E.checkArgument(this.raftNode.selfIsLeader(),
- "Operation add_peer can only be executed on leader");
PeerId peerId = PeerId.parsePeer(endpoint);
- RaftClosure<?> future = new RaftClosure<>();
try {
- this.raftNode.node().removePeer(peerId, future);
+ RaftClosure<?> future = new RaftClosure<>();
+ if (this.raftNode.selfIsLeader()) {
+ this.raftNode.node().removePeer(peerId, future);
+ } else {
+ RemovePeerRequest request = RemovePeerRequest.newBuilder()
+ .setEndpoint(endpoint)
Review Comment:
prefer to align with `.newBuilder`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]