HDFS-6511. BlockManager#computeInvalidateWork() could do nothing. Contributed by Juan Yu.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1607736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Wang 2014-07-03 20:11:18 +00:00
parent 3470a34c22
commit e6e5417134
2 changed files with 10 additions and 2 deletions

View File

@ -10,6 +10,8 @@ Release 2.6.0 - UNRELEASED
HDFS-6613. Improve logging in caching classes. (wang) HDFS-6613. Improve logging in caching classes. (wang)
HDFS-6511. BlockManager#computeInvalidateWork() could do nothing. (Juan Yu via wang)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -1226,8 +1226,14 @@ public class BlockManager {
nodesToProcess = Math.min(nodes.size(), nodesToProcess); nodesToProcess = Math.min(nodes.size(), nodesToProcess);
int blockCnt = 0; int blockCnt = 0;
for(int nodeCnt = 0; nodeCnt < nodesToProcess; nodeCnt++ ) { for (DatanodeInfo dnInfo : nodes) {
blockCnt += invalidateWorkForOneNode(nodes.get(nodeCnt)); int blocks = invalidateWorkForOneNode(dnInfo);
if (blocks > 0) {
blockCnt += blocks;
if (--nodesToProcess == 0) {
break;
}
}
} }
return blockCnt; return blockCnt;
} }