From 61a4c7fc9891def0e85edf7e41d74c6b92c85fdb Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Thu, 19 Mar 2015 12:27:03 -0500 Subject: [PATCH] HDFS-7932. Speed up the shutdown of datanode during rolling upgrade. Contributed by Kihwal Lee. --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../org/apache/hadoop/hdfs/server/datanode/DataNode.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index ac58c399fcf..7392964f0bd 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -1216,6 +1216,8 @@ Release 2.7.0 - UNRELEASED HDFS-7816. Unable to open webhdfs paths with "+". (wheat9 via kihwal) + HDFS-7932. Speed up the shutdown of datanode during rolling upgrade.(kihwal) + BREAKDOWN OF HDFS-7584 SUBTASKS AND RELATED JIRAS HDFS-7720. Quota by Storage Type API, tools and ClientNameNode diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java index 5be6a6d6aa1..e9befb48290 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java @@ -1724,8 +1724,9 @@ public class DataNode extends ReconfigurableBase // termination of receiver threads. if (!this.shutdownForUpgrade || (this.shutdownForUpgrade && (Time.monotonicNow() - timeNotified - > 2500))) { + > 1000))) { this.threadGroup.interrupt(); + break; } LOG.info("Waiting for threadgroup to exit, active threads is " + this.threadGroup.activeCount()); @@ -1736,8 +1737,8 @@ public class DataNode extends ReconfigurableBase Thread.sleep(sleepMs); } catch (InterruptedException e) {} sleepMs = sleepMs * 3 / 2; // exponential backoff - if (sleepMs > 1000) { - sleepMs = 1000; + if (sleepMs > 200) { + sleepMs = 200; } } this.threadGroup = null;