hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ramkris...@apache.org
Subject [1/2] hbase git commit: Revert "HBASE-14227 Reduce the number of time row comparison is done in a Scan"
Date Fri, 08 Jan 2016 08:33:06 GMT
Repository: hbase
Updated Branches:
  refs/heads/branch-1.0 13bbd7226 -> cccf8e6a4


Revert "HBASE-14227 Reduce the number of time row comparison is done in a Scan"

This reverts commit 13bbd722650affcea9e9f876c078c0da7a3aba99.


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

Branch: refs/heads/branch-1.0
Commit: 5d854d3802cd1bcf50fea3c2a187d75d51567308
Parents: 13bbd72
Author: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Authored: Fri Jan 8 14:00:32 2016 +0530
Committer: ramkrishna <ramkrishna.s.vasudevan@gmail.com>
Committed: Fri Jan 8 14:00:32 2016 +0530

----------------------------------------------------------------------
 .../hbase/regionserver/ScanQueryMatcher.java    | 32 +++++++++-----------
 .../hadoop/hbase/regionserver/StoreScanner.java | 20 ++----------
 2 files changed, 17 insertions(+), 35 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/5d854d38/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
index 901dbad..032b4ce 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
@@ -278,27 +278,23 @@ public class ScanQueryMatcher {
     if (filter != null && filter.filterAllRemaining()) {
       return MatchCode.DONE_SCAN;
     }
-    if (row != null) {
-      int ret = this.rowComparator.compareRows(row, this.rowOffset, this.rowLength,
+    int ret = this.rowComparator.compareRows(row, this.rowOffset, this.rowLength,
         cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
-      if (!this.isReversed) {
-        if (ret <= -1) {
-          return MatchCode.DONE;
-        } else if (ret >= 1) {
-          // could optimize this, if necessary?
-          // Could also be called SEEK_TO_CURRENT_ROW, but this
-          // should be rare/never happens.
-          return MatchCode.SEEK_NEXT_ROW;
-        }
-      } else {
-        if (ret <= -1) {
-          return MatchCode.SEEK_NEXT_ROW;
-        } else if (ret >= 1) {
-          return MatchCode.DONE;
-        }
+    if (!this.isReversed) {
+      if (ret <= -1) {
+        return MatchCode.DONE;
+      } else if (ret >= 1) {
+        // could optimize this, if necessary?
+        // Could also be called SEEK_TO_CURRENT_ROW, but this
+        // should be rare/never happens.
+        return MatchCode.SEEK_NEXT_ROW;
       }
     } else {
-      return MatchCode.DONE;
+      if (ret <= -1) {
+        return MatchCode.SEEK_NEXT_ROW;
+      } else if (ret >= 1) {
+        return MatchCode.DONE;
+      }
     }
 
     // optimize case.

http://git-wip-us.apache.org/repos/asf/hbase/blob/5d854d38/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 b983b12..94e94d8 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
@@ -474,7 +474,8 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
     byte[] row = cell.getRowArray();
     int offset = cell.getRowOffset();
     short length = cell.getRowLength();
-    if (limit < 0 || matcher.row == null) {
+    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);
     }
@@ -511,10 +512,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
             if (!matcher.moreRowsMayExistAfter(cell)) {
               return false;
             }
-            // Setting the matcher.row = null, will mean that after the subsequent seekToNextRow()
-            // the heap.peek() will any way be in the next row. So the SQM.match(cell) need
do
-            // another compareRow to say the current row is DONE
-            matcher.row = null;
             seekToNextRow(cell);
             break LOOP;
           }
@@ -535,10 +532,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
             if (!matcher.moreRowsMayExistAfter(cell)) {
               return false;
             }
-            // Setting the matcher.row = null, will mean that after the subsequent seekToNextRow()
-            // the heap.peek() will any way be in the next row. So the SQM.match(cell) need
do
-            // another compareRow to say the current row is DONE
-            matcher.row = null;
             seekToNextRow(cell);
           } else if (qcode == ScanQueryMatcher.MatchCode.INCLUDE_AND_SEEK_NEXT_COL) {
             seekAsDirection(matcher.getKeyForNextColumn(cell));
@@ -552,10 +545,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
           continue;
 
         case DONE:
-          // We are sure that this row is done and we are in the next row.
-          // So subsequent StoresScanner.next() call need not do another compare
-          // and set the matcher.row
-          matcher.row = null;
           return true;
 
         case DONE_SCAN:
@@ -568,10 +557,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
           if (!matcher.moreRowsMayExistAfter(cell)) {
             return false;
           }
-          // Setting the matcher.row = null, will mean that after the subsequent seekToNextRow()
-          // the heap.peek() will any way be in the next row. So the SQM.match(cell) need
do
-          // another compareRow to say the current row is DONE
-          matcher.row = null;
+
           seekToNextRow(cell);
           break;
 


Mime
View raw message