You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ra...@apache.org on 2017/06/09 21:31:29 UTC
phoenix git commit: PHOENIX-3898 Empty result set after split with
local index on multi-tenant table(Rajeshbabu)
Repository: phoenix
Updated Branches:
refs/heads/master edad3503d -> cd49ba7ee
PHOENIX-3898 Empty result set after split with local index on multi-tenant table(Rajeshbabu)
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cd49ba7e
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cd49ba7e
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cd49ba7e
Branch: refs/heads/master
Commit: cd49ba7eef11bc748be3619ad3d6c1dd0f0699ea
Parents: edad350
Author: Rajeshbabu Chintaguntla <ra...@apache.org>
Authored: Fri Jun 9 14:31:14 2017 -0700
Committer: Rajeshbabu Chintaguntla <ra...@apache.org>
Committed: Fri Jun 9 14:31:14 2017 -0700
----------------------------------------------------------------------
.../index/MutableIndexSplitForwardScanIT.java | 4 +--
.../end2end/index/MutableIndexSplitIT.java | 10 ++++---
.../index/MutableIndexSplitReverseScanIT.java | 4 +--
.../apache/phoenix/index/IndexMaintainer.java | 31 ++++----------------
4 files changed, 15 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd49ba7e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java
index 4ce2b4c..75e2ae2 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitForwardScanIT.java
@@ -21,8 +21,8 @@ import org.junit.Test;
public class MutableIndexSplitForwardScanIT extends MutableIndexSplitIT {
- public MutableIndexSplitForwardScanIT(boolean localIndex) {
- super(localIndex);
+ public MutableIndexSplitForwardScanIT(boolean localIndex, boolean multiTenant) {
+ super(localIndex, multiTenant);
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd49ba7e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitIT.java
index 77bd125..b05c9b7 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitIT.java
@@ -51,9 +51,11 @@ import org.junit.runners.Parameterized.Parameters;
public abstract class MutableIndexSplitIT extends ParallelStatsDisabledIT {
protected final boolean localIndex;
+ protected final boolean multiTenant;
- public MutableIndexSplitIT(boolean localIndex) {
+ public MutableIndexSplitIT(boolean localIndex,boolean multiTenant) {
this.localIndex = localIndex;
+ this.multiTenant = multiTenant;
}
private static Connection getConnection(Properties props) throws SQLException {
@@ -62,10 +64,10 @@ public abstract class MutableIndexSplitIT extends ParallelStatsDisabledIT {
return conn;
}
- @Parameters(name="MutableIndexSplitIT_localIndex={0}") // name is used by failsafe as file name in reports
+ @Parameters(name="MutableIndexSplitIT_localIndex={0},multiTenant={1}") // name is used by failsafe as file name in reports
public static Collection<Boolean[]> data() {
return Arrays.asList(new Boolean[][] {
- { false }, { true } });
+ { false, false },{ false, true },{true, false}, { true, true } });
}
protected void testSplitDuringIndexScan(boolean isReverse) throws Exception {
@@ -172,7 +174,7 @@ public abstract class MutableIndexSplitIT extends ParallelStatsDisabledIT {
"k2 INTEGER NOT NULL,\n" +
"k3 INTEGER,\n" +
"v1 VARCHAR,\n" +
- "CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))\n"
+ "CONSTRAINT pk PRIMARY KEY (t_id, k1, k2))" + (multiTenant ? " MULTI_TENANT=true ":"") +"\n"
+ (splits != null ? (" split on " + splits) : "");
conn.createStatement().execute(ddl);
}
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd49ba7e/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java
index dc9a3fa..d7afb31 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexSplitReverseScanIT.java
@@ -21,8 +21,8 @@ import org.junit.Test;
public class MutableIndexSplitReverseScanIT extends MutableIndexSplitIT {
- public MutableIndexSplitReverseScanIT(boolean localIndex) {
- super(localIndex);
+ public MutableIndexSplitReverseScanIT(boolean localIndex, boolean multiTenant) {
+ super(localIndex, multiTenant);
}
@Test
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cd49ba7e/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
index dd46345..be22334 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/index/IndexMaintainer.java
@@ -781,32 +781,11 @@ public class IndexMaintainer implements Writable, Iterable<ColumnReference> {
* return the view index id from the index row key
*/
public byte[] getViewIndexIdFromIndexRowKey(ImmutableBytesWritable indexRowKeyPtr) {
- assert(isLocalIndex);
- RowKeySchema indexRowKeySchema = getIndexRowKeySchema();
- // TODO add logic to skip region start key as well because we cannot find the region startkey in indexhalfstorefilereader.
- ImmutableBytesWritable ptr = new ImmutableBytesWritable();
- TrustedByteArrayOutputStream stream =
- new TrustedByteArrayOutputStream(estimatedIndexRowKeyBytes);
- DataOutput output = new DataOutputStream(stream);
- try {
- int indexPosOffset = (!isLocalIndex && nIndexSaltBuckets > 0 ? 1 : 0) + (isMultiTenant ? 1 : 0) + (viewIndexId == null ? 0 : 1);
- Boolean hasValue =
- indexRowKeySchema.iterator(indexRowKeyPtr, ptr, indexPosOffset);
- if (Boolean.TRUE.equals(hasValue)) {
- output.write(ptr.get(), ptr.getOffset(), ptr.getLength());
- }
- int length = stream.size();
- byte[] dataRowKey = stream.getBuffer();
- return dataRowKey.length == length ? dataRowKey : Arrays.copyOf(dataRowKey, length);
- } catch (IOException e) {
- throw new RuntimeException(e); // Impossible
- } finally {
- try {
- stream.close();
- } catch (IOException e) {
- throw new RuntimeException(e); // Impossible
- }
- }
+ assert (isLocalIndex);
+ ImmutableBytesPtr ptr =
+ new ImmutableBytesPtr(indexRowKeyPtr.get(),( indexRowKeyPtr.getOffset()
+ + (nIndexSaltBuckets > 0 ? 1 : 0)), viewIndexId.length);
+ return ptr.copyBytesIfNecessary();
}
private volatile RowKeySchema indexRowKeySchema;