HDFS-11818. TestBlockManager.testSufficientlyReplBlocksUsesNewRack fails intermittently. Contributed by Nathan Roberts

This commit is contained in:
Jason Lowe 2017-05-12 17:42:47 -05:00
parent 7bc2172248
commit 2397a2626e
1 changed files with 2 additions and 1 deletions

View File

@ -159,7 +159,6 @@ public class TestBlockManager {
Mockito.when(haState.shouldPopulateReplQueues()).thenReturn(true); Mockito.when(haState.shouldPopulateReplQueues()).thenReturn(true);
Mockito.when(fsn.getHAContext()).thenReturn(haContext); Mockito.when(fsn.getHAContext()).thenReturn(haContext);
bm = new BlockManager(fsn, false, conf); bm = new BlockManager(fsn, false, conf);
bm.setInitializedReplQueues(true);
CacheManager cm = Mockito.mock(CacheManager.class); CacheManager cm = Mockito.mock(CacheManager.class);
Mockito.doReturn(cm).when(fsn).getCacheManager(); Mockito.doReturn(cm).when(fsn).getCacheManager();
GSet<CachedBlock, CachedBlock> cb = GSet<CachedBlock, CachedBlock> cb =
@ -967,10 +966,12 @@ public class TestBlockManager {
StorageReceivedDeletedBlocks srdb = StorageReceivedDeletedBlocks srdb =
new StorageReceivedDeletedBlocks(new DatanodeStorage(ds.getStorageID()), new StorageReceivedDeletedBlocks(new DatanodeStorage(ds.getStorageID()),
rdbiList.toArray(new ReceivedDeletedBlockInfo[rdbiList.size()])); rdbiList.toArray(new ReceivedDeletedBlockInfo[rdbiList.size()]));
bm.setInitializedReplQueues(true);
bm.processIncrementalBlockReport(node, srdb); bm.processIncrementalBlockReport(node, srdb);
// Needed replications should still be 0. // Needed replications should still be 0.
assertEquals("UC block was incorrectly added to needed Replications", assertEquals("UC block was incorrectly added to needed Replications",
0, bm.neededReconstruction.size()); 0, bm.neededReconstruction.size());
bm.setInitializedReplQueues(false);
} }
private BlockInfo addBlockToBM(long blkId) { private BlockInfo addBlockToBM(long blkId) {