You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by na...@apache.org on 2017/10/11 11:58:48 UTC

hadoop git commit: HDFS-12631. Ozone: ContainerStorageLocation#scmUsage should count only SCM usage. Contributed by Xiaoyu Yao.

Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 98f467106 -> 87194bb39


HDFS-12631. Ozone: ContainerStorageLocation#scmUsage should count only SCM usage. Contributed by Xiaoyu Yao.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/87194bb3
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/87194bb3
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/87194bb3

Branch: refs/heads/HDFS-7240
Commit: 87194bb39c99c82c63718dfcbe7be890c64e365b
Parents: 98f4671
Author: Nandakumar <na...@apache.org>
Authored: Wed Oct 11 17:28:09 2017 +0530
Committer: Nandakumar <na...@apache.org>
Committed: Wed Oct 11 17:28:09 2017 +0530

----------------------------------------------------------------------
 .../common/impl/ContainerStorageLocation.java         | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/87194bb3/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStorageLocation.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStorageLocation.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStorageLocation.java
index ebf0bf8..07a3a53 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStorageLocation.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/container/common/impl/ContainerStorageLocation.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.fs.GetSpaceUsed;
 import org.apache.hadoop.hdfs.server.datanode.StorageLocation;
 import org.apache.hadoop.hdfs.server.protocol.DatanodeStorage;
 import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.ozone.OzoneConsts;
 import org.apache.hadoop.util.ShutdownHookManager;
 import org.apache.hadoop.util.Time;
 import org.slf4j.Logger;
@@ -37,6 +38,7 @@ import java.io.OutputStreamWriter;
 import java.io.FileOutputStream;
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.Paths;
 import java.util.Scanner;
 
 import static org.apache.hadoop.util.RunJar.SHUTDOWN_HOOK_PRIORITY;
@@ -62,7 +64,17 @@ public class ContainerStorageLocation {
       throws IOException {
     this.dataLocation = dataLoc;
     this.storageUuId = DatanodeStorage.generateUuid();
-    File dataDir = new File(dataLoc.getNormalizedUri().getPath());
+    File dataDir = Paths.get(dataLoc.getNormalizedUri()).resolve(
+        OzoneConsts.CONTAINER_PREFIX).toFile();
+    // Initialize container data root if it does not exist as required by DF/DU
+    if (!dataDir.exists()) {
+      if (!dataDir.mkdirs()) {
+        LOG.error("Unable to create the container storage location at : {}",
+            dataDir);
+        throw new IllegalArgumentException("Unable to create the container" +
+            " storage location at : " + dataDir);
+      }
+    }
     scmUsedFile = new File(dataDir, DU_CACHE_FILE);
     // get overall disk usage
     this.usage = new DF(dataDir, conf);


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org