HDFS-7869. Inconsistency in the return information while performing rolling upgrade ( Contributed by J.Andreina )

(cherry picked from commit 3560180b6e)
This commit is contained in:
Vinayakumar B 2015-03-04 14:38:38 +05:30
parent 31b3f84601
commit c24448c27b
5 changed files with 10 additions and 8 deletions

View File

@ -777,6 +777,9 @@ Release 2.7.0 - UNRELEASED
HDFS-7682. {{DistributedFileSystem#getFileChecksum}} of a snapshotted file HDFS-7682. {{DistributedFileSystem#getFileChecksum}} of a snapshotted file
includes non-snapshotted content. (Charles Lamb via atm) 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 BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS
HDFS-7720. Quota by Storage Type API, tools and ClientNameNode HDFS-7720. Quota by Storage Type API, tools and ClientNameNode

View File

@ -7475,7 +7475,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
} }
} }
void finalizeRollingUpgrade() throws IOException { RollingUpgradeInfo finalizeRollingUpgrade() throws IOException {
checkSuperuserPrivilege(); checkSuperuserPrivilege();
checkOperation(OperationCategory.WRITE); checkOperation(OperationCategory.WRITE);
writeLock(); writeLock();
@ -7483,7 +7483,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
try { try {
checkOperation(OperationCategory.WRITE); checkOperation(OperationCategory.WRITE);
if (!isRollingUpgrade()) { if (!isRollingUpgrade()) {
return; return null;
} }
checkNameNodeSafeMode("Failed to finalize rolling upgrade"); checkNameNodeSafeMode("Failed to finalize rolling upgrade");
@ -7508,7 +7508,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean,
if (auditLog.isInfoEnabled() && isExternalInvocation()) { if (auditLog.isInfoEnabled() && isExternalInvocation()) {
logAuditEvent(true, "finalizeRollingUpgrade", null, null, null); logAuditEvent(true, "finalizeRollingUpgrade", null, null, null);
} }
return; return returnInfo;
} }
RollingUpgradeInfo finalizeRollingUpgradeInternal(long finalizeTime) RollingUpgradeInfo finalizeRollingUpgradeInternal(long finalizeTime)

View File

@ -1139,8 +1139,7 @@ class NameNodeRpcServer implements NamenodeProtocols {
case PREPARE: case PREPARE:
return namesystem.startRollingUpgrade(); return namesystem.startRollingUpgrade();
case FINALIZE: case FINALIZE:
namesystem.finalizeRollingUpgrade(); return namesystem.finalizeRollingUpgrade();
return null;
default: default:
throw new UnsupportedActionException(action + " is not yet supported."); throw new UnsupportedActionException(action + " is not yet supported.");
} }

View File

@ -341,7 +341,7 @@ public class DFSAdmin extends FsShell {
private static void printMessage(RollingUpgradeInfo info, private static void printMessage(RollingUpgradeInfo info,
PrintStream out) { PrintStream out) {
if (info != null && info.isStarted()) { if (info != null && info.isStarted()) {
if (!info.createdRollbackImages()) { if (!info.createdRollbackImages() && !info.isFinalized()) {
out.println( out.println(
"Preparing for upgrade. Data is being saved for rollback." "Preparing for upgrade. Data is being saved for rollback."
+ "\nRun \"dfsadmin -rollingUpgrade query\" to check the status" + "\nRun \"dfsadmin -rollingUpgrade query\" to check the status"

View File

@ -244,7 +244,7 @@ public class TestRollingUpgrade {
//finalize rolling upgrade //finalize rolling upgrade
final RollingUpgradeInfo finalize = dfs2.rollingUpgrade( final RollingUpgradeInfo finalize = dfs2.rollingUpgrade(
RollingUpgradeAction.FINALIZE); RollingUpgradeAction.FINALIZE);
Assert.assertNull(finalize); Assert.assertTrue(finalize.isFinalized());
LOG.info("RESTART cluster 2 with regular startup option"); LOG.info("RESTART cluster 2 with regular startup option");
cluster2.getNameNodeInfos()[0].setStartOpt(StartupOption.REGULAR); cluster2.getNameNodeInfos()[0].setStartOpt(StartupOption.REGULAR);
@ -405,7 +405,7 @@ public class TestRollingUpgrade {
Assert.assertTrue(fsimage.hasRollbackFSImage()); Assert.assertTrue(fsimage.hasRollbackFSImage());
info = dfs.rollingUpgrade(RollingUpgradeAction.FINALIZE); info = dfs.rollingUpgrade(RollingUpgradeAction.FINALIZE);
Assert.assertNull(info); Assert.assertTrue(info.isFinalized());
Assert.assertTrue(dfs.exists(foo)); Assert.assertTrue(dfs.exists(foo));
// Once finalized, there should be no more fsimage for rollbacks. // Once finalized, there should be no more fsimage for rollbacks.