svn merge -c 1606371 merging from trunk to branch-2 to fix:HDFS-6601. Issues in finalizing rolling upgrade when there is a layout version change.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1606372 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kihwal Lee 2014-06-28 15:25:18 +00:00
parent e41a821997
commit 28b82d46af
5 changed files with 22 additions and 1 deletions

View File

@ -478,6 +478,9 @@ Release 2.5.0 - UNRELEASED
HDFS-6556. Refine XAttr permissions (umamahesh)
HDFS-6601. Issues in finalizing rolling upgrade when there is a layout
version change (kihwal)
BREAKDOWN OF HDFS-2006 SUBTASKS AND RELATED JIRAS
HDFS-6299. Protobuf for XAttr and client-side implementation. (Yi Liu via umamahesh)

View File

@ -743,7 +743,13 @@ public class FSEditLogLoader {
}
case OP_ROLLING_UPGRADE_FINALIZE: {
final long finalizeTime = ((RollingUpgradeOp) op).getTime();
fsNamesys.finalizeRollingUpgradeInternal(finalizeTime);
if (fsNamesys.isRollingUpgrade()) {
// Only do it when NN is actually doing rolling upgrade.
// We can get FINALIZE without corresponding START, if NN is restarted
// before this op is consumed and a new checkpoint is created.
fsNamesys.finalizeRollingUpgradeInternal(finalizeTime);
}
fsNamesys.getFSImage().updateStorageVersion();
fsNamesys.getFSImage().renameCheckpoint(NameNodeFile.IMAGE_ROLLBACK,
NameNodeFile.IMAGE);
break;

View File

@ -1021,6 +1021,13 @@ public class FSImage implements Closeable {
}
}
/**
* Update version of all storage directories.
*/
public synchronized void updateStorageVersion() throws IOException {
storage.writeAll();
}
/**
* @see #saveNamespace(FSNamesystem, Canceler)
*/

View File

@ -7729,6 +7729,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
// roll the edit log to make sure the standby NameNode can tail
getFSImage().rollEditLog();
}
getFSImage().updateStorageVersion();
getFSImage().renameCheckpoint(NameNodeFile.IMAGE_ROLLBACK,
NameNodeFile.IMAGE);
} finally {

View File

@ -390,6 +390,10 @@ public class TestRollingUpgrade {
// Once finalized, there should be no more fsimage for rollbacks.
Assert.assertFalse(fsimage.hasRollbackFSImage());
// Should have no problem in restart and replaying edits that include
// the FINALIZE op.
dfsCluster.restartNameNode(0);
} finally {
if (cluster != null) {
cluster.shutdown();