hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [04/13] hbase git commit: HBASE-15171 Addendum removes extra loop (Yu Li)
Date Fri, 29 Jan 2016 17:13:57 GMT
HBASE-15171 Addendum removes extra loop (Yu Li)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/37ed0f6d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/37ed0f6d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/37ed0f6d

Branch: refs/heads/hbase-12439
Commit: 37ed0f6d0815389e0b368bc98b3a01dd02f193ac
Parents: 138b754
Author: tedyu <yuzhihong@gmail.com>
Authored: Thu Jan 28 07:06:10 2016 -0800
Committer: tedyu <yuzhihong@gmail.com>
Committed: Thu Jan 28 07:06:10 2016 -0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/mapreduce/PutSortReducer.java     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/37ed0f6d/hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/PutSortReducer.java
----------------------------------------------------------------------
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 d18ea34..b302d58 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<Cell> 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) + ")");


Mime
View raw message