diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 7ff3c780924..2037973a120 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1083,6 +1083,9 @@ Release 2.7.0 - UNRELEASED HDFS-7682. {{DistributedFileSystem#getFileChecksum}} of a snapshotted file includes non-snapshotted content. (Charles Lamb via atm) + HDFS-7869. Inconsistency in the return information while performing rolling + upgrade ( J.Andreina via vinayakumarb ) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index d2b48f37454..77b4a277109 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -7475,7 +7475,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, } } - void finalizeRollingUpgrade() throws IOException { + RollingUpgradeInfo finalizeRollingUpgrade() throws IOException { checkSuperuserPrivilege(); checkOperation(OperationCategory.WRITE); writeLock(); @@ -7483,7 +7483,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, try { checkOperation(OperationCategory.WRITE); if (!isRollingUpgrade()) { - return; + return null; } checkNameNodeSafeMode("Failed to finalize rolling upgrade"); @@ -7508,7 +7508,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, if (auditLog.isInfoEnabled() && isExternalInvocation()) { logAuditEvent(true, "finalizeRollingUpgrade", null, null, null); } - return; + return returnInfo; } RollingUpgradeInfo finalizeRollingUpgradeInternal(long finalizeTime) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java index 9ccdb40c93e..f20fb3575e3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeRpcServer.java @@ -1145,8 +1145,7 @@ class NameNodeRpcServer implements NamenodeProtocols { case PREPARE: return namesystem.startRollingUpgrade(); case FINALIZE: - namesystem.finalizeRollingUpgrade(); - return null; + return namesystem.finalizeRollingUpgrade(); default: throw new UnsupportedActionException(action + " is not yet supported."); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java index abbd46b7de3..e80b4c08135 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSAdmin.java @@ -341,7 +341,7 @@ public class DFSAdmin extends FsShell { private static void printMessage(RollingUpgradeInfo info, PrintStream out) { if (info != null && info.isStarted()) { - if (!info.createdRollbackImages()) { + if (!info.createdRollbackImages() && !info.isFinalized()) { out.println( "Preparing for upgrade. Data is being saved for rollback." + "\nRun \"dfsadmin -rollingUpgrade query\" to check the status" diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java index 974604976e6..8baebd8a625 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestRollingUpgrade.java @@ -244,7 +244,7 @@ public class TestRollingUpgrade { //finalize rolling upgrade final RollingUpgradeInfo finalize = dfs2.rollingUpgrade( RollingUpgradeAction.FINALIZE); - Assert.assertNull(finalize); + Assert.assertTrue(finalize.isFinalized()); LOG.info("RESTART cluster 2 with regular startup option"); cluster2.getNameNodeInfos()[0].setStartOpt(StartupOption.REGULAR); @@ -405,7 +405,7 @@ public class TestRollingUpgrade { Assert.assertTrue(fsimage.hasRollbackFSImage()); info = dfs.rollingUpgrade(RollingUpgradeAction.FINALIZE); - Assert.assertNull(info); + Assert.assertTrue(info.isFinalized()); Assert.assertTrue(dfs.exists(foo)); // Once finalized, there should be no more fsimage for rollbacks.