HDFS-11362. StorageDirectory should initialize a non-null default StorageDirType. Contribute by Hanisha Koneru.

(cherry picked from commit dde3bbf351ef3121ae80a96d06668d8fe33c788f)
This commit is contained in:
Xiaoyu Yao 2017-04-06 14:13:22 -07:00
parent 84b7f2e956
commit 325be6e720
1 changed files with 3 additions and 2 deletions

View File

@ -42,6 +42,7 @@ import org.apache.hadoop.fs.FileUtil;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.NodeType;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants.StartupOption; 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.NativeIO;
import org.apache.hadoop.io.nativeio.NativeIOException; import org.apache.hadoop.io.nativeio.NativeIOException;
import org.apache.hadoop.util.ToolRunner; import org.apache.hadoop.util.ToolRunner;
@ -272,7 +273,6 @@ public abstract class Storage extends StorageInfo {
private String storageUuid = null; // Storage directory identifier. private String storageUuid = null; // Storage directory identifier.
public StorageDirectory(File dir) { public StorageDirectory(File dir) {
// default dirType is null
this(dir, null, false); this(dir, null, false);
} }
@ -298,7 +298,8 @@ public abstract class Storage extends StorageInfo {
public StorageDirectory(File dir, StorageDirType dirType, boolean isShared) { public StorageDirectory(File dir, StorageDirType dirType, boolean isShared) {
this.root = dir; this.root = dir;
this.lock = null; this.lock = null;
this.dirType = dirType; // default dirType is UNDEFINED
this.dirType = (dirType == null ? NameNodeDirType.UNDEFINED : dirType);
this.isShared = isShared; this.isShared = isShared;
} }