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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1607735 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew Wang 2014-07-03 20:10:54 +00:00
parent f881f0e923
commit 151c5deaf1
2 changed files with 10 additions and 2 deletions

View File

@ -264,6 +264,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 @@ int computeInvalidateWork(int nodesToProcess) {
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;
} }