bharatviswa504 commented on a change in pull request #1494:
URL: https://github.com/apache/ozone/pull/1494#discussion_r670957861



##########
File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -1339,7 +1339,38 @@ public void bootstrap(OMNodeDetails newOMNode) throws 
IOException {
   }
 
   /**
-   * Add a new OM Node to the HA cluster. This call comes from OMRatisServer
+   * When OMStateMachine receives a configuration change update, it calls
+   * this function to update the peers list, if required.
+   */
+  public void updatePeerList(List<String> omNodeIds) {
+    List<String> ratisServerPeerIdsList = omRatisServer.getPeerIds();
+    for (String omNodeId : omNodeIds) {
+      if (getOMNodeId().equals(omNodeId)) {

Review comment:
       > This is done later when a setConfiguration request is executed and it 
calls 
   
   > OMRatisServer#addRaftPeer().
   
   Yes, but notifyConfigurationChanged calls updatePeerList
   
   ```
   @Override
     public void notifyConfigurationChanged(long term, long index,
         RaftProtos.RaftConfigurationProto newRaftConfiguration) {
       List<RaftProtos.RaftPeerProto> newPeers =
           newRaftConfiguration.getPeersList();
       LOG.info("Received Configuration change notification from Ratis. New 
Peer" +
           " list:\n{}", newPeers);
   
       List<String> newPeerIds = new ArrayList<>();
       for (RaftProtos.RaftPeerProto raftPeerProto : newPeers) {
         newPeerIds.add(RaftPeerId.valueOf(raftPeerProto.getId()).toString());
       }
       // Check and update the peer list in OzoneManager
       ozoneManager.updatePeerList(newPeerIds);
     }
   ```
   
   And in updatePeerList we have 
   
   ```
    public void updatePeerList(List<String> omNodeIds) {
       List<String> ratisServerPeerIdsList = omRatisServer.getPeerIds();
       for (String omNodeId : omNodeIds) {
         if (getOMNodeId().equals(omNodeId)) {
           continue;
         }
   ```
   
   Which skips calling addRaftPeer, when it is matching with localNode ID. Let 
me know if I am missing something here.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to