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.
|
||||
(Haohui Mai via Arpit Agarwal)
|
||||
|
||||
HDFS-5980. Rollback does not need to load edits. (jing9 via szetszwo)
|
||||
|
@ -624,16 +624,15 @@ LayoutVersion.Feature.TXID_BASED_LAYOUT, getLayoutVersion())) {
|
||||
prog.endPhase(Phase.LOADING_FSIMAGE);
|
||||
long txnsAdvanced = 0;
|
||||
|
||||
loadEdits(editStreams, target, startOpt, recovery);
|
||||
if (rollingRollback) {
|
||||
// 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 {
|
||||
if (!rollingRollback) {
|
||||
loadEdits(editStreams, target, startOpt, recovery);
|
||||
needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(),
|
||||
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);
|
||||
return needToSave;
|
||||
@ -768,11 +767,8 @@ private long loadEdits(Iterable<EditLogInputStream> editStreams,
|
||||
// have been successfully applied before the error.
|
||||
lastAppliedTxId = loader.getLastAppliedTxId();
|
||||
}
|
||||
boolean rollingRollback = StartupOption
|
||||
.isRollingUpgradeRollback(startOpt);
|
||||
// If we are in recovery mode, we may have skipped over some txids.
|
||||
if (editIn.getLastTxId() != HdfsConstants.INVALID_TXID
|
||||
&& !rollingRollback) {
|
||||
if (editIn.getLastTxId() != HdfsConstants.INVALID_TXID) {
|
||||
lastAppliedTxId = editIn.getLastTxId();
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ public void testRollback() throws IOException {
|
||||
}
|
||||
|
||||
// Restart should succeed!
|
||||
// cluster.restartNameNode();
|
||||
cluster.restartNameNode();
|
||||
|
||||
cluster.restartNameNode("-rollingUpgrade", "rollback");
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user