HBASE-15171 Addendum removes extra loop (Yu Li)

This commit is contained in:
tedyu 2016-01-28 07:06:10 -08:00
parent 138b754671
commit 37ed0f6d08
1 changed files with 3 additions and 4 deletions

View File

@ -67,13 +67,12 @@ public class PutSortReducer extends
for (List<Cell> cells: p.getFamilyCellMap().values()) { for (List<Cell> cells: p.getFamilyCellMap().values()) {
for (Cell cell: cells) { for (Cell cell: cells) {
KeyValue kv = KeyValueUtil.ensureKeyValue(cell); KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
map.add(kv); if (map.add(kv)) {// don't count duplicated kv into size
}
}
for(KeyValue kv: map){
curSize += kv.heapSize(); curSize += kv.heapSize();
} }
} }
}
}
context.setStatus("Read " + map.size() + " entries of " + map.getClass() context.setStatus("Read " + map.size() + " entries of " + map.getClass()
+ "(" + StringUtils.humanReadableInt(curSize) + ")"); + "(" + StringUtils.humanReadableInt(curSize) + ")");
int index = 0; int index = 0;