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)
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 @@ LayoutVersion.Feature.TXID_BASED_LAYOUT, getLayoutVersion())) {
throw new IOException("Failed to load an FSImage file!");
}
prog.endPhase(Phase.LOADING_FSIMAGE);
long txnsAdvanced = 0;
if (!rollingRollback) {
loadEdits(editStreams, target, startOpt, recovery);
long txnsAdvanced = loadEdits(editStreams, target, startOpt, recovery);
needToSave |= needsResaveBasedOnStaleCheckpoint(imageFile.getFile(),
txnsAdvanced);
} else {

View File

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