You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2015/08/29 00:25:08 UTC

[5/5] hbase git commit: HBASE-14315 Save one call to KeyValueHeap.peek per row.

HBASE-14315 Save one call to KeyValueHeap.peek per row.


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

Branch: refs/heads/branch-1.0
Commit: 89b106231f6f10a13a2fbc317c5770a3841db7ab
Parents: 60402b5
Author: Lars Hofhansl <la...@apache.org>
Authored: Fri Aug 28 15:05:41 2015 -0700
Committer: Lars Hofhansl <la...@apache.org>
Committed: Fri Aug 28 15:24:49 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/StoreScanner.java     | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/89b10623/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
index 4ba7235..24f2f54 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreScanner.java
@@ -463,25 +463,23 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
       return false;
     }
 
-    Cell peeked = this.heap.peek();
-    if (peeked == null) {
+    Cell cell = this.heap.peek();
+    if (cell == null) {
       close();
       return false;
     }
 
     // only call setRow if the row changes; avoids confusing the query matcher
     // if scanning intra-row
-    byte[] row = peeked.getRowArray();
-    int offset = peeked.getRowOffset();
-    short length = peeked.getRowLength();
+    byte[] row = cell.getRowArray();
+    int offset = cell.getRowOffset();
+    short length = cell.getRowLength();
     if (limit < 0 || matcher.row == null || !Bytes.equals(row, offset, length, matcher.row,
         matcher.rowOffset, matcher.rowLength)) {
       this.countPerRow = 0;
       matcher.setRow(row, offset, length);
     }
 
-    Cell cell;
-
     // Only do a sanity-check if store and comparator are available.
     KeyValue.KVComparator comparator =
         store != null ? store.getComparator() : null;
@@ -489,7 +487,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
     int count = 0;
     long totalBytesRead = 0;
 
-    LOOP: while((cell = this.heap.peek()) != null) {
+    LOOP: do {
       if (prevCell != cell) ++kvsScanned; // Do object compare - we set prevKV from the same heap.
       checkScanOrder(prevCell, cell, comparator);
       prevCell = cell;
@@ -584,7 +582,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
         default:
           throw new RuntimeException("UNEXPECTED");
       }
-    }
+    } while((cell = this.heap.peek()) != null);
 
     if (count > 0) {
       return true;