Skip to content

Commit

Permalink
HDDS-1597. Remove hdds-server-scm dependency from ozone-common. (#860)
Browse files Browse the repository at this point in the history
  • Loading branch information
elek authored and bharatviswa504 committed May 30, 2019
1 parent 33419a9 commit baee715
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 25 deletions.
Expand Up @@ -203,4 +203,25 @@ public static void setOzoneMetaDirPath(OzoneConfiguration conf,
conf.set(HddsConfigKeys.OZONE_METADATA_DIRS, path);
}

/**
* Returns with the service specific metadata directory.
* <p>
* 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);
}
}
Expand Up @@ -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.
*/
Expand All @@ -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);
}
}
4 changes: 0 additions & 4 deletions hadoop-ozone/common/pom.xml
Expand Up @@ -60,10 +60,6 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-server-framework</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-server-scm</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-container-service</artifactId>
Expand Down
Expand Up @@ -39,7 +39,7 @@
import org.apache.commons.compress.utils.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdds.scm.ScmUtils;
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;
Expand Down Expand Up @@ -164,7 +164,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);
}

/**
Expand Down
9 changes: 9 additions & 0 deletions hadoop-ozone/integration-test/pom.xml
Expand Up @@ -34,6 +34,10 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-common</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-server-scm</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-ozone-manager</artifactId>
Expand All @@ -60,6 +64,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-client</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-ozone-manager</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions hadoop-ozone/pom.xml
Expand Up @@ -209,6 +209,11 @@
<artifactId>bcprov-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
Expand Down
5 changes: 5 additions & 0 deletions hadoop-ozone/tools/pom.xml
Expand Up @@ -37,6 +37,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-common</artifactId>
</dependency>
<!-- Genesis requires server side components -->
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-hdds-server-scm</artifactId>
</dependency>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-ozone-client</artifactId>
Expand Down

0 comments on commit baee715

Please sign in to comment.