From fd036896a803bdf0e72c8c9d76f56e0da518c481 Mon Sep 17 00:00:00 2001 From: Tsz-Wo Nicholas Sze Date: Wed, 15 Oct 2014 20:56:59 -0700 Subject: [PATCH] HDFS-5089. When a LayoutVersion support SNAPSHOT, it must support FSIMAGE_NAME_OPTIMIZATION. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/protocol/LayoutVersion.java | 4 ++-- .../hadoop/hdfs/protocol/TestLayoutVersion.java | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 5c6e263b55f..8f4d6ee68ec 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -567,6 +567,9 @@ Release 2.6.0 - UNRELEASED HDFS-7208. NN doesn't schedule replication when a DN storage fails. (Ming Ma via szetszwo) + HDFS-5089. When a LayoutVersion support SNAPSHOT, it must support + FSIMAGE_NAME_OPTIMIZATION. (szetszwo) + BREAKDOWN OF HDFS-6134 AND HADOOP-10150 SUBTASKS AND RELATED JIRAS HDFS-6387. HDFS CLI admin tool for creating & deleting an diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutVersion.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutVersion.java index 760db980d91..349f72ceba8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutVersion.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/LayoutVersion.java @@ -107,8 +107,8 @@ public class LayoutVersion { RESERVED_REL1_2_0(-41, -32, "Reserved for release 1.2.0", true, CONCAT), ADD_INODE_ID(-42, -40, "Assign a unique inode id for each inode", false), SNAPSHOT(-43, "Support for snapshot feature"), - RESERVED_REL1_3_0(-44, -41, - "Reserved for release 1.3.0", true, ADD_INODE_ID, SNAPSHOT), + RESERVED_REL1_3_0(-44, -41, "Reserved for release 1.3.0", true, + ADD_INODE_ID, SNAPSHOT, FSIMAGE_NAME_OPTIMIZATION), OPTIMIZE_SNAPSHOT_INODES(-45, -43, "Reduce snapshot inode memory footprint", false), SEQUENTIAL_BLOCK_ID(-46, "Allocate block IDs sequentially and store " + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestLayoutVersion.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestLayoutVersion.java index dbd96bb6105..bb59a17806e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestLayoutVersion.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/protocol/TestLayoutVersion.java @@ -120,4 +120,19 @@ public class TestLayoutVersion { NameNodeLayoutVersion.supports(feature, lv)); } } + + /** + * When a LayoutVersion support SNAPSHOT, it must support + * FSIMAGE_NAME_OPTIMIZATION. + */ + @Test + public void testSNAPSHOT() { + for(Feature f : Feature.values()) { + final int version = f.getInfo().getLayoutVersion(); + if (NameNodeLayoutVersion.supports(Feature.SNAPSHOT, version)) { + assertTrue(NameNodeLayoutVersion.supports( + Feature.FSIMAGE_NAME_OPTIMIZATION, version)); + } + } + } }