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 5533badfb25..a71b66a2f53 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 @@ -66,12 +66,11 @@ public class PutSortReducer extends for (List cells: p.getFamilyCellMap().values()) { for (Cell cell: cells) { KeyValue kv = KeyValueUtil.ensureKeyValueTypeForMR(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) + ")");