hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viraj...@apache.org
Subject [11/50] [abbrv] hadoop git commit: HADOOP-14902. LoadGenerator#genFile write close timing is incorrectly calculated. Contributed by Hanisha Koneru
Date Tue, 03 Oct 2017 18:06:01 GMT
HADOOP-14902. LoadGenerator#genFile write close timing is incorrectly calculated. Contributed
by Hanisha Koneru


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6f789fe0
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6f789fe0
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6f789fe0

Branch: refs/heads/HDFS-9806
Commit: 6f789fe05766a61b12ca10df3f26ee354eac84aa
Parents: ca669f9
Author: Jason Lowe <jlowe@apache.org>
Authored: Thu Sep 28 16:38:30 2017 -0500
Committer: Jason Lowe <jlowe@apache.org>
Committed: Thu Sep 28 16:38:30 2017 -0500

----------------------------------------------------------------------
 .../apache/hadoop/fs/loadGenerator/LoadGenerator.java    | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6f789fe0/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
index 0bb1b46..b74e75d 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/loadGenerator/LoadGenerator.java
@@ -322,6 +322,7 @@ public class LoadGenerator extends Configured implements Tool {
     private void genFile(Path file, long fileSize) throws IOException {
       long startTimestamp = Time.monotonicNow();
       FSDataOutputStream out = null;
+      boolean isOutClosed = false;
       try {
         out = fc.create(file,
             EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE),
@@ -337,11 +338,15 @@ public class LoadGenerator extends Configured implements Tool {
           i -= s;
         }
 
-        startTimestamp = Time.monotonicNow();
-        executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTimestamp);
+        startTime = Time.monotonicNow();
+        out.close();
+        executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTime);
         numOfOps[WRITE_CLOSE]++;
+        isOutClosed = true;
       } finally {
-        IOUtils.cleanupWithLogger(LOG, out);
+        if (!isOutClosed && out != null) {
+          out.close();
+        }
       }
     }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message