From 3e2889f3c7e61b7059ab15c0b46e7d79a2450527 Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Fri, 10 Feb 2012 02:05:38 +0000 Subject: [PATCH] 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 dc847b39fdee85b45ef26e8e7380d722ffb89e4e) Conflicts: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hdfs/server/blockmanagement/UnderReplicatedBlocks.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index ad4f90a0bd3..167a789c057 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -34,6 +34,9 @@ Release 2.7.0 - UNRELEASED HDFS-6877. Avoid calling checkDisk when an HDFS volume is removed during a write. (Lei Xu via Colin P. McCabe) + HDFS-2486. Remove unnecessary priority level checks in + UnderReplicatedBlocks. (Uma Maheswara Rao G via szetszwo) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java index 0920afcd997..8d20016ecc8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/UnderReplicatedBlocks.java @@ -190,7 +190,7 @@ class UnderReplicatedBlocks implements Iterable { assert curReplicas >= 0 : "Negative replicas!"; int priLevel = getPriority(block, curReplicas, decomissionedReplicas, expectedReplicas); - if(priLevel != LEVEL && priorityQueues.get(priLevel).add(block)) { + if(priorityQueues.get(priLevel).add(block)) { if(NameNode.blockStateChangeLog.isDebugEnabled()) { NameNode.blockStateChangeLog.debug( "BLOCK* NameSystem.UnderReplicationBlock.add:" @@ -293,10 +293,10 @@ class UnderReplicatedBlocks implements Iterable { " curPri " + curPri + " oldPri " + oldPri); } - if(oldPri != LEVEL && oldPri != curPri) { + if(oldPri != curPri) { remove(block, oldPri); } - if(curPri != LEVEL && priorityQueues.get(curPri).add(block)) { + if(priorityQueues.get(curPri).add(block)) { if(NameNode.blockStateChangeLog.isDebugEnabled()) { NameNode.blockStateChangeLog.debug( "BLOCK* NameSystem.UnderReplicationBlock.update:"