You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ji...@apache.org on 2014/02/28 02:23:53 UTC
svn commit: r1572801 - in
/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs:
CHANGES_HDFS-5535.txt
src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
Author: jing9
Date: Fri Feb 28 01:23:52 2014
New Revision: 1572801
URL: http://svn.apache.org/r1572801
Log:
HDFS-6032. -rollingUpgrade query hits NPE after the NN restarts. Contributed by Haohui Mai.
Modified:
hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt?rev=1572801&r1=1572800&r2=1572801&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt (original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt Fri Feb 28 01:23:52 2014
@@ -120,3 +120,6 @@ HDFS-5535 subtasks:
HDFS-6029. Secondary NN fails to checkpoint after -rollingUpgrade prepare.
(jing9)
+
+ HDFS-6032. -rollingUpgrade query hits NPE after the NN restarts. (Haohui Mai
+ via jing9)
Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java?rev=1572801&r1=1572800&r2=1572801&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java (original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java Fri Feb 28 01:23:52 2014
@@ -881,9 +881,12 @@ public class FSImage implements Closeabl
*/
private void loadFSImage(File curFile, MD5Hash expectedMd5,
FSNamesystem target, MetaRecoveryContext recovery) throws IOException {
+ // BlockPoolId is required when the FsImageLoader loads the rolling upgrade
+ // information. Make sure the ID is properly set.
+ target.setBlockPoolId(this.getBlockPoolID());
+
FSImageFormat.LoaderDelegator loader = FSImageFormat.newLoader(conf, target);
loader.load(curFile);
- target.setBlockPoolId(this.getBlockPoolID());
// Check that the image digest we loaded matches up with what
// we expected
Modified: hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java?rev=1572801&r1=1572800&r2=1572801&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java (original)
+++ hadoop/common/branches/HDFS-5535/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java Fri Feb 28 01:23:52 2014
@@ -432,6 +432,32 @@ public class TestRollingUpgrade {
}
}
+ @Test (timeout = 300000)
+ public void testQueryAfterRestart() throws IOException, InterruptedException {
+ final Configuration conf = new Configuration();
+ MiniDFSCluster cluster = null;
+ try {
+ cluster = new MiniDFSCluster.Builder(conf).numDataNodes(0).build();
+ cluster.waitActive();
+ DistributedFileSystem dfs = cluster.getFileSystem();
+
+ dfs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
+ // start rolling upgrade
+ dfs.rollingUpgrade(RollingUpgradeAction.PREPARE);
+ queryForPreparation(dfs);
+ dfs.setSafeMode(SafeModeAction.SAFEMODE_ENTER);
+ dfs.saveNamespace();
+ dfs.setSafeMode(SafeModeAction.SAFEMODE_LEAVE);
+
+ cluster.restartNameNodes();
+ dfs.rollingUpgrade(RollingUpgradeAction.QUERY);
+ } finally {
+ if (cluster != null) {
+ cluster.shutdown();
+ }
+ }
+ }
+
@Test(timeout = 300000)
public void testCheckpoint() throws IOException, InterruptedException {
final Configuration conf = new Configuration();