From cd768489f373ca101a0bfd285ec9b8695087fc42 Mon Sep 17 00:00:00 2001 From: Arpit Agarwal Date: Fri, 15 Nov 2013 05:21:58 +0000 Subject: [PATCH] HDFS-5515. Fix TestDFSStartupVersions for HDFS-2832. git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-2832@1542176 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-2832.txt | 2 ++ .../hadoop/hdfs/server/datanode/DataStorage.java | 7 +++---- .../org/apache/hadoop/hdfs/TestDFSStartupVersions.java | 2 +- .../java/org/apache/hadoop/hdfs/UpgradeUtilities.java | 1 + .../server/namenode/TestListCorruptFileBlocks.java | 10 +++++----- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-2832.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-2832.txt index 0bb1ae9401..41d4407947 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-2832.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-2832.txt @@ -106,4 +106,6 @@ IMPROVEMENTS: HDFS-5510. Fix a findbug warning in DataStorage.java on HDFS-2832 branch. (Junping Du via Arpit Agarwal) + + HDFS-5515. Fix TestDFSStartupVersions for HDFS-2832. (Arpit Agarwal) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java index 819c7342b4..e03151c64b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataStorage.java @@ -97,8 +97,8 @@ public DataStorage(StorageInfo storageInfo) { public synchronized String getDatanodeUuid() { return datanodeUuid; } - - synchronized void setDatanodeUuid(String newDatanodeUuid) { + + public synchronized void setDatanodeUuid(String newDatanodeUuid) { this.datanodeUuid = newDatanodeUuid; } @@ -292,8 +292,7 @@ protected void setPropertiesFromFields(Properties props, props.setProperty("storageID", sd.getStorageUuid()); String datanodeUuid = getDatanodeUuid(); - if (LayoutVersion.supports(Feature.ADD_DATANODE_AND_STORAGE_UUIDS, - layoutVersion) && datanodeUuid != null) { + if (datanodeUuid != null) { props.setProperty("datanodeUuid", datanodeUuid); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStartupVersions.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStartupVersions.java index 797d5ca38c..980876cb86 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStartupVersions.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSStartupVersions.java @@ -237,7 +237,7 @@ boolean isVersionCompatible(StorageData namenodeSd, StorageData datanodeSd) { * this iterations version 3-tuple * */ - @Test + @Test (timeout=300000) public void testVersions() throws Exception { UpgradeUtilities.initialize(); Configuration conf = UpgradeUtilities.initializeStorageStateConf(1, diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/UpgradeUtilities.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/UpgradeUtilities.java index 5285458887..362aac4600 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/UpgradeUtilities.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/UpgradeUtilities.java @@ -454,6 +454,7 @@ public static void createDataNodeVersionFile(File[] parent, public static void createDataNodeVersionFile(File[] parent, StorageInfo version, String bpid, String bpidToWrite) throws IOException { DataStorage storage = new DataStorage(version); + storage.setDatanodeUuid("FixedDatanodeUuid"); File[] versionFiles = new File[parent.length]; for (int i = 0; i < parent.length; i++) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestListCorruptFileBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestListCorruptFileBlocks.java index 7c8a712a79..2b1578ca1d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestListCorruptFileBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestListCorruptFileBlocks.java @@ -55,7 +55,7 @@ public class TestListCorruptFileBlocks { static Log LOG = NameNode.stateChangeLog; /** check if nn.getCorruptFiles() returns a file that has corrupted blocks */ - @Test + @Test (timeout=300000) public void testListCorruptFilesCorruptedBlock() throws Exception { MiniDFSCluster cluster = null; Random random = new Random(); @@ -131,7 +131,7 @@ public void testListCorruptFilesCorruptedBlock() throws Exception { /** * Check that listCorruptFileBlocks works while the namenode is still in safemode. */ - @Test + @Test (timeout=300000) public void testListCorruptFileBlocksInSafeMode() throws Exception { MiniDFSCluster cluster = null; Random random = new Random(); @@ -262,7 +262,7 @@ public void testListCorruptFileBlocksInSafeMode() throws Exception { } // deliberately remove blocks from a file and validate the list-corrupt-file-blocks API - @Test + @Test (timeout=300000) public void testlistCorruptFileBlocks() throws Exception { Configuration conf = new Configuration(); conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000); @@ -372,7 +372,7 @@ private int countPaths(RemoteIterator iter) throws IOException { /** * test listCorruptFileBlocks in DistributedFileSystem */ - @Test + @Test (timeout=300000) public void testlistCorruptFileBlocksDFS() throws Exception { Configuration conf = new Configuration(); conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 1000); @@ -445,7 +445,7 @@ public void testlistCorruptFileBlocksDFS() throws Exception { * Also, test that DFS.listCorruptFileBlocks can make multiple successive * calls. */ - @Test + @Test (timeout=300000) public void testMaxCorruptFiles() throws Exception { MiniDFSCluster cluster = null; try {