HDFS-16389.Improve NNThroughputBenchmark test mkdirs. (#3819)
Reviewed-by: Viraj Jasani <vjasani@apache.org>
Reviewed-by: Akira Ajisaka <aajisaka@apache.org>
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
(cherry picked from commit 900682e712
)
(cherry picked from commit 4aa9698ee1e9a10a0f882229036bbb4db1ede939)
This commit is contained in:
parent
248c548616
commit
ed83a278c2
|
@ -77,6 +77,10 @@ public class FileNameGenerator {
|
||||||
return fn;
|
return fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long getFileCount() {
|
||||||
|
return fileCount;
|
||||||
|
}
|
||||||
|
|
||||||
private synchronized void reset() {
|
private synchronized void reset() {
|
||||||
Arrays.fill(pathIndecies, -1);
|
Arrays.fill(pathIndecies, -1);
|
||||||
fileCount = 0L;
|
fileCount = 0L;
|
||||||
|
|
|
@ -570,14 +570,22 @@ public class NNThroughputBenchmark implements Tool {
|
||||||
// int generatedFileIdx = 0;
|
// int generatedFileIdx = 0;
|
||||||
LOG.info("Generate " + numOpsRequired + " intputs for " + getOpName());
|
LOG.info("Generate " + numOpsRequired + " intputs for " + getOpName());
|
||||||
fileNames = new String[numThreads][];
|
fileNames = new String[numThreads][];
|
||||||
|
try {
|
||||||
for(int idx=0; idx < numThreads; idx++) {
|
for(int idx=0; idx < numThreads; idx++) {
|
||||||
int threadOps = opsPerThread[idx];
|
int threadOps = opsPerThread[idx];
|
||||||
fileNames[idx] = new String[threadOps];
|
fileNames[idx] = new String[threadOps];
|
||||||
for(int jdx=0; jdx < threadOps; jdx++)
|
for(int jdx=0; jdx < threadOps; jdx++) {
|
||||||
fileNames[idx][jdx] = nameGenerator.
|
fileNames[idx][jdx] = nameGenerator.
|
||||||
getNextFileName("ThroughputBench");
|
getNextFileName("ThroughputBench");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
LOG.error("The current environment allows {} files to be created. " +
|
||||||
|
"If you want to test more files, please update the -filesPerDir parameter.",
|
||||||
|
nameGenerator.getFileCount());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns client name
|
* returns client name
|
||||||
|
@ -669,14 +677,22 @@ public class NNThroughputBenchmark implements Tool {
|
||||||
false);
|
false);
|
||||||
LOG.info("Generate " + numOpsRequired + " inputs for " + getOpName());
|
LOG.info("Generate " + numOpsRequired + " inputs for " + getOpName());
|
||||||
dirPaths = new String[numThreads][];
|
dirPaths = new String[numThreads][];
|
||||||
|
try {
|
||||||
for(int idx=0; idx < numThreads; idx++) {
|
for(int idx=0; idx < numThreads; idx++) {
|
||||||
int threadOps = opsPerThread[idx];
|
int threadOps = opsPerThread[idx];
|
||||||
dirPaths[idx] = new String[threadOps];
|
dirPaths[idx] = new String[threadOps];
|
||||||
for(int jdx=0; jdx < threadOps; jdx++)
|
for(int jdx=0; jdx < threadOps; jdx++) {
|
||||||
dirPaths[idx][jdx] = nameGenerator.
|
dirPaths[idx][jdx] = nameGenerator.
|
||||||
getNextFileName("ThroughputBench");
|
getNextFileName("ThroughputBench");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
LOG.error("The current environment allows {} directories to be created. " +
|
||||||
|
"If you want to test more directories, please update the -dirsPerDir parameter.",
|
||||||
|
nameGenerator.getFileCount());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns client name
|
* returns client name
|
||||||
|
|
Loading…
Reference in New Issue