Repository: hadoop
Updated Branches:
  refs/heads/branch-2 1081b4c4a -> 3b030731a


HDFS-7603. The background replication queue initialization may not let others 
run. Contributed by Kihwal Lee.
(cherry picked from commit 89b07490f8354bb83a67b7ffc917bfe99708e615)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/3b030731
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/3b030731
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/3b030731

Branch: refs/heads/branch-2
Commit: 3b030731a066a06c8374327975771b60b7cfc6f0
Parents: 1081b4c
Author: Kihwal Lee <kih...@apache.org>
Authored: Thu Jan 29 12:37:34 2015 -0600
Committer: Kihwal Lee <kih...@apache.org>
Committed: Thu Jan 29 12:37:34 2015 -0600

----------------------------------------------------------------------
 hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt                     | 3 +++
 .../apache/hadoop/hdfs/server/blockmanagement/BlockManager.java | 5 +++++
 2 files changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/3b030731/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt 
b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
index 18b4fea..efe7b49 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
+++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
@@ -275,6 +275,9 @@ Release 2.7.0 - UNRELEASED
 
     HDFS-7675. Remove unused member DFSClient#spanReceiverHost (cmccabe)
 
+    HDFS-7603. The background replication queue initialization may not let
+    others run (kihwal)
+
   OPTIMIZATIONS
 
     HDFS-7454. Reduce memory footprint for AclEntries in NameNode.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/3b030731/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java
----------------------------------------------------------------------
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 4ac04ec..ec085d7 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
@@ -2615,6 +2615,9 @@ public class BlockManager {
     long totalBlocks = blocksMap.size();
     replicationQueuesInitProgress = 0;
     long totalProcessed = 0;
+    long sleepDuration =
+        Math.max(1, Math.min(numBlocksPerIteration/1000, 10000));
+
     while (namesystem.isRunning() && !Thread.currentThread().isInterrupted()) {
       int processed = 0;
       namesystem.writeLockInterruptibly();
@@ -2671,6 +2674,8 @@ public class BlockManager {
         }
       } finally {
         namesystem.writeUnlock();
+        // Make sure it is out of the write lock for sufficiently long time.
+        Thread.sleep(sleepDuration);
       }
     }
     if (Thread.currentThread().isInterrupted()) {

Reply via email to