From 37ed0f6d0815389e0b368bc98b3a01dd02f193ac Mon Sep 17 00:00:00 2001 From: tedyu Date: Thu, 28 Jan 2016 07:06:10 -0800 Subject: [PATCH] HBASE-15171 Addendum removes extra loop (Yu Li) --- .../org/apache/hadoop/hbase/mapreduce/PutSortReducer.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/PutSortReducer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/PutSortReducer.java index d18ea34c3e1..b302d586417 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/PutSortReducer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/PutSortReducer.java @@ -67,12 +67,11 @@ public class PutSortReducer extends for (List cells: p.getFamilyCellMap().values()) { for (Cell cell: cells) { KeyValue kv = KeyValueUtil.ensureKeyValue(cell); - map.add(kv); + if (map.add(kv)) {// don't count duplicated kv into size + curSize += kv.heapSize(); + } } } - for(KeyValue kv: map){ - curSize +=kv.heapSize(); - } } context.setStatus("Read " + map.size() + " entries of " + map.getClass() + "(" + StringUtils.humanReadableInt(curSize) + ")");