bshashikant commented on a change in pull request #1916:
URL: https://github.com/apache/ozone/pull/1916#discussion_r573999087
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMRatisServerImpl.java
##########
@@ -69,19 +71,27 @@
this.scm = scm;
this.address = haConf.getRatisBindAddress();
- SCMHAGroupBuilder haGrpBuilder = new SCMHAGroupBuilder(haConf, conf);
+ RaftServer server =
+ newRaftServer(scm.getClusterId(), scm.getSCMHANodeDetails(), haConf,
+ conf).setStateMachine(new SCMStateMachine(scm, this, buffer))
+ .build();
- final RaftProperties serverProperties = RatisUtil
- .newRaftProperties(haConf, conf);
-
- RaftServer server = RaftServer.newBuilder()
- .setServerId(haGrpBuilder.getPeerId())
- .setGroup(haGrpBuilder.getRaftGroup())
- .setProperties(serverProperties)
- .setStateMachine(new SCMStateMachine(scm, this, buffer))
- .build();
+ this.division =
+ server.getDivision(server.getGroups().iterator().next().getGroupId());
+ }
- this.division = server.getDivision(haGrpBuilder.getRaftGroupId());
+ public static RaftServer.Builder newRaftServer(final String clusterId,
+ final SCMHANodeDetails haDetails, final SCMHAConfiguration haConf,
+ final ConfigurationSource conf) throws IOException {
+ final String scmNodeId = haDetails.getLocalNodeDetails().getNodeId();
+ SCMHAGroupBuilder haGrpBuilder = scmNodeId != null ?
+ new SCMHAGroupBuilder(haDetails, clusterId) :
+ new SCMHAGroupBuilder(haConf, conf, clusterId);
+ final RaftProperties serverProperties =
+ RatisUtil.newRaftProperties(haConf, conf);
+ return RaftServer.newBuilder().setServerId(haGrpBuilder.getPeerId())
+ .setGroup(haGrpBuilder.getRaftGroup())
+ .setProperties(serverProperties).setStateMachine(null);
Review comment:
Addressed this in the patch.
----------------------------------------------------------------
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]