You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2014/09/23 23:06:05 UTC
[2/3] git commit: Amend HBASE-12023 HRegion.applyFamilyMapToMemstore
creates too many iterator objects; More cases (Vladimir Rodionov)
Amend HBASE-12023 HRegion.applyFamilyMapToMemstore creates too many iterator objects; More cases (Vladimir Rodionov)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/c90383bf
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/c90383bf
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/c90383bf
Branch: refs/heads/branch-1
Commit: c90383bf86b1a49fac98cbd3baa3af1fa97be467
Parents: 3d898fe
Author: Andrew Purtell <ap...@apache.org>
Authored: Tue Sep 23 13:12:05 2014 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Tue Sep 23 13:50:18 2014 -0700
----------------------------------------------------------------------
.../hadoop/hbase/regionserver/HRegion.java | 27 +++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/c90383bf/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 0ab9c28..9383ecd 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2187,9 +2187,12 @@ public class HRegion implements HeapSize { // , Writable{
byte[] family = e.getKey();
List<Cell> cells = e.getValue();
- Map<byte[], Integer> kvCount = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ assert cells instanceof RandomAccess;
- for (Cell cell: cells) {
+ Map<byte[], Integer> kvCount = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR);
+ int listSize = cells.size();
+ for (int i=0; i < listSize; i++) {
+ Cell cell = cells.get(i);
KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
// Check if time is LATEST, change to time of most recent addition if so
// This is expensive.
@@ -3011,7 +3014,10 @@ public class HRegion implements HeapSize { // , Writable{
void updateKVTimestamps(final Iterable<List<Cell>> keyLists, final byte[] now) {
for (List<Cell> cells: keyLists) {
if (cells == null) continue;
- for (Cell cell : cells) {
+ assert cells instanceof RandomAccess;
+ int listSize = cells.size();
+ for (int i=0; i < listSize; i++) {
+ Cell cell = cells.get(i);
KeyValue kv = KeyValueUtil.ensureKeyValue(cell);
kv.updateLatestStamp(now);
}
@@ -3172,7 +3178,10 @@ public class HRegion implements HeapSize { // , Writable{
}
long maxTs = now + timestampSlop;
for (List<Cell> kvs : familyMap.values()) {
- for (Cell cell : kvs) {
+ assert kvs instanceof RandomAccess;
+ int listSize = kvs.size();
+ for (int i=0; i < listSize; i++) {
+ Cell cell = kvs.get(i);
// see if the user-side TS is out of range. latest = server-side
long ts = cell.getTimestamp();
if (ts != HConstants.LATEST_TIMESTAMP && ts > maxTs) {
@@ -3192,7 +3201,10 @@ public class HRegion implements HeapSize { // , Writable{
private void addFamilyMapToWALEdit(Map<byte[], List<Cell>> familyMap,
WALEdit walEdit) {
for (List<Cell> edits : familyMap.values()) {
- for (Cell cell : edits) {
+ assert edits instanceof RandomAccess;
+ int listSize = edits.size();
+ for (int i=0; i < listSize; i++) {
+ Cell cell = edits.get(i);
walEdit.add(cell);
}
}
@@ -6067,7 +6079,10 @@ public class HRegion implements HeapSize { // , Writable{
long mutationSize = 0;
for (List<Cell> cells: familyMap.values()) {
- for (Cell cell : cells) {
+ assert cells instanceof RandomAccess;
+ int listSize = cells.size();
+ for (int i=0; i < listSize; i++) {
+ Cell cell = cells.get(i);
// TODO we need include tags length also here.
mutationSize += KeyValueUtil.keyLength(cell) + cell.getValueLength();
}