|
@@ -300,6 +300,16 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
*/
|
|
|
private final long redundancyRecheckIntervalMs;
|
|
|
|
|
|
+ /**
|
|
|
+ * Tracks how many calls have been made to chooseLowReduncancyBlocks since
|
|
|
+ * the queue position was last reset to the queue head. If CallsSinceReset
|
|
|
+ * crosses the threshold the next call will reset the iterators. A threshold
|
|
|
+ * of zero means the queue position will only be reset once the next of the
|
|
|
+ * queue has been reached.
|
|
|
+ */
|
|
|
+ private int replQueueResetToHeadThreshold;
|
|
|
+ private int replQueueCallsSinceReset = 0;
|
|
|
+
|
|
|
/** How often to check and the limit for the storageinfo efficiency. */
|
|
|
private final long storageInfoDefragmentInterval;
|
|
|
private final long storageInfoDefragmentTimeout;
|
|
@@ -572,6 +582,18 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
}
|
|
|
this.minReplicationToBeInMaintenance = (short)minMaintenanceR;
|
|
|
|
|
|
+ replQueueResetToHeadThreshold = conf.getInt(
|
|
|
+ DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_QUEUE_RESTART_ITERATIONS,
|
|
|
+ DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_QUEUE_RESTART_ITERATIONS_DEFAULT);
|
|
|
+ if (replQueueResetToHeadThreshold < 0) {
|
|
|
+ LOG.warn("{} is set to {} and it must be >= 0. Resetting to default {}",
|
|
|
+ DFSConfigKeys.DFS_NAMENODE_REDUNDANCY_QUEUE_RESTART_ITERATIONS,
|
|
|
+ replQueueResetToHeadThreshold, DFSConfigKeys.
|
|
|
+ DFS_NAMENODE_REDUNDANCY_QUEUE_RESTART_ITERATIONS_DEFAULT);
|
|
|
+ replQueueResetToHeadThreshold = DFSConfigKeys.
|
|
|
+ DFS_NAMENODE_REDUNDANCY_QUEUE_RESTART_ITERATIONS_DEFAULT;
|
|
|
+ }
|
|
|
+
|
|
|
long heartbeatIntervalSecs = conf.getTimeDuration(
|
|
|
DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY,
|
|
|
DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_DEFAULT, TimeUnit.SECONDS);
|
|
@@ -1912,9 +1934,18 @@ public class BlockManager implements BlockStatsMXBean {
|
|
|
List<List<BlockInfo>> blocksToReconstruct = null;
|
|
|
namesystem.writeLock();
|
|
|
try {
|
|
|
- // Choose the blocks to be reconstructed
|
|
|
+ boolean reset = false;
|
|
|
+ if (replQueueResetToHeadThreshold > 0) {
|
|
|
+ if (replQueueCallsSinceReset >= replQueueResetToHeadThreshold) {
|
|
|
+ reset = true;
|
|
|
+ replQueueCallsSinceReset = 0;
|
|
|
+ } else {
|
|
|
+ replQueueCallsSinceReset++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // Choose the blocks to be reconstructed
|
|
|
blocksToReconstruct = neededReconstruction
|
|
|
- .chooseLowRedundancyBlocks(blocksToProcess);
|
|
|
+ .chooseLowRedundancyBlocks(blocksToProcess, reset);
|
|
|
} finally {
|
|
|
namesystem.writeUnlock();
|
|
|
}
|