duongkame commented on code in PR #6037:
URL: https://github.com/apache/ozone/pull/6037#discussion_r1459642863


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -309,7 +322,7 @@ public Supplier<String> realTimeStatusSupplier() {
     };
   }
 
-  @SuppressWarnings("checkstyle:EmptyBlock")
+  @SuppressWarnings({"checkstyle:EmptyBlock", "checkstyle:MethodLength"})

Review Comment:
   Instead, we can extract pieces from this giant method to smaller 
functions....



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -326,8 +339,18 @@ private void applyOperation(long counter) throws Exception 
{
     case CREATE_KEY:
       keyName = getPath(counter);
       getMetrics().timer(operation.name()).time(() -> {
-        try (OutputStream stream = bucket.createStreamKey(keyName,
-            dataSize.toBytes(), replicationConfig, new HashMap<>())) {
+        try (OutputStream stream = bucket.createKey(keyName,
+            dataSize.toBytes())) {
+          contentGenerator.write(stream);
+        }
+        return null;
+      });

Review Comment:
   For example, this can be extracted to a separate function, e.g. 
`createKey(operation, bucket, keyName, dataSize)`



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -449,6 +499,26 @@ private void applyOperation(long counter) throws Exception 
{
           }
       );
       break;
+    case EMPTY_RPC:

Review Comment:
   Do we need those? They're already available in `OmRPCLoadGenerator`.



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -70,17 +75,22 @@ public class OmMetadataGenerator extends BaseFreonGenerator
 
   enum Operation {
     CREATE_FILE,
+    CREATE_STREAM_FILE,
     LOOKUP_FILE,
     READ_FILE,
     LIST_STATUS,
     CREATE_KEY,
+    CREATE_STREAM_KEY,
     LOOKUP_KEY,
     GET_KEYINFO,
     HEAD_KEY,
     READ_KEY,
     LIST_KEYS,
+    LIST_KEYS_LIGHT,
     INFO_BUCKET,
     INFO_VOLUME,
+    EMPTY_RPC_WRITE_RATIS,
+    EMPTY_RPC,

Review Comment:
   Do we need those? They're already available in `OmRPCLoadGenerator`. They 
don't seem to fit the category of "MetadataGenerator". 



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/OmMetadataGenerator.java:
##########
@@ -449,6 +499,26 @@ private void applyOperation(long counter) throws Exception 
{
           }
       );
       break;
+    case EMPTY_RPC:
+      getMetrics().timer(operation.name()).time(() -> {
+            try {
+              ozoneManagerClient.echoRPCReq(new byte[] {}, 0, false);
+            } catch (IOException e) {
+              throw new RuntimeException(e);

Review Comment:
   #do we need to wrap as `RuntimeException`?



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