You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/06/14 13:02:27 UTC

[GitHub] [ozone] elek commented on a change in pull request #2306: HDDS-5310. Enhance freon streaming generator to support multiple threads

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



##########
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");

Review comment:
       It couldn't be null normally, but `spotbugs` complains about it. (If any path is `/` path, parent is `null`).
   
   But using `threadRootDir()` instead of using `getParent()` call -- what you suggested -- solves this problem as spotbugs shouldn't complain about it any more.
   
   I am updating this...




-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org