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. 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 void setupMockCluster() throws IOException {
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 @@ private void doTestSingleRackClusterIsSufficientlyReplicated(int testIndex,
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());
} }