hanishakoneru commented on a change in pull request #1494:
URL: https://github.com/apache/ozone/pull/1494#discussion_r544742677
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OzoneIllegalArgumentException.java
##########
@@ -37,4 +37,8 @@
public OzoneIllegalArgumentException(final String message) {
Review comment:
Good point. Removed this from current patch.
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerRatisServer.java
##########
@@ -137,6 +141,59 @@ public OMResponse submitRequest(OMRequest omRequest)
throws ServiceException {
return processReply(omRequest, raftClientReply);
}
+ /**
+ * Add a new OM to the Ratis ring.
+ * @return true if the new OM is successfully added to the ratis ring,
+ * false otherwise.
+ */
+ public boolean bootstrapNewOMs(List<OMNodeDetails> newOMNodes) {
+ StringBuilder newOMNodeIdsBuilder = new StringBuilder();
+ newOMNodes.stream().forEach(newOMNode ->
+ newOMNodeIdsBuilder.append(", ").append(newOMNode.getOMNodeId()));
+ String newOMNodeIds = newOMNodeIdsBuilder.toString().substring(2);
+ LOG.info("Bootstrapping new OM(s): {}", newOMNodeIds);
+
+ List<RaftPeer> newRaftPeerList = new ArrayList<>();
+ newRaftPeerList.addAll(raftPeers);
+
+ for (OMNodeDetails newOMNode : newOMNodes) {
+ String newOMNodeId = newOMNode.getOMNodeId();
+ RaftPeerId newOMRaftPeerId = RaftPeerId.valueOf(newOMNodeId);
+ InetSocketAddress newOMRatisAddr = new InetSocketAddress(
+ newOMNode.getHostName(), newOMNode.getRatisPort());
+
+ newRaftPeerList.add(RaftPeer.newBuilder()
+ .setId(newOMRaftPeerId)
+ .setAddress(newOMRatisAddr)
+ .build());
+ }
+
+ if (LOG.isDebugEnabled()) {
Review comment:
Done
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
##########
@@ -164,6 +167,27 @@ public void notifyTermIndexUpdated(long currentTerm, long
index) {
computeAndUpdateLastAppliedIndex(index, currentTerm, null, false);
}
+ /**
+ * Called from Ratis to notify state machine about configuration changes.
+ */
+ @Override
+ public void notifyConfigurationChanged(long term, long index,
+ RaftConfigurationProto newRaftConfiguration) {
+ List<RaftPeerProto> newPeers = newRaftConfiguration.getPeersList();
+ LOG.info("Received Configuration change notification from Ratis. New Peer"
+
+ " list:\n{}", newPeers);
+ for (RaftProtos.RaftPeerProto raftPeerProto : newPeers) {
+ String omNodeId = RaftPeerId.valueOf(raftPeerProto.getId()).toString();
+ if (!ozoneManager.doesPeerExist(omNodeId)) {
+ LOG.info("Adding new OM {} to the cluster.", omNodeId);
+ ozoneManager.addNewOMNode(omNodeId);
+ } else if(LOG.isDebugEnabled()) {
Review comment:
Done
##########
File path:
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OmTransport.java
##########
@@ -33,6 +35,9 @@
*/
OMResponse submitRequest(OMRequest payload) throws IOException;
+ BootstrapResponse bootstrapRequest(BootstrapRequest bootstrapRequest)
Review comment:
Done
----------------------------------------------------------------
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]