HDFS-5980. Rollback does not need to load edits. Contributed by jing9
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-5535@1570078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
50a0bedead
commit
2088584864
|
@ -59,3 +59,4 @@ HDFS-5535 subtasks:
|
||||||
HDFS-5976. Create unit tests for downgrade and finalize rolling upgrade.
|
HDFS-5976. Create unit tests for downgrade and finalize rolling upgrade.
|
||||||
(Haohui Mai via Arpit Agarwal)
|
(Haohui Mai via Arpit Agarwal)
|
||||||
|
|
||||||
|
HDFS-5980. Rollback does not need to load edits. (jing9 via szetszwo)
|
||||||
|
|
|
@ -624,16 +624,15 @@ public class FSImage implements Closeable {
|
||||||
prog.endPhase(Phase.LOADING_FSIMAGE);
|
prog.endPhase(Phase.LOADING_FSIMAGE);
|
||||||
long txnsAdvanced = 0;
|
long txnsAdvanced = 0;
|
||||||
|
|
||||||
loadEdits(editStreams, target, startOpt, recovery);
|
if (!rollingRollback) {
|
||||||
if (rollingRollback) {
|
loadEdits(editStreams, target, startOpt, recovery);
|
||||||
// Trigger the rollback for rolling upgrade.
|
|
||||||
// Here lastAppliedTxId == (markerTxId - 1), and we should decrease 1 from
|
|
||||||
// lastAppliedTxId for the start-segment transaction.
|
|
||||||
rollingRollback(lastAppliedTxId--, imageFiles.get(0).getCheckpointTxId());
|
|
||||||
needToSave = false;
|
|
||||||
} else {
|
|
||||||
needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(),
|
needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(),
|
||||||
txnsAdvanced);
|
txnsAdvanced);
|
||||||
|
} else {
|
||||||
|
// Trigger the rollback for rolling upgrade. Here lastAppliedTxId equals
|
||||||
|
// to the last txid in rollback fsimage.
|
||||||
|
rollingRollback(lastAppliedTxId + 1, imageFiles.get(0).getCheckpointTxId());
|
||||||
|
needToSave = false;
|
||||||
}
|
}
|
||||||
editLog.setNextTxId(lastAppliedTxId + 1);
|
editLog.setNextTxId(lastAppliedTxId + 1);
|
||||||
return needToSave;
|
return needToSave;
|
||||||
|
@ -768,11 +767,8 @@ public class FSImage implements Closeable {
|
||||||
// have been successfully applied before the error.
|
// have been successfully applied before the error.
|
||||||
lastAppliedTxId = loader.getLastAppliedTxId();
|
lastAppliedTxId = loader.getLastAppliedTxId();
|
||||||
}
|
}
|
||||||
boolean rollingRollback = StartupOption
|
|
||||||
.isRollingUpgradeRollback(startOpt);
|
|
||||||
// If we are in recovery mode, we may have skipped over some txids.
|
// If we are in recovery mode, we may have skipped over some txids.
|
||||||
if (editIn.getLastTxId() != HdfsConstants.INVALID_TXID
|
if (editIn.getLastTxId() != HdfsConstants.INVALID_TXID) {
|
||||||
&& !rollingRollback) {
|
|
||||||
lastAppliedTxId = editIn.getLastTxId();
|
lastAppliedTxId = editIn.getLastTxId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -268,7 +268,7 @@ public class TestRollingUpgrade {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restart should succeed!
|
// Restart should succeed!
|
||||||
// cluster.restartNameNode();
|
cluster.restartNameNode();
|
||||||
|
|
||||||
cluster.restartNameNode("-rollingUpgrade", "rollback");
|
cluster.restartNameNode("-rollingUpgrade", "rollback");
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue