HDFS-5984. Fix TestEditLog and TestStandbyCheckpoints. Contributed by jing9

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-5535@1570361 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tsz-wo Sze 2014-02-20 21:42:10 +00:00
parent 55aec006f4
commit 016d3b8171
3 changed files with 9 additions and 8 deletions

View File

@ -60,3 +60,5 @@ HDFS-5535 subtasks:
(Haohui Mai via Arpit Agarwal) (Haohui Mai via Arpit Agarwal)
HDFS-5980. Rollback does not need to load edits. (jing9 via szetszwo) HDFS-5980. Rollback does not need to load edits. (jing9 via szetszwo)
HDFS-5984. Fix TestEditLog and TestStandbyCheckpoints. (jing9 via szetszwo)

View File

@ -623,10 +623,9 @@ public class FSImage implements Closeable {
throw new IOException("Failed to load an FSImage file!"); throw new IOException("Failed to load an FSImage file!");
} }
prog.endPhase(Phase.LOADING_FSIMAGE); prog.endPhase(Phase.LOADING_FSIMAGE);
long txnsAdvanced = 0;
if (!rollingRollback) { if (!rollingRollback) {
loadEdits(editStreams, target, startOpt, recovery); long txnsAdvanced = loadEdits(editStreams, target, startOpt, recovery);
needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(), needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(),
txnsAdvanced); txnsAdvanced);
} else { } else {

View File

@ -192,9 +192,9 @@ public class TestStandbyCheckpoints {
Thread.sleep(2000); Thread.sleep(2000);
// We should make exactly one checkpoint at this new txid. // We should make exactly one checkpoint at this new txid.
Mockito.verify(spyImage1, Mockito.times(1)) Mockito.verify(spyImage1, Mockito.times(1)).saveNamespace(
.saveNamespace((FSNamesystem) Mockito.anyObject(), NameNodeFile.IMAGE, (FSNamesystem) Mockito.anyObject(), Mockito.eq(NameNodeFile.IMAGE),
(Canceler)Mockito.anyObject()); (Canceler) Mockito.anyObject());
} }
/** /**
@ -281,9 +281,9 @@ public class TestStandbyCheckpoints {
FSImage spyImage1 = NameNodeAdapter.spyOnFsImage(nn1); FSImage spyImage1 = NameNodeAdapter.spyOnFsImage(nn1);
DelayAnswer answerer = new DelayAnswer(LOG); DelayAnswer answerer = new DelayAnswer(LOG);
Mockito.doAnswer(answerer).when(spyImage1) Mockito.doAnswer(answerer).when(spyImage1)
.saveNamespace(Mockito.any(FSNamesystem.class), NameNodeFile.IMAGE, .saveNamespace(Mockito.any(FSNamesystem.class),
Mockito.any(Canceler.class)); Mockito.eq(NameNodeFile.IMAGE), Mockito.any(Canceler.class));
// Perform some edits and wait for a checkpoint to start on the SBN. // Perform some edits and wait for a checkpoint to start on the SBN.
doEdits(0, 1000); doEdits(0, 1000);
nn0.getRpcServer().rollEditLog(); nn0.getRpcServer().rollEditLog();