From 930e344d7885cc392eb3ee01e59b748f175fff21 Mon Sep 17 00:00:00 2001 From: yliu Date: Wed, 22 Jul 2015 15:15:08 +0800 Subject: [PATCH] HDFS-8795. Improve InvalidateBlocks#node2blocks. (yliu) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 2 ++ .../hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index ea7bdc4071e..1383ea99dab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -397,6 +397,8 @@ Release 2.8.0 - UNRELEASED HDFS-8495. Consolidate append() related implementation into a single class. (Rakesh R via wheat9) + HDFS-8795. Improve InvalidateBlocks#node2blocks. (yliu) + OPTIMIZATIONS HDFS-8026. Trace FSOutputSummer#writeChecksumChunks rather than diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java index e357528ed99..c60266edbab 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/InvalidateBlocks.java @@ -22,9 +22,9 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.GregorianCalendar; +import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.TreeMap; import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.hdfs.DFSConfigKeys; @@ -36,6 +36,7 @@ import org.apache.hadoop.util.Time; import org.apache.hadoop.hdfs.DFSUtil; import com.google.common.annotations.VisibleForTesting; + import org.slf4j.Logger; /** @@ -47,7 +48,7 @@ import org.slf4j.Logger; class InvalidateBlocks { /** Mapping: DatanodeInfo -> Collection of Blocks */ private final Map> node2blocks = - new TreeMap>(); + new HashMap>(); /** The total number of blocks in the map. */ private long numBlocks = 0L;