|
@@ -2612,6 +2612,9 @@ public class BlockManager {
|
|
long totalBlocks = blocksMap.size();
|
|
long totalBlocks = blocksMap.size();
|
|
replicationQueuesInitProgress = 0;
|
|
replicationQueuesInitProgress = 0;
|
|
long totalProcessed = 0;
|
|
long totalProcessed = 0;
|
|
|
|
+ long sleepDuration =
|
|
|
|
+ Math.max(1, Math.min(numBlocksPerIteration/1000, 10000));
|
|
|
|
+
|
|
while (namesystem.isRunning() && !Thread.currentThread().isInterrupted()) {
|
|
while (namesystem.isRunning() && !Thread.currentThread().isInterrupted()) {
|
|
int processed = 0;
|
|
int processed = 0;
|
|
namesystem.writeLockInterruptibly();
|
|
namesystem.writeLockInterruptibly();
|
|
@@ -2668,6 +2671,8 @@ public class BlockManager {
|
|
}
|
|
}
|
|
} finally {
|
|
} finally {
|
|
namesystem.writeUnlock();
|
|
namesystem.writeUnlock();
|
|
|
|
+ // Make sure it is out of the write lock for sufficiently long time.
|
|
|
|
+ Thread.sleep(sleepDuration);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (Thread.currentThread().isInterrupted()) {
|
|
if (Thread.currentThread().isInterrupted()) {
|