git commit: PHOENIX-1098 Support CASCADE option on DROP TABLE that drops all VIEWs (Jan Fernando)

2014-09-04 Thread jamestaylor
Repository: phoenix
Updated Branches:
  refs/heads/3.0 be6465a89 - 3af2450d3


PHOENIX-1098 Support CASCADE option on DROP TABLE that drops all VIEWs (Jan 
Fernando)


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

Branch: refs/heads/3.0
Commit: 3af2450d31ec53dbc84fcf3ad8208836acb1bba1
Parents: be6465a
Author: James Taylor jtay...@salesforce.com
Authored: Thu Sep 4 00:18:14 2014 -0700
Committer: James Taylor jtay...@salesforce.com
Committed: Thu Sep 4 00:18:14 2014 -0700

--
 .../end2end/TenantSpecificTablesDDLIT.java  | 108 ++-
 .../java/org/apache/phoenix/end2end/ViewIT.java |  90 -
 phoenix-core/src/main/antlr3/PhoenixSQL.g   |   5 +-
 .../coprocessor/MetaDataEndpointImpl.java   | 135 ---
 .../phoenix/coprocessor/MetaDataProtocol.java   |  11 +-
 .../apache/phoenix/jdbc/PhoenixStatement.java   |   8 +-
 .../phoenix/parse/DropTableStatement.java   |   9 +-
 .../apache/phoenix/parse/ParseNodeFactory.java  |   4 +-
 .../phoenix/query/ConnectionQueryServices.java  |   2 +-
 .../query/ConnectionQueryServicesImpl.java  |   4 +-
 .../query/ConnectionlessQueryServicesImpl.java  |   2 +-
 .../query/DelegateConnectionQueryServices.java  |   4 +-
 .../apache/phoenix/schema/MetaDataClient.java   |   8 +-
 13 files changed, 347 insertions(+), 43 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/3af2450d/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
--
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
index 79aa6c1..591efe1 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantSpecificTablesDDLIT.java
@@ -331,7 +331,7 @@ public class TenantSpecificTablesDDLIT extends 
BaseTenantSpecificTablesIT {
 }
 
 @Test
-public void testDropParentTableWithExistingTenantTable() throws Exception {
+public void testDisallowDropParentTableWithExistingTenantTable() throws 
Exception {
 Properties props = new Properties();
 props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
 Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -348,6 +348,112 @@ public class TenantSpecificTablesDDLIT extends 
BaseTenantSpecificTablesIT {
 }
 
 @Test
+public void testAllowDropParentTableWithCascadeAndSingleTenantTable() 
throws Exception {
+   long ts = nextTimestamp();
+   Properties props = new Properties();
+   props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
+   Connection conn = DriverManager.getConnection(getUrl(), props);
+   Connection connTenant = null;
+
+   try {
+   // Drop Parent Table 
+   conn.createStatement().executeUpdate(DROP TABLE  + 
PARENT_TABLE_NAME +  CASCADE);
+   conn.close();
+ 
+   props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts + 10));
+   connTenant = 
DriverManager.getConnection(PHOENIX_JDBC_TENANT_SPECIFIC_URL, props);
+   
+   validateTenantViewIsDropped(conn);  
+   } finally {
+   if (conn != null) {
+   conn.close();
+   }
+   if (connTenant != null) {
+   connTenant.close();
+   }
+   }
+}
+
+
+@Test
+public void 
testAllDropParentTableWithCascadeWithMultipleTenantTablesAndIndexes() throws 
Exception {
+// Create a second tenant table
+   createTestTable(PHOENIX_JDBC_TENANT_SPECIFIC_URL2, TENANT_TABLE_DDL, 
null, nextTimestamp());
+   //TODO Create some tenant specific table indexes
+
+   long ts = nextTimestamp();
+   Properties props = new Properties();
+   props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
+   Connection conn = null;
+   Connection connTenant1 = null;
+   Connection connTenant2 = null;
+
+   try {
+   conn = DriverManager.getConnection(getUrl(), props);
+   DatabaseMetaData meta = conn.getMetaData();
+ResultSet rs = meta.getSuperTables(null, null, 

Apache-Phoenix | Master | Hadoop1 | Build Successful

2014-09-04 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-1098 Support CASCADE option on DROP TABLE that drops all VIEWs (Jan Fernando)



Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-09-04 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-1098 Support CASCADE option on DROP TABLE that drops all VIEWs (Jan Fernando)



git commit: Set SNAPSHOT version after release

2014-09-04 Thread mujtaba
Repository: phoenix
Updated Branches:
  refs/heads/4.0 a6ea5560e - c4ede66fe


Set SNAPSHOT version after release


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

Branch: refs/heads/4.0
Commit: c4ede66fedd51c2984b5cc8ec86fd4e36eb0630f
Parents: a6ea556
Author: Mujtaba mujt...@apache.org
Authored: Thu Sep 4 09:28:29 2014 -0700
Committer: Mujtaba mujt...@apache.org
Committed: Thu Sep 4 09:28:29 2014 -0700

--
 phoenix-assembly/pom.xml   | 2 +-
 phoenix-core/pom.xml   | 2 +-
 phoenix-flume/pom.xml  | 2 +-
 phoenix-hadoop-compat/pom.xml  | 2 +-
 phoenix-hadoop1-compat/pom.xml | 2 +-
 phoenix-hadoop2-compat/pom.xml | 2 +-
 phoenix-pig/pom.xml| 2 +-
 pom.xml| 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-assembly/pom.xml
--
diff --git a/phoenix-assembly/pom.xml b/phoenix-assembly/pom.xml
index a34b09c..49cc8a6 100644
--- a/phoenix-assembly/pom.xml
+++ b/phoenix-assembly/pom.xml
@@ -26,7 +26,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-assembly/artifactId
   namePhoenix Assembly/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-core/pom.xml
--
diff --git a/phoenix-core/pom.xml b/phoenix-core/pom.xml
index 5e25056..ff3f5d8 100644
--- a/phoenix-core/pom.xml
+++ b/phoenix-core/pom.xml
@@ -4,7 +4,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-core/artifactId
   namePhoenix Core/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-flume/pom.xml
--
diff --git a/phoenix-flume/pom.xml b/phoenix-flume/pom.xml
index 9149895..2253fc8 100644
--- a/phoenix-flume/pom.xml
+++ b/phoenix-flume/pom.xml
@@ -26,7 +26,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-flume/artifactId
   namePhoenix - Flume/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-hadoop-compat/pom.xml
--
diff --git a/phoenix-hadoop-compat/pom.xml b/phoenix-hadoop-compat/pom.xml
index 7ec49f0..8f5a283 100644
--- a/phoenix-hadoop-compat/pom.xml
+++ b/phoenix-hadoop-compat/pom.xml
@@ -25,7 +25,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-hadoop-compat/artifactId
   namePhoenix Hadoop Compatibility/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-hadoop1-compat/pom.xml
--
diff --git a/phoenix-hadoop1-compat/pom.xml b/phoenix-hadoop1-compat/pom.xml
index 8d20b11..1f82cc3 100644
--- a/phoenix-hadoop1-compat/pom.xml
+++ b/phoenix-hadoop1-compat/pom.xml
@@ -25,7 +25,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-hadoop1-compat/artifactId
   namePhoenix Hadoop1 Compatibility/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-hadoop2-compat/pom.xml
--
diff --git a/phoenix-hadoop2-compat/pom.xml b/phoenix-hadoop2-compat/pom.xml
index daa538a..a5fc33d 100644
--- a/phoenix-hadoop2-compat/pom.xml
+++ b/phoenix-hadoop2-compat/pom.xml
@@ -25,7 +25,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+version4.2.0-SNAPSHOT/version
   /parent
   artifactIdphoenix-hadoop2-compat/artifactId
   namePhoenix Hadoop2 Compatibility/name

http://git-wip-us.apache.org/repos/asf/phoenix/blob/c4ede66f/phoenix-pig/pom.xml
--
diff --git a/phoenix-pig/pom.xml b/phoenix-pig/pom.xml
index e9b039e..41b68a8 100644
--- a/phoenix-pig/pom.xml
+++ b/phoenix-pig/pom.xml
@@ -26,7 +26,7 @@
   parent
 groupIdorg.apache.phoenix/groupId
 artifactIdphoenix/artifactId
-version4.1.0/version
+

git commit: PHOENIX-1234 QueryUtil doesn't parse zk hosts correctly

2014-09-04 Thread jyates
Repository: phoenix
Updated Branches:
  refs/heads/master ec3be54ef - 4a1ec7ec4


PHOENIX-1234 QueryUtil doesn't parse zk hosts correctly


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

Branch: refs/heads/master
Commit: 4a1ec7ec44248315023db41cf4c941a366a1d294
Parents: ec3be54
Author: Jesse Yates jya...@apache.org
Authored: Thu Sep 4 09:44:10 2014 -0700
Committer: Jesse Yates jya...@apache.org
Committed: Thu Sep 4 09:44:10 2014 -0700

--
 .../java/org/apache/phoenix/util/QueryUtil.java | 55 +++-
 .../java/org/apache/phoenix/query/BaseTest.java | 16 +++---
 .../org/apache/phoenix/util/QueryUtilTest.java  | 55 +++-
 3 files changed, 102 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/4a1ec7ec/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index 6a45666..88ffd8e 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -25,6 +25,7 @@ import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
@@ -35,6 +36,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.util.Addressing;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 
@@ -43,6 +45,7 @@ import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
+import org.apache.phoenix.query.QueryServices;
 
 public final class QueryUtil {
 
@@ -189,26 +192,50 @@ public final class QueryUtil {
 }
 
 public static Connection getConnection(Properties props, Configuration 
conf)
+throws ClassNotFoundException,
+SQLException {
+String url = getConnectionUrl(props, conf);
+LOG.info(Creating connection with the jdbc url: + url);
+return DriverManager.getConnection(url, props);
+}
+
+public static String getConnectionUrl(Properties props, Configuration conf)
 throws ClassNotFoundException, SQLException {
 // make sure we load the phoenix driver
 Class.forName(PhoenixDriver.class.getName());
 
 // read the hbase properties from the configuration
 String server = ZKConfig.getZKQuorumServersString(conf);
-int port;
-// if it has a port, don't try to add one
-try {
-server = Addressing.parseHostname(server);
-port = Addressing.parsePort(server);
-} catch (IllegalArgumentException e) {
-// port isn't set
-port =
-conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT,
-HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT);
+// could be a comma-separated list
+String[] rawServers = server.split(,);
+ListString servers = new ArrayListString(rawServers.length);
+boolean first = true;
+int port = -1;
+for (String serverPort : rawServers) {
+try {
+server = Addressing.parseHostname(serverPort);
+int specifiedPort = Addressing.parsePort(serverPort);
+// there was a previously specified port and it doesn't match 
this server
+if (port  0  specifiedPort != port) {
+throw new IllegalStateException(Phoenix/HBase only 
supports connecting to a  +
+single zookeeper client port. Specify servers 
only as host names in  +
+HBase configuration);
+}
+// set the port to the specified port
+port = specifiedPort;
+servers.add(server);
+} catch (IllegalArgumentException e) {
+}
+}
+// port wasn't set, shouldn't ever happen from HBase, but just in case
+if (port == -1) {
+port = conf.getInt(QueryServices.ZOOKEEPER_PORT_ATTRIB, -1);
+if (port == -1) {
+throw new RuntimeException(Client zk port was not set!);
+}
 }
+ 

git commit: PHOENIX-1234 QueryUtil doesn't parse zk hosts correctly

2014-09-04 Thread jyates
Repository: phoenix
Updated Branches:
  refs/heads/4.0 c4ede66fe - a9a128bfa


PHOENIX-1234 QueryUtil doesn't parse zk hosts correctly


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

Branch: refs/heads/4.0
Commit: a9a128bfa82f0f978f2260a119a4e88ff1db6330
Parents: c4ede66
Author: Jesse Yates jya...@apache.org
Authored: Thu Sep 4 09:44:10 2014 -0700
Committer: Jesse Yates jya...@apache.org
Committed: Thu Sep 4 09:44:46 2014 -0700

--
 .../java/org/apache/phoenix/util/QueryUtil.java | 55 +++-
 .../java/org/apache/phoenix/query/BaseTest.java | 16 +++---
 .../org/apache/phoenix/util/QueryUtilTest.java  | 55 +++-
 3 files changed, 102 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/phoenix/blob/a9a128bf/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
--
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java 
b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
index da6b17a..7f5d4c6 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/util/QueryUtil.java
@@ -25,6 +25,7 @@ import java.sql.DatabaseMetaData;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.SQLException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
@@ -35,6 +36,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.util.Addressing;
+import org.apache.hadoop.hbase.util.Pair;
 import org.apache.hadoop.hbase.zookeeper.ZKConfig;
 import org.apache.phoenix.jdbc.PhoenixDriver;
 
@@ -43,6 +45,7 @@ import com.google.common.base.Joiner;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Lists;
+import org.apache.phoenix.query.QueryServices;
 
 public final class QueryUtil {
 
@@ -190,26 +193,50 @@ public final class QueryUtil {
 }
 
 public static Connection getConnection(Properties props, Configuration 
conf)
+throws ClassNotFoundException,
+SQLException {
+String url = getConnectionUrl(props, conf);
+LOG.info(Creating connection with the jdbc url: + url);
+return DriverManager.getConnection(url, props);
+}
+
+public static String getConnectionUrl(Properties props, Configuration conf)
 throws ClassNotFoundException, SQLException {
 // make sure we load the phoenix driver
 Class.forName(PhoenixDriver.class.getName());
 
 // read the hbase properties from the configuration
 String server = ZKConfig.getZKQuorumServersString(conf);
-int port;
-// if it has a port, don't try to add one
-try {
-server = Addressing.parseHostname(server);
-port = Addressing.parsePort(server);
-} catch (IllegalArgumentException e) {
-// port isn't set
-port =
-conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT,
-HConstants.DEFAULT_ZOOKEPER_CLIENT_PORT);
+// could be a comma-separated list
+String[] rawServers = server.split(,);
+ListString servers = new ArrayListString(rawServers.length);
+boolean first = true;
+int port = -1;
+for (String serverPort : rawServers) {
+try {
+server = Addressing.parseHostname(serverPort);
+int specifiedPort = Addressing.parsePort(serverPort);
+// there was a previously specified port and it doesn't match 
this server
+if (port  0  specifiedPort != port) {
+throw new IllegalStateException(Phoenix/HBase only 
supports connecting to a  +
+single zookeeper client port. Specify servers 
only as host names in  +
+HBase configuration);
+}
+// set the port to the specified port
+port = specifiedPort;
+servers.add(server);
+} catch (IllegalArgumentException e) {
+}
+}
+// port wasn't set, shouldn't ever happen from HBase, but just in case
+if (port == -1) {
+port = conf.getInt(QueryServices.ZOOKEEPER_PORT_ATTRIB, -1);
+if (port == -1) {
+throw new RuntimeException(Client zk port was not set!);
+}
 }
+

Apache-Phoenix | 3.0 | Hadoop1 | Build Successful

2014-09-04 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
[mujtaba] Set SNAPSHOT version after release



Jenkins build became unstable: Phoenix | Master | Hadoop1 #357

2014-09-04 Thread Apache Jenkins Server
See https://builds.apache.org/job/Phoenix-master-hadoop1/357/changes



Apache-Phoenix | 4.0 | Hadoop1 | Build Successful

2014-09-04 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
[jyates] PHOENIX-1234 QueryUtil doesn't parse zk hosts correctly