swamirishi commented on code in PR #7418:
URL: https://github.com/apache/ozone/pull/7418#discussion_r1847617280


##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -265,6 +268,23 @@ public ContainerStateMachine(HddsDatanodeService 
hddsDatanodeService, RaftGroupI
 
   }
 
+  private void validatePeers(RaftServer server, RaftGroupId id) throws 
IOException {
+    if (this.peersValidated.get()) {
+      return;
+    }
+    RaftPeerId selfId = server.getId();
+    Collection<RaftPeer> peers = server.getDivision(id).getGroup().getPeers();
+    // If peers list is empty then it means  Ratis hasn't created any 
raft--meta file containing the last applied
+    // transaction. Then the peer list can be only validated on apply 
transaction.
+    if (!peers.isEmpty() && peers.stream().noneMatch(raftPeer -> raftPeer != 
null
+        && raftPeer.getId().equals(selfId))) {
+      throw new StorageContainerException(String.format("Current datanodeId: 
%s is not part of the " +
+          "group : %s with quorum: %s", selfId, id, peers), 
ContainerProtos.Result.INVALID_CONFIG);
+    } else if (!peers.isEmpty()) {
+      peersValidated.set(true);
+    }

Review Comment:
   done



##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -265,6 +268,23 @@ public ContainerStateMachine(HddsDatanodeService 
hddsDatanodeService, RaftGroupI
 
   }
 
+  private void validatePeers(RaftServer server, RaftGroupId id) throws 
IOException {
+    if (this.peersValidated.get()) {
+      return;
+    }
+    RaftPeerId selfId = server.getId();
+    Collection<RaftPeer> peers = server.getDivision(id).getGroup().getPeers();
+    // If peers list is empty then it means  Ratis hasn't created any 
raft--meta file containing the last applied
+    // transaction. Then the peer list can be only validated on apply 
transaction.

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.

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