git commit: PHOENIX-1161 Prevent necessity of clearing region cache on every access for local indexing

2014-08-12 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/4.0 4fa6146b3 - 04874e69e


PHOENIX-1161 Prevent necessity of clearing region cache on every access for 
local indexing


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

Branch: refs/heads/4.0
Commit: 04874e69e3cc598ae86a14b502789a04635fcc15
Parents: 4fa6146
Author: James Taylor jtay...@salesforce.com
Authored: Tue Aug 12 09:49:53 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Tue Aug 12 09:49:53 2014 -0700

--
 .../apache/phoenix/end2end/index/LocalIndexIT.java | 17 +++--
 .../coprocessor/BaseScannerRegionObserver.java |  9 +++--
 .../LocalIndexParallelIteratorRegionSplitter.java  |  1 -
 .../apache/phoenix/iterate/ParallelIterators.java  | 15 ++-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  3 +++
 5 files changed, 27 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/04874e69/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
index a291a37..06e4d86 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end.index;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -91,7 +92,6 @@ public class LocalIndexIT extends BaseIndexIT {
 public void testLocalIndexRoundTrip() throws Exception {
 createBaseTable(DATA_TABLE_NAME, null, null);
 Connection conn1 = DriverManager.getConnection(getUrl());
-Connection conn2 = DriverManager.getConnection(getUrl());
 conn1.createStatement().execute(CREATE LOCAL INDEX  + 
INDEX_TABLE_NAME +  ON  + DATA_TABLE_NAME + (v1));
 conn1.createStatement().executeQuery(SELECT * FROM  + 
DATA_TABLE_FULL_NAME).next();
 PTable localIndex = 
conn1.unwrap(PhoenixConnection.class).getMetaDataCache().getTable(new 
PTableKey(null,INDEX_TABLE_NAME));
@@ -160,7 +160,7 @@ public class LocalIndexIT extends BaseIndexIT {
 assertEquals(IndexRegionSplitPolicy.class.getName(), 
htd.getValue(HTableDescriptor.SPLIT_POLICY));
 HTable userTable = new 
HTable(admin.getConfiguration(),TableName.valueOf(DATA_TABLE_NAME));
 HTable indexTable = new 
HTable(admin.getConfiguration(),TableName.valueOf(MetaDataUtil.getLocalIndexTableName(DATA_TABLE_NAME)));
-assertEquals(Both user region and index table should have same split 
keys., userTable.getStartKeys(), indexTable.getStartKeys());
+assertArrayEquals(Both user table and index table should have same 
split keys., userTable.getStartKeys(), indexTable.getStartKeys());
 }
 
 @Test
@@ -593,8 +593,6 @@ public class LocalIndexIT extends BaseIndexIT {
 ResultSet rs = conn1.createStatement().executeQuery(SELECT 
COUNT(*) FROM  + INDEX_TABLE_NAME);
 assertTrue(rs.next());
 
-HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
-
 String query = SELECT t_id FROM  + DATA_TABLE_NAME + where 
(v1,k3) IN (('z',4),('a',2));
 rs = conn1.createStatement().executeQuery(query);
 assertTrue(rs.next());
@@ -647,12 +645,6 @@ public class LocalIndexIT extends BaseIndexIT {
 }
 assertEquals(4 + i, regionsOfIndexTable.size());
 String query = SELECT t_id,k1,v1 FROM  + DATA_TABLE_NAME;
-rs = conn1.createStatement().executeQuery(EXPLAIN +query);
-assertEquals(
-CLIENT PARALLEL  + (4+i) + -WAY RANGE SCAN OVER 
-+ 
MetaDataUtil.getLocalIndexTableName(DATA_TABLE_NAME)+ [-32768]\n+
-CLIENT MERGE SORT,
-QueryUtil.getExplainPlan(rs));
 rs = conn1.createStatement().executeQuery(query);
 Thread.sleep(1000);
 for (int j = 0; j  26; j++) {
@@ -661,6 +653,11 @@ public class LocalIndexIT extends BaseIndexIT {
 assertEquals(25-j, rs.getInt(k1));
 assertEquals(strings[j], rs.getString(V1));
 }
+rs = 

git commit: PHOENIX-1161 Prevent necessity of clearing region cache on every access for local indexing

2014-08-12 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master bdf873f5a - 53dcc602f


PHOENIX-1161 Prevent necessity of clearing region cache on every access for 
local indexing


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

Branch: refs/heads/master
Commit: 53dcc602fcda987f64982e06b75107c50c78b643
Parents: bdf873f
Author: James Taylor jtay...@salesforce.com
Authored: Tue Aug 12 09:49:53 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Tue Aug 12 09:51:30 2014 -0700

--
 .../apache/phoenix/end2end/index/LocalIndexIT.java | 17 +++--
 .../coprocessor/BaseScannerRegionObserver.java |  9 +++--
 .../LocalIndexParallelIteratorRegionSplitter.java  |  1 -
 .../apache/phoenix/iterate/ParallelIterators.java  | 15 ++-
 .../phoenix/query/ConnectionQueryServicesImpl.java |  3 +++
 5 files changed, 27 insertions(+), 18 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/53dcc602/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
index a291a37..06e4d86 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/LocalIndexIT.java
@@ -17,6 +17,7 @@
  */
 package org.apache.phoenix.end2end.index;
 
+import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -91,7 +92,6 @@ public class LocalIndexIT extends BaseIndexIT {
 public void testLocalIndexRoundTrip() throws Exception {
 createBaseTable(DATA_TABLE_NAME, null, null);
 Connection conn1 = DriverManager.getConnection(getUrl());
-Connection conn2 = DriverManager.getConnection(getUrl());
 conn1.createStatement().execute(CREATE LOCAL INDEX  + 
INDEX_TABLE_NAME +  ON  + DATA_TABLE_NAME + (v1));
 conn1.createStatement().executeQuery(SELECT * FROM  + 
DATA_TABLE_FULL_NAME).next();
 PTable localIndex = 
conn1.unwrap(PhoenixConnection.class).getMetaDataCache().getTable(new 
PTableKey(null,INDEX_TABLE_NAME));
@@ -160,7 +160,7 @@ public class LocalIndexIT extends BaseIndexIT {
 assertEquals(IndexRegionSplitPolicy.class.getName(), 
htd.getValue(HTableDescriptor.SPLIT_POLICY));
 HTable userTable = new 
HTable(admin.getConfiguration(),TableName.valueOf(DATA_TABLE_NAME));
 HTable indexTable = new 
HTable(admin.getConfiguration(),TableName.valueOf(MetaDataUtil.getLocalIndexTableName(DATA_TABLE_NAME)));
-assertEquals(Both user region and index table should have same split 
keys., userTable.getStartKeys(), indexTable.getStartKeys());
+assertArrayEquals(Both user table and index table should have same 
split keys., userTable.getStartKeys(), indexTable.getStartKeys());
 }
 
 @Test
@@ -593,8 +593,6 @@ public class LocalIndexIT extends BaseIndexIT {
 ResultSet rs = conn1.createStatement().executeQuery(SELECT 
COUNT(*) FROM  + INDEX_TABLE_NAME);
 assertTrue(rs.next());
 
-HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
-
 String query = SELECT t_id FROM  + DATA_TABLE_NAME + where 
(v1,k3) IN (('z',4),('a',2));
 rs = conn1.createStatement().executeQuery(query);
 assertTrue(rs.next());
@@ -647,12 +645,6 @@ public class LocalIndexIT extends BaseIndexIT {
 }
 assertEquals(4 + i, regionsOfIndexTable.size());
 String query = SELECT t_id,k1,v1 FROM  + DATA_TABLE_NAME;
-rs = conn1.createStatement().executeQuery(EXPLAIN +query);
-assertEquals(
-CLIENT PARALLEL  + (4+i) + -WAY RANGE SCAN OVER 
-+ 
MetaDataUtil.getLocalIndexTableName(DATA_TABLE_NAME)+ [-32768]\n+
-CLIENT MERGE SORT,
-QueryUtil.getExplainPlan(rs));
 rs = conn1.createStatement().executeQuery(query);
 Thread.sleep(1000);
 for (int j = 0; j  26; j++) {
@@ -661,6 +653,11 @@ public class LocalIndexIT extends BaseIndexIT {
 assertEquals(25-j, rs.getInt(k1));
 assertEquals(strings[j], rs.getString(V1));
 }
+rs 

git commit: PHOENIX-1162 Use physical name instead of logical name when recovering from stale region cache

2014-08-12 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 aa46fbd01 - 702881c3e


PHOENIX-1162 Use physical name instead of logical name when recovering from 
stale region cache


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

Branch: refs/heads/3.0
Commit: 702881c3ed0f3a47471f5a3bcfd38d0b7f457539
Parents: aa46fbd
Author: James Taylor jtay...@salesforce.com
Authored: Tue Aug 12 11:00:47 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Tue Aug 12 11:00:47 2014 -0700

--
 .../org/apache/phoenix/iterate/ParallelIterators.java| 11 ---
 .../phoenix/query/ConnectionQueryServicesImpl.java   |  2 ++
 2 files changed, 10 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/702881c3/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 da9a819..989a7be 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
@@ -269,7 +269,7 @@ public class ParallelIterators extends ExplainTable 
implements ResultIterators {
 }
 });
 boolean clearedCache = false;
-byte[] tableName = tableRef.getTable().getName().getBytes();
+byte[] tableName = 
tableRef.getTable().getPhysicalName().getBytes();
 for (PairKeyRange,FuturePeekingResultIterator future : 
futures) {
 try {
 PeekingResultIterator iterator = 
future.getSecond().get(timeoutMs, TimeUnit.MILLISECONDS);
@@ -320,7 +320,7 @@ public class ParallelIterators extends ExplainTable 
implements ResultIterators {
 ListPairKeyRange,FuturePeekingResultIterator futures) {
 final ConnectionQueryServices services = 
context.getConnection().getQueryServices();
 ExecutorService executor = services.getExecutor();
-for (KeyRange split : splits) {
+for (final KeyRange split : splits) {
 final Scan splitScan = ScanUtil.newScan(context.getScan());
 // Intersect with existing start/stop key if the table is salted
 // If not salted, we've already intersected it. If salted, we need
@@ -331,7 +331,12 @@ public class ParallelIterators extends ExplainTable 
implements ResultIterators {
 if (minMaxRange != null) {
 // Add salt byte based on current split, as minMaxRange 
won't have it
 minMaxRange = 
SaltingUtil.addSaltByte(split.getLowerRange(), minMaxRange);
-split = split.intersect(minMaxRange);
+// FIXME: seems like this should be possible when we set 
the scan start/stop
+// in StatementContext.setScanRanges(). If it doesn't 
intersect the range for
+// one salt byte, I don't see how it could intersect it 
with any of them.
+if (!ScanUtil.intersectScanRange(splitScan, 
minMaxRange.getLowerRange(), minMaxRange.getUpperRange())) {
+continue; // Skip this chunk if no intersection based 
on minMaxRange
+}
 }
 }
 if (ScanUtil.intersectScanRange(splitScan, split.getLowerRange(), 
split.getUpperRange(), this.context.getScanRanges().useSkipScanFilter())) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/702881c3/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
--
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
index 9eaddf0..7c9332d 100644
--- 
a/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
+++ 
b/phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java
@@ -933,6 +933,7 @@ public class ConnectionQueryServicesImpl extends 
DelegateQueryServices implement
 if (dropMetadata) {
 admin.disableTable(physicalIndexName);
 admin.deleteTable(physicalIndexName);
+clearTableRegionCache(physicalIndexName);
 wasDeleted = true;
 }
 }
@@ 

Apache-Phoenix | 4.0 | Hadoop1 | Build Successful

2014-08-12 Thread Apache Jenkins Server
4.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-1161 Prevent necessity of clearing region cache on every access for local indexing



git commit: PHOENIX-1162 Use physical name instead of logical name when recovering from stale region cache

2014-08-12 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/master 53dcc602f - 00cd7392d


PHOENIX-1162 Use physical name instead of logical name when recovering from 
stale region cache


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

Branch: refs/heads/master
Commit: 00cd7392de11a9b601b55dd13f89cec6090921ba
Parents: 53dcc60
Author: James Taylor jtay...@salesforce.com
Authored: Tue Aug 12 11:09:32 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Tue Aug 12 11:10:46 2014 -0700

--
 .../org/apache/phoenix/iterate/ParallelIterators.java   | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/00cd7392/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 dc8fa67..eb2cf71 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
@@ -335,10 +335,14 @@ public class ParallelIterators extends ExplainTable 
implements ResultIterators {
 if (tableRef.getTable().getBucketNum() != null) {
 KeyRange minMaxRange = context.getMinMaxRange();
 if (minMaxRange != null) {
-KeyRange splitScanRange = 
KeyRange.getKeyRange(splitScan.getStartRow(), splitScan.getStopRow());
-splitScanRange = 
splitScanRange.intersect(SaltingUtil.addSaltByte(split.getLowerRange(), 
minMaxRange));
-splitScan.setStartRow(splitScanRange.getLowerRange());
-splitScan.setStopRow(splitScanRange.getUpperRange());
+// Add salt byte based on current split, as minMaxRange 
won't have it
+minMaxRange = 
SaltingUtil.addSaltByte(split.getLowerRange(), minMaxRange);
+// FIXME: seems like this should be possible when we set 
the scan start/stop
+// in StatementContext.setScanRanges(). If it doesn't 
intersect the range for
+// one salt byte, I don't see how it could intersect it 
with any of them.
+if (!ScanUtil.intersectScanRange(splitScan, 
minMaxRange.getLowerRange(), minMaxRange.getUpperRange())) {
+continue; // Skip this chunk if no intersection based 
on minMaxRange
+}
 }
 } else if (localIndex) {
 // Used to detect stale region boundary information on server 
side



Apache-Phoenix | Master | Hadoop1 | Build Successful

2014-08-12 Thread Apache Jenkins Server
Master branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-master-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-1161 Prevent necessity of clearing region cache on every access for local indexing



Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-08-12 Thread Apache Jenkins Server
3.0 branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-3.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-1162 Use physical name instead of logical name when recovering from stale region cache



Apache-Phoenix | 4.0 | Hadoop1 | Build Successful

2014-08-12 Thread Apache Jenkins Server
4.0 branch build status Successful

Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Compiled Artifacts https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastSuccessfulBuild/artifact/

Test Report https://builds.apache.org/job/Phoenix-4.0-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-1162 Use physical name instead of logical name when recovering from stale region cache

[mujtaba] Phoenix-1132 - Create merged jar for server side. Adding antlr.*



Apache-Phoenix | Master | Hadoop1 | Build Successful

2014-08-12 Thread Apache Jenkins Server
Master branch build status Successful
Source repository https://git-wip-us.apache.org/repos/asf/incubator-phoenix.git

Last Successful Compiled Artifacts https://builds.apache.org/job/Phoenix-master-hadoop1/lastSuccessfulBuild/artifact/

Last Complete Test Report https://builds.apache.org/job/Phoenix-master-hadoop1/lastCompletedBuild/testReport/

Changes
[jtaylor] PHOENIX-1162 Use physical name instead of logical name when recovering from stale region cache

[mujtaba] Phoenix-1132 - Create merged jar for server side. Adding antlr.*



Git Push Summary

2014-08-12 Thread mujtaba
Repository: phoenix
Updated Tags:  refs/tags/v3.1.0-rc1 [created] de8448894