phoenix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jamestay...@apache.org
Subject [5/6] git commit: PHOENIX-1251 Salted queries with range scan become full table scans
Date Sat, 04 Oct 2014 03:51:02 GMT
PHOENIX-1251 Salted queries with range scan become full table scans


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

Branch: refs/heads/3.0
Commit: 5f6f80b83b07609e4990eded142ff9b6f09393a5
Parents: 88c6abb
Author: James Taylor <jtaylor@salesforce.com>
Authored: Fri Oct 3 20:55:50 2014 -0700
Committer: James Taylor <jtaylor@salesforce.com>
Committed: Fri Oct 3 20:55:50 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/phoenix/compile/ScanRanges.java   |  6 ++++++
 .../phoenix/coprocessor/MetaDataEndpointImpl.java     |  6 +++---
 .../org/apache/phoenix/iterate/ParallelIterators.java |  2 +-
 .../org/apache/phoenix/schema/MetaDataClient.java     | 14 +++++++-------
 pom.xml                                               |  2 +-
 5 files changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/5f6f80b8/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
index 1bd8cef..533d752 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/compile/ScanRanges.java
@@ -210,6 +210,9 @@ public class ScanRanges {
     public Scan intersectScan(Scan scan, final byte[] originalStartKey, final byte[] originalStopKey,
final int keyOffset) {
         byte[] startKey = originalStartKey;
         byte[] stopKey = originalStopKey;
+        if (stopKey.length > 0 && Bytes.compareTo(startKey, stopKey) >= 0)
{
+            return null;
+        }
         boolean mayHaveRows = false;
         // Keep the keys as they are if we have a point lookup, as we've already resolved
the
         // salt bytes in that case.
@@ -338,6 +341,9 @@ public class ScanRanges {
                 scanStopKey = prefixKey(scanStopKey, scanKeyOffset, prefixBytes, keyOffset);
             }
         }
+        if (scanStopKey.length > 0 && Bytes.compareTo(scanStartKey, scanStopKey)
>= 0) {
+            return null;
+        }
         newScan.setStartRow(scanStartKey);
         newScan.setStopRow(scanStopKey);
         

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5f6f80b8/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
index f1f05be..17e5e15 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/coprocessor/MetaDataEndpointImpl.java
@@ -482,10 +482,10 @@ public class MetaDataEndpointImpl extends BaseEndpointCoprocessor implements
Met
                 KeyValue current = result.raw()[0];
                 int tableNameLength = tableNameBytes.length + 1;
                 int cfOffset = current.getRowOffset() + tableNameLength;
-                int cfLength = getVarCharLength(current.getRow(), cfOffset, current.getRowLength()
- tableNameLength);
-                ptr.set(current.getRow(), cfOffset, cfLength);
+                int cfLength = getVarCharLength(current.getBuffer(), cfOffset, current.getRowLength()
- tableNameLength);
+                ptr.set(current.getBuffer(), cfOffset, cfLength);
                 byte[] cfName = ByteUtil.copyKeyBytesIfNecessary(ptr);
-                PhoenixArray array = (PhoenixArray)PDataType.VARBINARY_ARRAY.toObject(current.getValue(),
current.getValueOffset(), current
+                PhoenixArray array = (PhoenixArray)PDataType.VARBINARY_ARRAY.toObject(current.getBuffer(),
current.getValueOffset(), current
                         .getValueLength());
                 if (array != null && array.getDimensions() != 0) {
                     List<byte[]> guidePosts = Lists.newArrayListWithExpectedSize(array.getDimensions());
                       

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5f6f80b8/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 da8c212..81dfbb6 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
@@ -332,7 +332,7 @@ public class ParallelIterators extends ExplainTable implements ResultIterators
{
         for (int i = 0; i < gps.size(); i++) {
             buf.append(Bytes.toStringBinary(gps.get(i)));
             buf.append(",");
-            if (i < gps.size()-1 && (i % 10) == 0) {
+            if (i+1 < gps.size() && ((i+1) % 10) == 0) {
                 buf.append("\n");
             }
         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5f6f80b8/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
index 76f1b2a..79eaea0 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/schema/MetaDataClient.java
@@ -1448,14 +1448,14 @@ public class MetaDataClient {
                                 tableRefs.add(new TableRef(null, viewIndexTable, ts, false));
                             }
                         }
+                        // Delete everything in the column. You'll still be able to do queries
at earlier timestamps
+                        tableRefs.add(new TableRef(null, table, ts, false));
+                        // TODO: Let the standard mutable secondary index maintenance handle
this?
+                        for (PTable index: table.getIndexes()) {
+                            tableRefs.add(new TableRef(null, index, ts, false));
+                        }
+                        deleteFromStatsTable(tableRefs, ts);
                         if (!dropMetaData) {
-                            // Delete everything in the column. You'll still be able to do
queries at earlier timestamps
-                            tableRefs.add(new TableRef(null, table, ts, false));
-                            // TODO: Let the standard mutable secondary index maintenance
handle this?
-                            for (PTable index: table.getIndexes()) {
-                                tableRefs.add(new TableRef(null, index, ts, false));
-                            }
-                            deleteFromStatsTable(tableRefs, ts);
                             MutationPlan plan = new PostDDLCompiler(connection).compile(tableRefs,
null, null, Collections.<PColumn>emptyList(), ts);
                             return connection.getQueryServices().updateData(plan);
                         }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/5f6f80b8/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9ff65d0..bd9e9c2 100644
--- a/pom.xml
+++ b/pom.xml
@@ -247,7 +247,7 @@
                   <encoding>UTF-8</encoding>
                   <forkCount>${numForkedIT}</forkCount>
                   <reuseForks>true</reuseForks>
-                  <argLine>-enableassertions -Xmx2000m -XX:MaxPermSize=128m -Djava.security.egd=file:/dev/./urandom</argLine>
+                  <argLine>-enableassertions -Xmx2500m -XX:MaxPermSize=128m -Djava.security.egd=file:/dev/./urandom</argLine>
                   <redirectTestOutputToFile>${test.output.tofile}</redirectTestOutputToFile>
                   <testSourceDirectory>${basedir}/src/it/java</testSourceDirectory>
                   <groups>org.apache.phoenix.end2end.HBaseManagedTimeTest</groups>


Mime
View raw message