You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ra...@apache.org on 2016/01/08 09:29:43 UTC
[1/2] hbase git commit: Revert "HBASE-14227 Reduce the number of time
row comparison is done in a Scan"
Repository: hbase
Updated Branches:
refs/heads/branch-1 e32e4df78 -> bc4b9eb08
Revert "HBASE-14227 Reduce the number of time row comparison is done in a Scan"
This reverts commit e32e4df780bf1935d8421d70af2f3d84ae88f590.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/323d5c97
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/323d5c97
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/323d5c97
Branch: refs/heads/branch-1
Commit: 323d5c97d92fe8bce3c2bf8e38e68e5fef5ceba6
Parents: e32e4df
Author: ramkrishna <ra...@gmail.com>
Authored: Fri Jan 8 13:55:06 2016 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Fri Jan 8 13:55:06 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/323d5c97/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 c832255..9c91017 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
@@ -283,27 +283,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/323d5c97/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 f1735eb..d5c65a5 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
@@ -491,7 +491,8 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
// If no limits exists in the scope LimitScope.Between_Cells then we are sure we are changing
// rows. Else it is possible we are still traversing the same row so we must perform the row
// comparison.
- if (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.row == null) {
+ if (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.row == null ||
+ !Bytes.equals(row, offset, length, matcher.row, matcher.rowOffset, matcher.rowLength)) {
this.countPerRow = 0;
matcher.setRow(row, offset, length);
}
@@ -539,10 +540,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
- // 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;
}
@@ -570,10 +567,6 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
- // 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));
@@ -590,10 +583,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 scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
case DONE_SCAN:
@@ -606,10 +595,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
- // 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;
[2/2] hbase git commit: HBASE-14221 - Reduce the number of time row
comparison is done in a Scan (Ram)
Posted by ra...@apache.org.
HBASE-14221 - Reduce the number of time row comparison is done in a Scan
(Ram)
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/bc4b9eb0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/bc4b9eb0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/bc4b9eb0
Branch: refs/heads/branch-1
Commit: bc4b9eb0842bac32dd0f562e3401d5487c45b9da
Parents: 323d5c9
Author: ramkrishna <ra...@gmail.com>
Authored: Fri Jan 8 13:58:52 2016 +0530
Committer: ramkrishna <ra...@gmail.com>
Committed: Fri Jan 8 13:58:52 2016 +0530
----------------------------------------------------------------------
.../hbase/regionserver/ScanQueryMatcher.java | 32 +++++++++++---------
.../hadoop/hbase/regionserver/StoreScanner.java | 20 ++++++++++--
2 files changed, 35 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/bc4b9eb0/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 9c91017..c832255 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
@@ -283,23 +283,27 @@ public class ScanQueryMatcher {
if (filter != null && filter.filterAllRemaining()) {
return MatchCode.DONE_SCAN;
}
- int ret = this.rowComparator.compareRows(row, this.rowOffset, this.rowLength,
+ if (row != null) {
+ 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;
+ 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;
+ }
}
} else {
- if (ret <= -1) {
- return MatchCode.SEEK_NEXT_ROW;
- } else if (ret >= 1) {
- return MatchCode.DONE;
- }
+ return MatchCode.DONE;
}
// optimize case.
http://git-wip-us.apache.org/repos/asf/hbase/blob/bc4b9eb0/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 d5c65a5..f1735eb 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
@@ -491,8 +491,7 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
// If no limits exists in the scope LimitScope.Between_Cells then we are sure we are changing
// rows. Else it is possible we are still traversing the same row so we must perform the row
// comparison.
- if (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.row == null ||
- !Bytes.equals(row, offset, length, matcher.row, matcher.rowOffset, matcher.rowLength)) {
+ if (!scannerContext.hasAnyLimit(LimitScope.BETWEEN_CELLS) || matcher.row == null) {
this.countPerRow = 0;
matcher.setRow(row, offset, length);
}
@@ -540,6 +539,10 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
+ // 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;
}
@@ -567,6 +570,10 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
+ // 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));
@@ -583,6 +590,10 @@ 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 scannerContext.setScannerState(NextState.MORE_VALUES).hasMoreValues();
case DONE_SCAN:
@@ -595,7 +606,10 @@ public class StoreScanner extends NonReversedNonLazyKeyValueScanner
if (!matcher.moreRowsMayExistAfter(cell)) {
return scannerContext.setScannerState(NextState.NO_MORE_VALUES).hasMoreValues();
}
-
+ // 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;