MAPREDUCE-5248. Let NNBenchWithoutMR specify the replication factor for its test. Contributed by Erik Paulson

This commit is contained in:
Jason Lowe 2015-05-08 22:28:50 +00:00
parent c945c20483
commit 30099a36c6
2 changed files with 17 additions and 9 deletions

View File

@ -322,6 +322,9 @@ Release 2.8.0 - UNRELEASED
MAPREDUCE-5981. Log levels of certain MR logs can be changed to DEBUG.
(Varun Saxena via devaraj)
MAPREDUCE-5248. Let NNBenchWithoutMR specify the replication factor for
its test (Erik Paulson via jlowe)
OPTIMIZATIONS
BUG FIXES

View File

@ -54,6 +54,7 @@ public class NNBenchWithoutMR {
private static long bytesPerBlock = 1;
private static long blocksPerFile = 0;
private static long bytesPerFile = 1;
private static short replicationFactorPerFile = 1; // default is 1
private static Path baseDir = null;
// variables initialized in main()
@ -106,7 +107,7 @@ static int createWrite() {
try {
out = fileSys.create(
new Path(taskDir, "" + index), false, 512,
(short)1, bytesPerBlock);
(short)replicationFactorPerFile, bytesPerBlock);
success = true;
} catch (IOException ioe) {
success=false;
@ -263,14 +264,15 @@ public static void main(String[] args) throws IOException {
String usage =
"Usage: nnbench " +
" -operation <one of createWrite, openRead, rename, or delete> " +
" -baseDir <base output/input DFS path> " +
" -startTime <time to start, given in seconds from the epoch> " +
" -numFiles <number of files to create> " +
" -blocksPerFile <number of blocks to create per file> " +
" [-bytesPerBlock <number of bytes to write to each block, default is 1>] " +
" [-bytesPerChecksum <value for io.bytes.per.checksum>]" +
"Note: bytesPerBlock MUST be a multiple of bytesPerChecksum";
" -operation <one of createWrite, openRead, rename, or delete>\n " +
" -baseDir <base output/input DFS path>\n " +
" -startTime <time to start, given in seconds from the epoch>\n" +
" -numFiles <number of files to create>\n " +
" -replicationFactorPerFile <Replication factor for the files, default is 1>\n" +
" -blocksPerFile <number of blocks to create per file>\n" +
" [-bytesPerBlock <number of bytes to write to each block, default is 1>]\n" +
" [-bytesPerChecksum <value for io.bytes.per.checksum>]\n" +
"Note: bytesPerBlock MUST be a multiple of bytesPerChecksum\n";
String operation = null;
for (int i = 0; i < args.length; i++) { // parse command line
@ -284,6 +286,8 @@ public static void main(String[] args) throws IOException {
bytesPerBlock = Long.parseLong(args[++i]);
} else if (args[i].equals("-bytesPerChecksum")) {
bytesPerChecksum = Integer.parseInt(args[++i]);
} else if (args[i].equals("-replicationFactorPerFile")) {
replicationFactorPerFile = Short.parseShort(args[++i]);
} else if (args[i].equals("-startTime")) {
startTime = Long.parseLong(args[++i]) * 1000;
} else if (args[i].equals("-operation")) {
@ -307,6 +311,7 @@ public static void main(String[] args) throws IOException {
System.out.println(" baseDir: " + baseDir);
System.out.println(" startTime: " + startTime);
System.out.println(" numFiles: " + numFiles);
System.out.println(" replicationFactorPerFile: " + replicationFactorPerFile);
System.out.println(" blocksPerFile: " + blocksPerFile);
System.out.println(" bytesPerBlock: " + bytesPerBlock);
System.out.println(" bytesPerChecksum: " + bytesPerChecksum);