phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [1/2] git commit: PHOENIX-1313 Investigate why LocalIndexIT.testLocalIndexScanAfterRegionSplit() is failing(Rajeshbabu)
Date Sat, 11 Oct 2014 16:27:13 GMT
Repository: phoenix
Updated Branches:
  refs/heads/4.0 7e3a866ac -> ab8b17d79


PHOENIX-1313 Investigate why LocalIndexIT.testLocalIndexScanAfterRegionSplit() is failing(Rajeshbabu)


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

Branch: refs/heads/4.0
Commit: ae02d1cec5e1a41f8845937dcbac43bd81698f57
Parents: 7e3a866
Author: James Taylor <jtaylor@salesforce.com>
Authored: Sat Oct 11 09:13:54 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Sat Oct 11 09:13:54 2014 -0700

----------------------------------------------------------------------
 .../phoenix/iterate/ParallelIterators.java      | 33 +++++++++++++-------
 .../apache/phoenix/jdbc/PhoenixResultSet.java   |  4 +--
 2 files changed, 23 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae02d1ce/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
index f003a39..fc13df5 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/iterate/ParallelIterators.java
@@ -44,6 +44,7 @@ import org.apache.phoenix.compile.QueryPlan;
 import org.apache.phoenix.compile.RowProjector;
 import org.apache.phoenix.compile.ScanRanges;
 import org.apache.phoenix.compile.StatementContext;
+import org.apache.phoenix.coprocessor.BaseScannerRegionObserver;
 import org.apache.phoenix.filter.ColumnProjectionFilter;
 import org.apache.phoenix.hbase.index.util.ImmutableBytesPtr;
 import org.apache.phoenix.job.JobManager.JobCallable;
@@ -359,10 +360,7 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
         return buf.toString();
     }
     
-    private List<Scan> addNewScan(List<List<Scan>> parallelScans, List<Scan>
scans, Scan scan, boolean crossedRegionBoundary) {
-        if (scan == null) {
-            return scans;
-        }
+    private List<Scan> addNewScan(List<List<Scan>> parallelScans, List<Scan>
scans, Scan scan, byte[] startKey, boolean crossedRegionBoundary) {
         PTable table = getTable();
         boolean startNewScanList = false;
         if (!plan.isRowKeyOrdered()) {
@@ -372,13 +370,15 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
                 startNewScanList = true;
             } else if (table.getBucketNum() != null) {
                 startNewScanList = scans.isEmpty() ||
-                        ScanUtil.crossesPrefixBoundary(scan.getStartRow(),
+                        ScanUtil.crossesPrefixBoundary(startKey,
                                 ScanUtil.getPrefix(scans.get(scans.size()-1).getStartRow(),
SaltingUtil.NUM_SALTING_BYTES), 
                                 SaltingUtil.NUM_SALTING_BYTES);
             }
         }
-        scans.add(scan);
-        if (startNewScanList) {
+        if (scan != null) {
+            scans.add(scan);
+        }
+        if (startNewScanList && !scans.isEmpty()) {
             parallelScans.add(scans);
             scans = Lists.newArrayListWithExpectedSize(1);
         }
@@ -430,8 +430,13 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
         List<Scan> scans = Lists.newArrayListWithExpectedSize(estGuidepostsPerRegion);
         // Merge bisect with guideposts for all but the last region
         while (regionIndex <= stopIndex) {
-            byte[] currentGuidePost;
-            byte[] endKey = regionIndex == stopIndex ? stopKey : regionBoundaries.get(regionIndex);
+            byte[] currentGuidePost, endRegionKey, endKey;
+            if (regionIndex == stopIndex) {
+                endKey = stopKey;
+                endRegionKey = ByteUtil.EMPTY_BYTE_ARRAY;
+            } else {
+                endKey = endRegionKey = regionBoundaries.get(regionIndex);
+            }
             if (isLocalIndex) {
                 HRegionInfo regionInfo = regionLocations.get(regionIndex).getRegionInfo();
                 keyOffset = ScanUtil.getRowKeyOffset(regionInfo.getStartKey(), regionInfo.getEndKey());
@@ -439,12 +444,18 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
             while (guideIndex < gpsSize
                     && (Bytes.compareTo(currentGuidePost = gps.get(guideIndex), endKey)
<= 0 || endKey.length == 0)) {
                 Scan newScan = scanRanges.intersectScan(scan, currentKey, currentGuidePost,
keyOffset, false);
-                scans = addNewScan(parallelScans, scans, newScan, false);
+                if (isLocalIndex && newScan != null) {
+                    newScan.setAttribute(BaseScannerRegionObserver.EXPECTED_UPPER_REGION_KEY,
endRegionKey);
+                }
+                scans = addNewScan(parallelScans, scans, newScan, currentGuidePost, false);
                 currentKey = currentGuidePost;
                 guideIndex++;
             }
             Scan newScan = scanRanges.intersectScan(scan, currentKey, endKey, keyOffset,
true);
-            scans = addNewScan(parallelScans, scans, newScan, true);
+            if (isLocalIndex && newScan != null) {
+                newScan.setAttribute(BaseScannerRegionObserver.EXPECTED_UPPER_REGION_KEY,
endRegionKey);
+            }
+            scans = addNewScan(parallelScans, scans, newScan, endKey, true);
             currentKey = endKey;
             regionIndex++;
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/ae02d1ce/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
index 27c12d6..3f280ca 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixResultSet.java
@@ -35,7 +35,6 @@ import java.sql.SQLException;
 import java.sql.SQLFeatureNotSupportedException;
 import java.sql.SQLWarning;
 import java.sql.SQLXML;
-import java.sql.Statement;
 import java.sql.Time;
 import java.sql.Timestamp;
 import java.text.Format;
@@ -43,7 +42,6 @@ import java.util.Calendar;
 import java.util.Map;
 
 import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-
 import org.apache.phoenix.compile.ColumnProjector;
 import org.apache.phoenix.compile.RowProjector;
 import org.apache.phoenix.exception.SQLExceptionCode;
@@ -552,7 +550,7 @@ public class PhoenixResultSet implements ResultSet, SQLCloseable, org.apache.pho
     }
 
     @Override
-    public Statement getStatement() throws SQLException {
+    public PhoenixStatement getStatement() throws SQLException {
         return statement;
     }
 


Mime
View raw message