HDFS-9225. Fix intermittent test failure of TestBlockManager.testBlocksAreNotUnderreplicatedInSingleRack. Contributed by Masatake Iwasaki.

This commit is contained in:
Andrew Wang 2015-10-21 14:55:23 -07:00
parent 2f19602bba
commit 3e50f478b9
2 changed files with 7 additions and 3 deletions

View File

@ -1549,6 +1549,10 @@ Release 2.8.0 - UNRELEASED
HDFS-8647. Abstract BlockManager's rack policy into BlockPlacementPolicy.
(Brahma Reddy Battula via mingma)
HDFS-9225. Fix intermittent test failure of
TestBlockManager.testBlocksAreNotUnderreplicatedInSingleRack.
(Masatake Iwasaki via wang)
OPTIMIZATIONS
HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than

View File

@ -100,6 +100,7 @@ public void setupMockCluster() throws IOException {
fsn = Mockito.mock(FSNamesystem.class);
Mockito.doReturn(true).when(fsn).hasWriteLock();
Mockito.doReturn(true).when(fsn).hasReadLock();
Mockito.doReturn(true).when(fsn).isRunning();
bm = new BlockManager(fsn, conf);
final String[] racks = {
"/rackA",
@ -373,9 +374,8 @@ private void doTestSingleRackClusterIsSufficientlyReplicated(int testIndex,
List<DatanodeDescriptor> origNodes)
throws Exception {
assertEquals(0, bm.numOfUnderReplicatedBlocks());
addBlockOnNodes(testIndex, origNodes);
bm.processMisReplicatedBlocks();
assertEquals(0, bm.numOfUnderReplicatedBlocks());
BlockInfo block = addBlockOnNodes(testIndex, origNodes);
assertFalse(bm.isNeededReplication(block, bm.countLiveNodes(block)));
}