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

This commit is contained in:
Kihwal Lee 2015-01-29 12:36:22 -06:00
parent 342efa110a
commit 89b07490f8
2 changed files with 8 additions and 0 deletions

View File

@ -561,6 +561,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

@ -2612,6 +2612,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();
@ -2668,6 +2671,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()) {