HDFS-6924. Add new RAM_DISK storage type. (Arpit Agarwal)
Conflicts: hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/StorageType.java hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocolPB/PBHelper.java hadoop-hdfs-project/hadoop-hdfs/src/main/proto/hdfs.proto
This commit is contained in:
parent
db2bfed839
commit
d09f316520
|
@ -33,7 +33,8 @@ import org.apache.hadoop.classification.InterfaceStability;
|
|||
public enum StorageType {
|
||||
DISK,
|
||||
SSD,
|
||||
ARCHIVE;
|
||||
ARCHIVE,
|
||||
RAM_DISK;
|
||||
|
||||
public static final StorageType DEFAULT = DISK;
|
||||
|
||||
|
|
|
@ -1785,6 +1785,8 @@ public class PBHelper {
|
|||
return StorageTypeProto.SSD;
|
||||
case ARCHIVE:
|
||||
return StorageTypeProto.ARCHIVE;
|
||||
case RAM_DISK:
|
||||
return StorageTypeProto.RAM_DISK;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"BUG: StorageType not found, type=" + type);
|
||||
|
@ -1815,6 +1817,8 @@ public class PBHelper {
|
|||
return StorageType.SSD;
|
||||
case ARCHIVE:
|
||||
return StorageType.ARCHIVE;
|
||||
case RAM_DISK:
|
||||
return StorageType.RAM_DISK;
|
||||
default:
|
||||
throw new IllegalStateException(
|
||||
"BUG: StorageTypeProto not found, type=" + type);
|
||||
|
|
|
@ -159,6 +159,7 @@ enum StorageTypeProto {
|
|||
DISK = 1;
|
||||
SSD = 2;
|
||||
ARCHIVE = 3;
|
||||
RAM_DISK = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -305,7 +306,6 @@ message HdfsFileStatusProto {
|
|||
// Optional field for fileId
|
||||
optional uint64 fileId = 13 [default = 0]; // default as an invalid id
|
||||
optional int32 childrenNum = 14 [default = -1];
|
||||
|
||||
// Optional field for file encryption
|
||||
optional FileEncryptionInfoProto fileEncryptionInfo = 15;
|
||||
|
||||
|
|
|
@ -448,13 +448,16 @@ public class TestPBHelper {
|
|||
DFSTestUtil.getLocalDatanodeInfo("127.0.0.1", "h2",
|
||||
AdminStates.DECOMMISSIONED),
|
||||
DFSTestUtil.getLocalDatanodeInfo("127.0.0.1", "h3",
|
||||
AdminStates.NORMAL)
|
||||
AdminStates.NORMAL),
|
||||
DFSTestUtil.getLocalDatanodeInfo("127.0.0.1", "h4",
|
||||
AdminStates.NORMAL),
|
||||
};
|
||||
String[] storageIDs = {"s1", "s2", "s3"};
|
||||
String[] storageIDs = {"s1", "s2", "s3", "s4"};
|
||||
StorageType[] media = {
|
||||
StorageType.DISK,
|
||||
StorageType.SSD,
|
||||
StorageType.DISK
|
||||
StorageType.DISK,
|
||||
StorageType.RAM_DISK
|
||||
};
|
||||
LocatedBlock lb = new LocatedBlock(
|
||||
new ExtendedBlock("bp12", 12345, 10, 53),
|
||||
|
|
|
@ -44,10 +44,11 @@ public class TestDataDirs {
|
|||
File dir1 = new File("/dir1");
|
||||
File dir2 = new File("/dir2");
|
||||
File dir3 = new File("/dir3");
|
||||
File dir4 = new File("/dir4");
|
||||
|
||||
// Verify that a valid string is correctly parsed, and that storage
|
||||
// type is not case-sensitive
|
||||
String locations1 = "[disk]/dir0,[DISK]/dir1,[sSd]/dir2,[disK]/dir3";
|
||||
String locations1 = "[disk]/dir0,[DISK]/dir1,[sSd]/dir2,[disK]/dir3,[ram_disk]/dir4";
|
||||
conf.set(DFS_DATANODE_DATA_DIR_KEY, locations1);
|
||||
locations = DataNode.getStorageLocations(conf);
|
||||
assertThat(locations.size(), is(4));
|
||||
|
@ -59,6 +60,8 @@ public class TestDataDirs {
|
|||
assertThat(locations.get(2).getUri(), is(dir2.toURI()));
|
||||
assertThat(locations.get(3).getStorageType(), is(StorageType.DISK));
|
||||
assertThat(locations.get(3).getUri(), is(dir3.toURI()));
|
||||
assertThat(locations.get(4).getStorageType(), is(StorageType.RAM_DISK));
|
||||
assertThat(locations.get(4).getUri(), is(dir4.toURI()));
|
||||
|
||||
// Verify that an unrecognized storage type result in an exception.
|
||||
String locations2 = "[BadMediaType]/dir0,[ssd]/dir1,[disk]/dir2";
|
||||
|
|
Loading…
Reference in New Issue