This is an automated email from the ASF dual-hosted git repository.
elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 32f13f7 HDDS-3289. (Checkstyle addendum) Add a freon generator to
create nested directories. (#730)
32f13f7 is described below
commit 32f13f7d570863382426d0d3be990ae39d101d3a
Author: Elek Márton <[email protected]>
AuthorDate: Wed Apr 1 13:46:27 2020 +0200
HDDS-3289. (Checkstyle addendum) Add a freon generator to create nested
directories. (#730)
---
.../ozone/freon/HadoopNestedDirGenerator.java | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java
index 9373cc6..72d096c 100644
---
a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java
+++
b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopNestedDirGenerator.java
@@ -31,12 +31,12 @@ import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
/**
- * Directory Generator tool to test OM performance.
+ * Directory Generator tool to test OM performance.
*/
@Command(name = "ddsg",
aliases = "dfs-directory-generator",
description =
- "Create nested directories to the any dfs compatible file system.",
+ "Create nested directories to the any dfs compatible file system.",
versionProvider = HddsVersionProvider.class,
mixinStandardHelpOptions = true,
showDefaultValues = true)
@@ -46,26 +46,25 @@ public class HadoopNestedDirGenerator extends
BaseFreonGenerator
private static final Logger LOG =
LoggerFactory.getLogger(HadoopNestedDirGenerator.class);
- @Option(names = {"-r","--rpath"},
+ @Option(names = {"-r", "--rpath"},
description = "Hadoop FS directory system path",
defaultValue = "o3fs://bucket2.vol2")
private String rootPath;
-
@Option(names = {"-d", "--depth"},
description = "Number of directories to be generated recursively",
defaultValue = "5")
private int depth;
- @Option(names = {"-s","--span"},
+ @Option(names = {"-s", "--span"},
description =
- "Number of child directories to be created in leaf directory.",
+ "Number of child directories to be created in leaf directory.",
defaultValue = "10")
private int span;
- @Option(names = {"-l","--nameLen"},
+ @Option(names = {"-l", "--nameLen"},
description =
- "Length of the random name of directory you want to create.",
+ "Length of the random name of directory you want to create.",
defaultValue = "10")
private int length;
@@ -81,6 +80,7 @@ public class HadoopNestedDirGenerator extends
BaseFreonGenerator
return null;
}
+
/*
Nested directories will be created like this,
suppose you pass depth=3, span=3 and number of tests=2
@@ -96,15 +96,15 @@ public class HadoopNestedDirGenerator extends
BaseFreonGenerator
*/
private void createDir(long counter) throws Exception {
String dirString = RandomStringUtils.randomAlphanumeric(length);
- for(int i = 1; i <= depth; i++) {
+ for (int i = 1; i <= depth; i++) {
dirString = dirString.concat("/").concat(RandomStringUtils.
- randomAlphanumeric(length));
+ randomAlphanumeric(length));
}
Path file = new Path(rootPath.concat("/").concat(dirString));
fileSystem.mkdirs(file.getParent());
String leafDir = dirString.substring(0, dirString.length() - length);
String tmp = "/0";
- for(int i = 1; i <= span; i++) {
+ for (int i = 1; i <= span; i++) {
String childDir = leafDir.concat(Integer.toString(i)).concat(tmp);
Path dir = new Path(rootPath.concat("/").concat(childDir));
fileSystem.mkdirs(dir.getParent());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]