|
@@ -305,6 +305,14 @@ public class BlockManager implements BlockStatsMXBean {
|
|
* processed again after aquiring lock again.
|
|
* processed again after aquiring lock again.
|
|
*/
|
|
*/
|
|
private int numBlocksPerIteration;
|
|
private int numBlocksPerIteration;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Minimum size that a block can be sent to Balancer through getBlocks.
|
|
|
|
+ * And after HDFS-8824, the small blocks are unused anyway, so there's no
|
|
|
|
+ * point to send them to balancer.
|
|
|
|
+ */
|
|
|
|
+ private long getBlocksMinBlockSize = -1;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Progress of the Reconstruction queues initialisation.
|
|
* Progress of the Reconstruction queues initialisation.
|
|
*/
|
|
*/
|
|
@@ -414,6 +422,9 @@ public class BlockManager implements BlockStatsMXBean {
|
|
this.numBlocksPerIteration = conf.getInt(
|
|
this.numBlocksPerIteration = conf.getInt(
|
|
DFSConfigKeys.DFS_BLOCK_MISREPLICATION_PROCESSING_LIMIT,
|
|
DFSConfigKeys.DFS_BLOCK_MISREPLICATION_PROCESSING_LIMIT,
|
|
DFSConfigKeys.DFS_BLOCK_MISREPLICATION_PROCESSING_LIMIT_DEFAULT);
|
|
DFSConfigKeys.DFS_BLOCK_MISREPLICATION_PROCESSING_LIMIT_DEFAULT);
|
|
|
|
+ this.getBlocksMinBlockSize = conf.getLongBytes(
|
|
|
|
+ DFSConfigKeys.DFS_BALANCER_GETBLOCKS_MIN_BLOCK_SIZE_KEY,
|
|
|
|
+ DFSConfigKeys.DFS_BALANCER_GETBLOCKS_MIN_BLOCK_SIZE_DEFAULT);
|
|
this.blockReportLeaseManager = new BlockReportLeaseManager(conf);
|
|
this.blockReportLeaseManager = new BlockReportLeaseManager(conf);
|
|
|
|
|
|
bmSafeMode = new BlockManagerSafeMode(this, namesystem, haEnabled, conf);
|
|
bmSafeMode = new BlockManagerSafeMode(this, namesystem, haEnabled, conf);
|
|
@@ -1179,6 +1190,9 @@ public class BlockManager implements BlockStatsMXBean {
|
|
while(totalSize<size && iter.hasNext()) {
|
|
while(totalSize<size && iter.hasNext()) {
|
|
curBlock = iter.next();
|
|
curBlock = iter.next();
|
|
if(!curBlock.isComplete()) continue;
|
|
if(!curBlock.isComplete()) continue;
|
|
|
|
+ if (curBlock.getNumBytes() < getBlocksMinBlockSize) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
totalSize += addBlock(curBlock, results);
|
|
totalSize += addBlock(curBlock, results);
|
|
}
|
|
}
|
|
if(totalSize<size) {
|
|
if(totalSize<size) {
|
|
@@ -1186,6 +1200,9 @@ public class BlockManager implements BlockStatsMXBean {
|
|
for(int i=0; i<startBlock&&totalSize<size; i++) {
|
|
for(int i=0; i<startBlock&&totalSize<size; i++) {
|
|
curBlock = iter.next();
|
|
curBlock = iter.next();
|
|
if(!curBlock.isComplete()) continue;
|
|
if(!curBlock.isComplete()) continue;
|
|
|
|
+ if (curBlock.getNumBytes() < getBlocksMinBlockSize) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
totalSize += addBlock(curBlock, results);
|
|
totalSize += addBlock(curBlock, results);
|
|
}
|
|
}
|
|
}
|
|
}
|