Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,16 @@ public void printReport() {
messages.forEach(print);
}

/**
* Print out reports with the given message.
*/
public void print(String msg){
Consumer<String> print = freonCommand.isInteractive()
? System.out::println
: LOG::info;
print.accept(msg);
}

/**
* Create the OM RPC client to use it for testing.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,24 @@ public class HadoopDirTreeGenerator extends BaseFreonGenerator

@Override
public Void call() throws Exception {

init();
OzoneConfiguration configuration = createOzoneConfiguration();
fileSystem = FileSystem.get(URI.create(rootPath), configuration);

contentGenerator = new ContentGenerator(fileSizeInBytes, bufferSize);
timer = getMetrics().timer("file-create");

runTests(this::createDir);
String s;
if (depth <= 0) {
s = "Invalid depth value, depth value should be greater than zero!";
print(s);
} else if (span <= 0) {
s = "Invalid span value, span value should be greater than zero!";
print(s);
} else {
init();
OzoneConfiguration configuration = createOzoneConfiguration();
fileSystem = FileSystem.get(URI.create(rootPath), configuration);

contentGenerator = new ContentGenerator(fileSizeInBytes, bufferSize);
timer = getMetrics().timer("file-create");

runTests(this::createDir);
}
return null;

}

/*
Expand Down Expand Up @@ -139,21 +146,14 @@ public Void call() throws Exception {
created.
*/
private void createDir(long counter) throws Exception {
if (depth <= 0) {
LOG.info("Invalid depth value, at least one depth should be passed!");
return;
}
if (span <= 0) {
LOG.info("Invalid span value, at least one span should be passed!");
return;
}
String dir = makeDirWithGivenNumberOfFiles(rootPath);
if (depth > 1) {
createSubDirRecursively(dir, 1, 1);
}
System.out.println("Successfully created directories & files. Total Dirs " +
String message = "Successfully created directories & files. Total Dirs " +
"Count=" + totalDirsCnt.get() + ", Total Files Count=" +
timer.getCount());
timer.getCount();
print(message);
}

private void createSubDirRecursively(String parent, int depthIndex,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,20 @@ public class HadoopNestedDirGenerator extends BaseFreonGenerator

@Override
public Void call() throws Exception {

init();
OzoneConfiguration configuration = createOzoneConfiguration();
fileSystem = FileSystem.get(URI.create(rootPath), configuration);
runTests(this::createDir);
String s;
if (depth <= 0) {
s = "Invalid depth value, depth value should be greater than zero!";
print(s);
} else if (span < 0) {
s = "Invalid span value, span value should be greater or equal to zero!";
print(s);
} else {
init();
OzoneConfiguration configuration = createOzoneConfiguration();
fileSystem = FileSystem.get(URI.create(rootPath), configuration);
runTests(this::createDir);
}
return null;

}

/*
Expand Down Expand Up @@ -109,5 +116,8 @@ private void createDir(long counter) throws Exception {
Path dir = new Path(rootPath.concat("/").concat(childDir));
fileSystem.mkdirs(dir.getParent());
}
String message = "\nSuccessfully created directories. " +
"Total Directories with level = " + depth + " and span = " + span;
print(message);
}
}