HADOOP-14902. LoadGenerator#genFile write close timing is incorrectly calculated. Contributed by Hanisha Koneru
This commit is contained in:
parent
ca669f9f8b
commit
6f789fe057
|
@ -322,6 +322,7 @@ public class LoadGenerator extends Configured implements Tool {
|
||||||
private void genFile(Path file, long fileSize) throws IOException {
|
private void genFile(Path file, long fileSize) throws IOException {
|
||||||
long startTimestamp = Time.monotonicNow();
|
long startTimestamp = Time.monotonicNow();
|
||||||
FSDataOutputStream out = null;
|
FSDataOutputStream out = null;
|
||||||
|
boolean isOutClosed = false;
|
||||||
try {
|
try {
|
||||||
out = fc.create(file,
|
out = fc.create(file,
|
||||||
EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE),
|
EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE),
|
||||||
|
@ -337,11 +338,15 @@ public class LoadGenerator extends Configured implements Tool {
|
||||||
i -= s;
|
i -= s;
|
||||||
}
|
}
|
||||||
|
|
||||||
startTimestamp = Time.monotonicNow();
|
startTime = Time.monotonicNow();
|
||||||
executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTimestamp);
|
out.close();
|
||||||
|
executionTime[WRITE_CLOSE] += (Time.monotonicNow() - startTime);
|
||||||
numOfOps[WRITE_CLOSE]++;
|
numOfOps[WRITE_CLOSE]++;
|
||||||
|
isOutClosed = true;
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.cleanupWithLogger(LOG, out);
|
if (!isOutClosed && out != null) {
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue