sreejasahithi commented on code in PR #9696:
URL: https://github.com/apache/ozone/pull/9696#discussion_r2753736836


##########
hadoop-ozone/freon/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -464,4 +523,44 @@ enum Operation {
     INFO_VOLUME,
     MIXED,
   }
+
+  private List<String> getOMFollowerNodeIds(OzoneClient ozoneClient) throws 
IOException {
+    List<OMRoleInfo> omRoleInfos = ozoneClient.getProxy().getOmRoleInfos();
+    String leaderOMNodeId = null;
+    List<String> followerOMNodeIds = new ArrayList<>();
+    for (OMRoleInfo omRoleInfo : omRoleInfos) {
+      if (omRoleInfo.getServerRole().equals("LEADER")) {
+        if (leaderOMNodeId != null) {
+          // This situation should be rare
+          throw new IllegalStateException("There are more than one leader 
detected, please retry again");
+        }
+        leaderOMNodeId = omRoleInfo.getNodeId();
+      } else if (omRoleInfo.getServerRole().equals("FOLLOWER")) {
+        followerOMNodeIds.add(omRoleInfo.getNodeId());
+      }
+    }
+    if (followerOMNodeIds.isEmpty()) {
+      throw new IllegalArgumentException("There is no follower the OM service, 
please retry again");

Review Comment:
   ```suggestion
         throw new IllegalArgumentException("There is no follower in the OM 
service, please retry again");
   ```



##########
hadoop-ozone/freon/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -165,18 +184,42 @@ public Void call() throws Exception {
     OzoneConfiguration conf = createOzoneConfiguration();
     replicationConfig = replication.fromParamsOrConfig(conf);
 
-    try (OzoneClient rpcClient = createOzoneClient(omServiceID, conf)) {
-      ensureVolumeAndBucketExist(rpcClient, volumeName, bucketName);
-      ozoneManagerClient = createOmClient(conf, omServiceID);
-      bucket = rpcClient.getObjectStore().getVolume(volumeName)
-          .getBucket(bucketName);
+    if (clientsNo <= 0) {
+      clientsNo = 1;
+    }
+
+    try (OzoneClient ozClient = createOzoneClient(omServiceID, conf)) {
+      ensureVolumeAndBucketExist(ozClient, volumeName, bucketName);
+
+      ozoneClients = new OzoneClient[clientsNo];

Review Comment:
   The description of  "--clients" states that "If the number of clients 
exceeds number of threads N, only N clients will be created." However, this 
validation does not seem to be present in the code. Currently we only check if 
clientsNo <= 0.
   



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