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

(cherry picked from commit 3e50f478b9)
This commit is contained in:
Andrew Wang 2015-10-21 14:55:23 -07:00
parent 7c002e2416
commit 378cb17057
2 changed files with 7 additions and 3 deletions

View File

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

View File

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