HDFS-11946. Ozone: Containers in different datanodes are mapped to the same location. Contributed by Nandakumar

This commit is contained in:
Tsz-Wo Nicholas Sze 2017-06-13 17:25:20 +08:00
parent 0a05da9a89
commit 0688a1c25a
1 changed files with 6 additions and 1 deletions

View File

@ -111,6 +111,11 @@ public final class MiniOzoneCluster extends MiniDFSCluster
String.valueOf(NetUtils.createSocketAddr(address).getPort())); String.valueOf(NetUtils.createSocketAddr(address).getPort()));
setConf(i, dnConf, OzoneConfigKeys.DFS_CONTAINER_RATIS_DATANODE_STORAGE_DIR, setConf(i, dnConf, OzoneConfigKeys.DFS_CONTAINER_RATIS_DATANODE_STORAGE_DIR,
getInstanceStorageDir(i, -1).getCanonicalPath()); getInstanceStorageDir(i, -1).getCanonicalPath());
String containerMetaDirs = dnConf.get(
OzoneConfigKeys.OZONE_CONTAINER_METADATA_DIRS) + "-dn-" + i;
Files.createDirectories(Paths.get(containerMetaDirs));
setConf(i, dnConf, OzoneConfigKeys.OZONE_CONTAINER_METADATA_DIRS,
containerMetaDirs);
} }
static void setConf(int i, Configuration conf, String key, String value) { static void setConf(int i, Configuration conf, String key, String value) {
@ -406,7 +411,7 @@ public final class MiniOzoneCluster extends MiniDFSCluster
// If user has not specified a path, create a UUID for this miniCluster // If user has not specified a path, create a UUID for this miniCluster
// and create SCM under that directory. // and create SCM under that directory.
Path scmPath = Paths.get(path, runID.toString(), "scm"); Path scmPath = Paths.get(path, runID.toString(), "cont-meta");
Files.createDirectories(scmPath); Files.createDirectories(scmPath);
conf.set(OzoneConfigKeys.OZONE_CONTAINER_METADATA_DIRS, scmPath conf.set(OzoneConfigKeys.OZONE_CONTAINER_METADATA_DIRS, scmPath
.toString()); .toString());