From 58db263e93daf08280e6a586a10cebd6122cf72a Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Wed, 3 Aug 2016 12:14:59 -0500 Subject: [PATCH] HDFS-742. A down DataNode makes Balancer to hang on repeatingly asking NameNode its partial block list. Contributed by Mit Desai. --- .../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 9f9cdc0334..16e42e07de 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 @@ -849,6 +849,13 @@ private void dispatchBlocks() { + ", 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 @@ -886,14 +893,6 @@ private void dispatchBlocks() { } } - // 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 {