diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java similarity index 100% rename from hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java rename to hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/exceptions/SCMException.java diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/package-info.java b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/exceptions/package-info.java similarity index 100% rename from hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/exceptions/package-info.java rename to hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/exceptions/package-info.java diff --git a/hadoop-hdds/container-service/pom.xml b/hadoop-hdds/container-service/pom.xml index c1dd403b03..2f89fa23f3 100644 --- a/hadoop-hdds/container-service/pom.xml +++ b/hadoop-hdds/container-service/pom.xml @@ -37,6 +37,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hadoop hadoop-hdds-server-framework + + io.dropwizard.metrics + metrics-core + org.mockito @@ -56,12 +60,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> 3.0.1 provided - - - io.dropwizard.metrics - metrics-core - test - diff --git a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java index f775ca104b..33a1ca9558 100644 --- a/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java +++ b/hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/server/ServerUtils.java @@ -203,4 +203,25 @@ public static void setOzoneMetaDirPath(OzoneConfiguration conf, conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, path); } + /** + * Returns with the service specific metadata directory. + *

+ * If the directory is missing the method tries to create it. + * + * @param conf The ozone configuration object + * @param key The configuration key which specify the directory. + * @return The path of the directory. + */ + public static File getDBPath(Configuration conf, String key) { + final File dbDirPath = + getDirectoryFromConfig(conf, key, "OM"); + if (dbDirPath != null) { + return dbDirPath; + } + + LOG.warn("{} is not configured. We recommend adding this setting. " + + "Falling back to {} instead.", key, + HddsConfigKeys.OZONE_METADATA_DIRS); + return ServerUtils.getOzoneMetaDirPath(conf); + } } diff --git a/hadoop-hdds/server-scm/pom.xml b/hadoop-hdds/server-scm/pom.xml index 99d5922387..60b1b44b4b 100644 --- a/hadoop-hdds/server-scm/pom.xml +++ b/hadoop-hdds/server-scm/pom.xml @@ -100,6 +100,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.bouncycastle bcprov-jdk15on + + io.dropwizard.metrics + metrics-core + com.google.code.findbugs findbugs diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ScmUtils.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ScmUtils.java index 37702532ac..426341a32f 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ScmUtils.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ScmUtils.java @@ -18,18 +18,13 @@ package org.apache.hadoop.hdds.scm; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hdds.HddsConfigKeys; import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ScmOps; -import org.apache.hadoop.hdds.scm.safemode.Precheck; import org.apache.hadoop.hdds.scm.exceptions.SCMException; -import org.apache.hadoop.hdds.server.ServerUtils; +import org.apache.hadoop.hdds.scm.safemode.Precheck; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.File; - /** * SCM utility class. */ @@ -53,16 +48,4 @@ public static void preCheck(ScmOps operation, Precheck... preChecks) } } - public static File getDBPath(Configuration conf, String dbDirectory) { - final File dbDirPath = - ServerUtils.getDirectoryFromConfig(conf, dbDirectory, "OM"); - if (dbDirPath != null) { - return dbDirPath; - } - - LOG.warn("{} is not configured. We recommend adding this setting. " - + "Falling back to {} instead.", dbDirectory, - HddsConfigKeys.OZONE_METADATA_DIRS); - return ServerUtils.getOzoneMetaDirPath(conf); - } } diff --git a/hadoop-ozone/common/pom.xml b/hadoop-ozone/common/pom.xml index 06973b3975..050022c949 100644 --- a/hadoop-ozone/common/pom.xml +++ b/hadoop-ozone/common/pom.xml @@ -60,10 +60,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hadoop hadoop-hdds-server-framework - - org.apache.hadoop - hadoop-hdds-server-scm - org.apache.hadoop hadoop-hdds-container-service diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java index 07780569fb..3bd884e589 100644 --- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java +++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java @@ -42,8 +42,8 @@ import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hdds.scm.ScmUtils; import org.apache.hadoop.hdds.scm.HddsServerUtil; +import org.apache.hadoop.hdds.server.ServerUtils; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.ozone.om.OMConfigKeys; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos; @@ -172,7 +172,7 @@ public static int getOmRestPort(Configuration conf) { * @return File path, after creating all the required Directories. */ public static File getOmDbDir(Configuration conf) { - return ScmUtils.getDBPath(conf, OMConfigKeys.OZONE_OM_DB_DIRS); + return ServerUtils.getDBPath(conf, OMConfigKeys.OZONE_OM_DB_DIRS); } /** diff --git a/hadoop-ozone/integration-test/pom.xml b/hadoop-ozone/integration-test/pom.xml index ff18fd4845..fee0c61527 100644 --- a/hadoop-ozone/integration-test/pom.xml +++ b/hadoop-ozone/integration-test/pom.xml @@ -34,6 +34,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hadoop hadoop-ozone-common + + org.apache.hadoop + hadoop-hdds-server-scm + org.apache.hadoop hadoop-ozone-ozone-manager @@ -64,6 +68,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hadoop hadoop-ozone-client + + commons-lang + commons-lang + test + org.apache.hadoop hadoop-ozone-ozone-manager diff --git a/hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java similarity index 100% rename from hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java rename to hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestKeyManagerImpl.java diff --git a/hadoop-ozone/pom.xml b/hadoop-ozone/pom.xml index 4a6df28534..9fa1c8b6d5 100644 --- a/hadoop-ozone/pom.xml +++ b/hadoop-ozone/pom.xml @@ -220,6 +220,11 @@ bcprov-jdk15on ${bouncycastle.version} + + commons-lang + commons-lang + 2.6 + diff --git a/hadoop-ozone/tools/pom.xml b/hadoop-ozone/tools/pom.xml index f8ed807990..7ce6f6b2a5 100644 --- a/hadoop-ozone/tools/pom.xml +++ b/hadoop-ozone/tools/pom.xml @@ -37,6 +37,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd"> org.apache.hadoop hadoop-ozone-common + + + org.apache.hadoop + hadoop-hdds-server-scm + org.apache.hadoop hadoop-ozone-client