From 325be6e7208c5aafe028543096120f10c1765783 Mon Sep 17 00:00:00 2001 From: Xiaoyu Yao Date: Thu, 6 Apr 2017 14:13:22 -0700 Subject: [PATCH] HDFS-11362. StorageDirectory should initialize a non-null default StorageDirType. Contribute by Hanisha Koneru. (cherry picked from commit dde3bbf351ef3121ae80a96d06668d8fe33c788f) --- .../java/org/apache/hadoop/hdfs/server/common/Storage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Storage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Storage.java index 5f340d92c73..5f48ead7579 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Storage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/common/Storage.java @@ -42,6 +42,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption; +import org.apache.hadoop.hdfs.server.namenode.NNStorage.NameNodeDirType; import org.apache.hadoop.io.nativeio.NativeIO; import org.apache.hadoop.io.nativeio.NativeIOException; import org.apache.hadoop.util.ToolRunner; @@ -272,7 +273,6 @@ public static class StorageDirectory implements FormatConfirmable { private String storageUuid = null; // Storage directory identifier. public StorageDirectory(File dir) { - // default dirType is null this(dir, null, false); } @@ -298,7 +298,8 @@ public String getStorageUuid() { public StorageDirectory(File dir, StorageDirType dirType, boolean isShared) { this.root = dir; this.lock = null; - this.dirType = dirType; + // default dirType is UNDEFINED + this.dirType = (dirType == null ? NameNodeDirType.UNDEFINED : dirType); this.isShared = isShared; }