From f77d54c24343e6ca7c438d9db431cef14c3ae77b Mon Sep 17 00:00:00 2001 From: Ayush Saxena Date: Tue, 16 Jul 2019 08:14:27 +0530 Subject: [PATCH] HDFS-14642. processMisReplicatedBlocks does not return correct processed count. Contributed by Stephen O'Donnell. --- .../apache/hadoop/hdfs/server/blockmanagement/BlockManager.java | 1 + .../server/blockmanagement/TestBlocksWithNotEnoughRacks.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 858b82faca..74e3853c3f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -3642,6 +3642,7 @@ public int processMisReplicatedBlocks(List blocks) { while (iter.hasNext() && processed < limit) { BlockInfo blk = iter.next(); MisReplicationResult r = processMisReplicatedBlock(blk); + processed++; LOG.debug("BLOCK* processMisReplicatedBlocks: " + "Re-scanned block {}, result is {}", blk, r); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlocksWithNotEnoughRacks.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlocksWithNotEnoughRacks.java index 85f8e54654..1704367284 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlocksWithNotEnoughRacks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestBlocksWithNotEnoughRacks.java @@ -205,7 +205,7 @@ public void testMisReplicatedBlockUsesNewRack() throws Exception { "/testFile: Replica placement policy is violated")); assertTrue(fsckOp.contains(" Block should be additionally replicated" + " on 1 more rack(s). Total number of racks in the cluster: 2")); - + assertTrue(fsckOp.contains(" Blocks queued for replication:\t1")); try { DFSTestUtil.waitForReplication(cluster, b, 2, replicationFactor, 0); } catch (TimeoutException e) {