GlenGeng commented on a change in pull request #2094:
URL: https://github.com/apache/ozone/pull/2094#discussion_r603749073
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -225,7 +225,7 @@ public void stop() throws IOException {
@Override
public List<String> getRatisRoles() {
return division.getGroup().getPeers().stream()
- .map(peer -> peer.getAddress() == null ? "" : peer.getAddress())
+ .map(peer -> peer.getAddress() == null ? "" :
peer.getAddress().concat(peer.getAdminAddress() == null ? ":FOLLOWER" :
":LEADER"))
Review comment:
```
private static RaftPeer.Builder raftPeerBuilderFor(DatanodeDetails dn) {
return RaftPeer.newBuilder()
.setId(toRaftPeerId(dn))
.setAddress(toRaftPeerAddress(dn, Port.Name.RATIS_SERVER))
.setAdminAddress(toRaftPeerAddress(dn, Port.Name.RATIS_ADMIN))
.setClientAddress(toRaftPeerAddress(dn, Port.Name.RATIS));
}
```
I consider that each raft peer has its own admin address, no matter if it is
leader or follower.
Better use ```NetUtils.isLocalAddress()``` to determine the peer whose
address equals local, and assign him the leader role.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]