From 0fe0687c3e5bd456d2c09e9532eaf3a5617f720c Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Fri, 12 May 2017 17:42:47 -0500 Subject: [PATCH] HDFS-11818. TestBlockManager.testSufficientlyReplBlocksUsesNewRack fails intermittently. Contributed by Nathan Roberts --- .../hadoop/hdfs/server/blockmanagement/TestBlockManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java index beaef4a699c..3088b7b6e4c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlockManager.java @@ -159,7 +159,6 @@ public class TestBlockManager { Mockito.when(haState.shouldPopulateReplQueues()).thenReturn(true); Mockito.when(fsn.getHAContext()).thenReturn(haContext); bm = new BlockManager(fsn, false, conf); - bm.setInitializedReplQueues(true); CacheManager cm = Mockito.mock(CacheManager.class); Mockito.doReturn(cm).when(fsn).getCacheManager(); GSet cb = @@ -967,10 +966,12 @@ public class TestBlockManager { StorageReceivedDeletedBlocks srdb = new StorageReceivedDeletedBlocks(new DatanodeStorage(ds.getStorageID()), rdbiList.toArray(new ReceivedDeletedBlockInfo[rdbiList.size()])); + bm.setInitializedReplQueues(true); bm.processIncrementalBlockReport(node, srdb); // Needed replications should still be 0. assertEquals("UC block was incorrectly added to needed Replications", 0, bm.neededReconstruction.size()); + bm.setInitializedReplQueues(false); } private BlockInfo addBlockToBM(long blkId) {