diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java index b41e6089656..60178c73dee 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSOutputStream.java @@ -454,8 +454,8 @@ public class DFSOutputStream extends FSOutputSummer } private boolean initLazyPersist(HdfsFileStatus stat) { - final BlockStoragePolicy lpPolicy = - blockStoragePolicySuite.getPolicy("LAZY_PERSIST"); + final BlockStoragePolicy lpPolicy = blockStoragePolicySuite + .getPolicy(HdfsConstants.MEMORY_STORAGE_POLICY_NAME); return lpPolicy != null && stat.getStoragePolicy() == lpPolicy.getId(); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java index b0d1dca5175..ecd7a43d3a1 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/HdfsConstants.java @@ -166,14 +166,14 @@ public class HdfsConstants { public static final String SEPARATOR_DOT_SNAPSHOT_DIR_SEPARATOR = Path.SEPARATOR + DOT_SNAPSHOT_DIR + Path.SEPARATOR; + public static final String MEMORY_STORAGE_POLICY_NAME = "LAZY_PERSIST"; public static final String ALLSSD_STORAGE_POLICY_NAME = "ALL_SSD"; public static final String ONESSD_STORAGE_POLICY_NAME = "ONE_SSD"; public static final String HOT_STORAGE_POLICY_NAME = "HOT"; public static final String WARM_STORAGE_POLICY_NAME = "WARM"; public static final String COLD_STORAGE_POLICY_NAME = "COLD"; - public static final String LAZY_PERSIST_STORAGE_POLICY_NAME = "LAZY_PERSIST"; - public static final byte LAZY_PERSIST_STORAGE_POLICY_ID = 15; + public static final byte MEMORY_STORAGE_POLICY_ID = 15; public static final byte ALLSSD_STORAGE_POLICY_ID = 12; public static final byte ONESSD_STORAGE_POLICY_ID = 10; public static final byte HOT_STORAGE_POLICY_ID = 7; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java index fa949219d4f..c9b74bd7f5e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockStoragePolicySuite.java @@ -45,9 +45,9 @@ public class BlockStoragePolicySuite { public static BlockStoragePolicySuite createDefaultSuite() { final BlockStoragePolicy[] policies = new BlockStoragePolicy[1 << ID_BIT_LENGTH]; - final byte lazyPersistId = HdfsConstants.LAZY_PERSIST_STORAGE_POLICY_ID; + final byte lazyPersistId = HdfsConstants.MEMORY_STORAGE_POLICY_ID; policies[lazyPersistId] = new BlockStoragePolicy(lazyPersistId, - HdfsConstants.LAZY_PERSIST_STORAGE_POLICY_NAME, + HdfsConstants.MEMORY_STORAGE_POLICY_NAME, new StorageType[]{StorageType.RAM_DISK, StorageType.DISK}, new StorageType[]{StorageType.DISK}, new StorageType[]{StorageType.DISK}, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestBlockStoragePolicy.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestBlockStoragePolicy.java index cf032a9df5c..d053a79d750 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestBlockStoragePolicy.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestBlockStoragePolicy.java @@ -71,7 +71,7 @@ public class TestBlockStoragePolicy { static final byte HOT = HdfsConstants.HOT_STORAGE_POLICY_ID; static final byte ONESSD = HdfsConstants.ONESSD_STORAGE_POLICY_ID; static final byte ALLSSD = HdfsConstants.ALLSSD_STORAGE_POLICY_ID; - static final byte LAZY_PERSIST = HdfsConstants.LAZY_PERSIST_STORAGE_POLICY_ID; + static final byte LAZY_PERSIST = HdfsConstants.MEMORY_STORAGE_POLICY_ID; @Test (timeout=300000) public void testConfigKeyEnabled() throws IOException {