HDFS-7603. The background replication queue initialization may not let others run. Contributed by Kihwal Lee.

(cherry picked from commit 89b07490f8)
This commit is contained in:
Kihwal Lee 2015-01-29 12:37:34 -06:00
parent 1081b4c4a7
commit 3b030731a0
2 changed files with 8 additions and 0 deletions

View File

@ -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.

View File

@ -2615,6 +2615,9 @@ private void processMisReplicatesAsync() throws InterruptedException {
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 @@ private void processMisReplicatesAsync() throws InterruptedException {
}
} finally {
namesystem.writeUnlock();
// Make sure it is out of the write lock for sufficiently long time.
Thread.sleep(sleepDuration);
}
}
if (Thread.currentThread().isInterrupted()) {