From c15959fa60160cb8da391d6839b897e4fad0e7ba Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Wed, 3 Aug 2016 12:18:15 -0500 Subject: [PATCH] HDFS-742. A down DataNode makes Balancer to hang on repeatingly asking NameNode its partial block list. Contributed by Mit Desai. (cherry picked from commit 58db263e93daf08280e6a586a10cebd6122cf72a) --- .../hadoop/hdfs/server/balancer/Dispatcher.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java index 151ab09a304..8f81c19236c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/balancer/Dispatcher.java @@ -788,6 +788,13 @@ public class Dispatcher { + ", scheduledSize=" + getScheduledSize() + ", srcBlocks#=" + srcBlocks.size()); } + // check if time is up or not + if (Time.monotonicNow() - startTime > MAX_ITERATION_TIME) { + LOG.info("Time up (max time=" + MAX_ITERATION_TIME/1000 + + " seconds). Skipping " + this); + isTimeUp = true; + continue; + } final PendingMove p = chooseNextMove(); if (p != null) { // Reset no pending move counter @@ -825,14 +832,6 @@ public class Dispatcher { } } - // check if time is up or not - if (Time.monotonicNow() - startTime > MAX_ITERATION_TIME) { - LOG.info("Time up (max time=" + MAX_ITERATION_TIME/1000 - + " seconds). Skipping " + this); - isTimeUp = true; - continue; - } - // Now we can not schedule any block to move and there are // no new blocks added to the source block list, so we wait. try {