|
@@ -260,6 +260,14 @@ public class BlockManager {
|
|
|
* processed again after aquiring lock again.
|
|
|
*/
|
|
|
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 Replication queues initialisation.
|
|
|
*/
|
|
@@ -350,7 +358,10 @@ public class BlockManager {
|
|
|
this.numBlocksPerIteration = conf.getInt(
|
|
|
DFSConfigKeys.DFS_BLOCK_MISREPLICATION_PROCESSING_LIMIT,
|
|
|
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);
|
|
|
+
|
|
|
LOG.info("defaultReplication = " + defaultReplication);
|
|
|
LOG.info("maxReplication = " + maxReplication);
|
|
|
LOG.info("minReplication = " + minReplication);
|
|
@@ -1069,6 +1080,9 @@ public class BlockManager {
|
|
|
while(totalSize<size && iter.hasNext()) {
|
|
|
curBlock = iter.next();
|
|
|
if(!curBlock.isComplete()) continue;
|
|
|
+ if (curBlock.getNumBytes() < getBlocksMinBlockSize) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
totalSize += addBlock(curBlock, results);
|
|
|
}
|
|
|
if(totalSize<size) {
|
|
@@ -1076,6 +1090,9 @@ public class BlockManager {
|
|
|
for(int i=0; i<startBlock&&totalSize<size; i++) {
|
|
|
curBlock = iter.next();
|
|
|
if(!curBlock.isComplete()) continue;
|
|
|
+ if (curBlock.getNumBytes() < getBlocksMinBlockSize) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
totalSize += addBlock(curBlock, results);
|
|
|
}
|
|
|
}
|