elek commented on a change in pull request #2306:
URL: https://github.com/apache/ozone/pull/2306#discussion_r650934828



##########
File path: 
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/StreamingGenerator.java
##########
@@ -76,47 +77,60 @@ public Void call() throws Exception {
     generateBaseData();
 
     timer = getMetrics().timer("streaming");
-    setThreadNo(1);
     runTests(this::copyDir);
 
     return null;
   }
 
-  private void generateBaseData() throws IOException {
-    Path sourceDir = testRoot.resolve("streaming-0");
-    if (Files.exists(sourceDir)) {
-      deleteDirRecursive(sourceDir);
-    }
-    Path subDir = sourceDir.resolve(subdir);
-    Files.createDirectories(subDir);
-    ContentGenerator contentGenerator = new ContentGenerator(fileSize,
-        1024);
-
-    for (int i = 0; i < numberOfFiles; i++) {
-      try (FileOutputStream out = new FileOutputStream(
-          subDir.resolve("file-" + i).toFile())
-      ) {
-        contentGenerator.write(out);
+  private void generateBaseData() {
+    try {
+      Path sourceDir = threadRootDir().resolve("streaming-0");
+      final Path sourceDirParent = sourceDir.getParent();
+      if (sourceDirParent == null) {
+        throw new AssertionError("Empty parrent");
       }
+      if (Files.exists(sourceDirParent)) {
+        deleteDirRecursive(sourceDirParent);
+      }
+      Path subDir = sourceDir.resolve(subdir);

Review comment:
       Gooid point. I converted the first one to a constant: `private static 
final String SUB_DIR_NAME = "dir1";` 




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

Reply via email to