HDFS-2486. Remove unnecessary priority level checks in UnderReplicatedBlocks. Contributed by Uma Maheswara Rao G

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1242636 13f79535-47bb-0310-9956-ffa450edef68
(cherry picked from commit dc847b39fd)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java
This commit is contained in:
Tsz-wo Sze 2012-02-10 02:05:38 +00:00 committed by Andrew Wang
parent b3bb4fdc7c
commit 3e2889f3c7
2 changed files with 6 additions and 3 deletions

View File

@ -34,6 +34,9 @@ Release 2.7.0 - UNRELEASED
HDFS-6877. Avoid calling checkDisk when an HDFS volume is removed during a HDFS-6877. Avoid calling checkDisk when an HDFS volume is removed during a
write. (Lei Xu via Colin P. McCabe) write. (Lei Xu via Colin P. McCabe)
HDFS-2486. Remove unnecessary priority level checks in
UnderReplicatedBlocks. (Uma Maheswara Rao G via szetszwo)
OPTIMIZATIONS OPTIMIZATIONS
BUG FIXES BUG FIXES

View File

@ -190,7 +190,7 @@ class UnderReplicatedBlocks implements Iterable<Block> {
assert curReplicas >= 0 : "Negative replicas!"; assert curReplicas >= 0 : "Negative replicas!";
int priLevel = getPriority(block, curReplicas, decomissionedReplicas, int priLevel = getPriority(block, curReplicas, decomissionedReplicas,
expectedReplicas); expectedReplicas);
if(priLevel != LEVEL && priorityQueues.get(priLevel).add(block)) { if(priorityQueues.get(priLevel).add(block)) {
if(NameNode.blockStateChangeLog.isDebugEnabled()) { if(NameNode.blockStateChangeLog.isDebugEnabled()) {
NameNode.blockStateChangeLog.debug( NameNode.blockStateChangeLog.debug(
"BLOCK* NameSystem.UnderReplicationBlock.add:" "BLOCK* NameSystem.UnderReplicationBlock.add:"
@ -293,10 +293,10 @@ class UnderReplicatedBlocks implements Iterable<Block> {
" curPri " + curPri + " curPri " + curPri +
" oldPri " + oldPri); " oldPri " + oldPri);
} }
if(oldPri != LEVEL && oldPri != curPri) { if(oldPri != curPri) {
remove(block, oldPri); remove(block, oldPri);
} }
if(curPri != LEVEL && priorityQueues.get(curPri).add(block)) { if(priorityQueues.get(curPri).add(block)) {
if(NameNode.blockStateChangeLog.isDebugEnabled()) { if(NameNode.blockStateChangeLog.isDebugEnabled()) {
NameNode.blockStateChangeLog.debug( NameNode.blockStateChangeLog.debug(
"BLOCK* NameSystem.UnderReplicationBlock.update:" "BLOCK* NameSystem.UnderReplicationBlock.update:"