You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ja...@apache.org on 2017/09/15 17:27:03 UTC

[1/2] phoenix git commit: PHOENIX-4211 Change tephra dependency in phoenix-kafka to test dependency like other poms

Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 580b035f0 -> 6eb2ceea3


PHOENIX-4211 Change tephra dependency in phoenix-kafka to test dependency like other poms


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 70a19d12db4b944b1a6e09a6b48903511865b6de
Parents: 580b035
Author: James Taylor <jt...@salesforce.com>
Authored: Thu Sep 14 09:55:17 2017 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Fri Sep 15 10:25:27 2017 -0700

----------------------------------------------------------------------
 phoenix-kafka/pom.xml | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/70a19d12/phoenix-kafka/pom.xml
----------------------------------------------------------------------
diff --git a/phoenix-kafka/pom.xml b/phoenix-kafka/pom.xml
index 27225aa..c07b080 100644
--- a/phoenix-kafka/pom.xml
+++ b/phoenix-kafka/pom.xml
@@ -50,26 +50,12 @@
 	</properties>
 
 	<dependencies>
-		<!-- Transaction dependencies -->
-		<dependency>
-			<groupId>org.apache.tephra</groupId>
-			<artifactId>tephra-api</artifactId>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.tephra</groupId>
-			<artifactId>tephra-core</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>org.apache.tephra</groupId>
 			<artifactId>tephra-core</artifactId>
 			<type>test-jar</type>
 			<scope>test</scope>
 		</dependency>
-		<dependency>
-			<groupId>org.apache.tephra</groupId>
-			<artifactId>tephra-hbase-compat-0.98</artifactId>
-		</dependency>
-
 		<!-- Make sure we have all the antlr dependencies -->
 		<dependency>
 			<groupId>org.antlr</groupId>
@@ -311,6 +297,12 @@
 			<groupId>org.apache.flume</groupId>
 			<artifactId>flume-ng-core</artifactId>
 		</dependency>
+                <dependency>
+                  <groupId>org.apache.tephra</groupId>
+                  <artifactId>tephra-core</artifactId>
+                  <type>test-jar</type>
+                  <scope>test</scope>
+                </dependency>
 	</dependencies>
 
 	<build>


[2/2] phoenix git commit: PHOENIX-4209 Disallow DML operations on connections with CURRENT_SCN set (Ethan Wang)

Posted by ja...@apache.org.
PHOENIX-4209 Disallow DML operations on connections with CURRENT_SCN set (Ethan Wang)


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 6eb2ceea312e72acdd8a4440ce549140023e4157
Parents: 70a19d1
Author: James Taylor <jt...@salesforce.com>
Authored: Fri Sep 15 10:21:42 2017 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Fri Sep 15 10:25:45 2017 -0700

----------------------------------------------------------------------
 .../apache/phoenix/end2end/DistinctCountIT.java | 102 ++++++++-----------
 1 file changed, 40 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/6eb2ceea/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
index a7482cb..34ce4f1 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/DistinctCountIT.java
@@ -45,26 +45,22 @@ import java.sql.ResultSet;
 import java.sql.Types;
 import java.util.Properties;
 
-import org.apache.phoenix.schema.TableAlreadyExistsException;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
 
-public class DistinctCountIT extends BaseClientManagedTimeIT {
+public class DistinctCountIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testDistinctCountOnColumn() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
-
-        String query = "SELECT count(DISTINCT A_STRING) FROM aTable";
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
+        String query = "SELECT count(DISTINCT A_STRING) FROM "+tableName;
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
-        Connection conn = DriverManager.getConnection(getUrl(), props);
+        Connection conn = DriverManager.getConnection(getUrl(),props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
             ResultSet rs = statement.executeQuery();
@@ -78,15 +74,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountOnRKColumn() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT count(DISTINCT ORGANIZATION_ID) FROM aTable";
+        String query = "SELECT count(DISTINCT ORGANIZATION_ID) FROM "+tableName;
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -101,15 +95,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountWithGroupBy() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM aTable group by A_STRING";
+        String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM "+tableName+" group by A_STRING";
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -131,15 +123,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountWithGroupByAndOrderBy() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM aTable group by A_STRING order by A_STRING desc";
+        String query = "SELECT A_STRING, count(DISTINCT B_STRING) FROM "+tableName+" group by A_STRING order by A_STRING desc";
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -161,15 +151,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountWithGroupByAndOrderByOnDistinctCount() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT A_STRING, count(DISTINCT B_STRING) as COUNT_B_STRING FROM aTable group by A_STRING order by COUNT_B_STRING";
+        String query = "SELECT A_STRING, count(DISTINCT B_STRING) as COUNT_B_STRING FROM "+tableName+" group by A_STRING order by COUNT_B_STRING";
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -191,16 +179,14 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountWithGroupByOrdered() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         String tenantId2 = "00D400000000XHP";
-        initATableValues(tenantId, tenantId2, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, tenantId2, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT organization_id, count(DISTINCT A_STRING) FROM aTable group by organization_id";
+        String query = "SELECT organization_id, count(DISTINCT A_STRING) FROM "+tableName+" group by organization_id";
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -219,14 +205,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountOn2Columns() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT count(DISTINCT A_STRING), count(DISTINCT B_STRING) FROM aTable";
+        String query = "SELECT count(DISTINCT A_STRING), count(DISTINCT B_STRING) FROM "+tableName;
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -242,15 +227,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
     
     @Test
     public void testDistinctCountONE() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(tenantId, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT count(DISTINCT 1) FROM aTable";
+        String query = "SELECT count(DISTINCT 1) FROM "+tableName;
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 2)); // Execute at
-                                                                                     // timestamp 2
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -265,14 +248,13 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
     
     @Test
     public void testDistinctCountONEWithEmptyResult() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(null, null, getDefaultSplits(tenantId), null, ts);
+        String tableName = generateUniqueName();
+        initATableValues(null, null, getDefaultSplits(tenantId), null, tableName);
 
-        String query = "SELECT count(DISTINCT 1) FROM aTable";
+        String query = "SELECT count(DISTINCT 1) FROM "+tableName;
 
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             PreparedStatement statement = conn.prepareStatement(query);
@@ -285,23 +267,17 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
         }
     }
     
-    protected static void initATableValues(String tenantId1, String tenantId2, byte[][] splits, Date date, Long ts) throws Exception {
-        if (ts == null) {
-            ensureTableCreated(getUrl(), ATABLE_NAME, ATABLE_NAME, splits, null);
-        } else {
-            ensureTableCreated(getUrl(), ATABLE_NAME, ATABLE_NAME, splits, ts-2, null);
-        }
+    protected static void initATableValues(String tenantId1, String tenantId2, byte[][] splits, Date date,
+            String tableName) throws Exception {
+        ensureTableCreated(getUrl(), tableName, ATABLE_NAME, splits, null);
         
         Properties props = new Properties();
-        if (ts != null) {
-            props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, ts.toString());
-        }
         Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
             // Insert all rows at ts
             PreparedStatement stmt = conn.prepareStatement(
-                    "upsert into " +
-                    "ATABLE(" +
+                    "upsert into " + tableName +
+                    " (" +
                     "    ORGANIZATION_ID, " +
                     "    ENTITY_ID, " +
                     "    A_STRING, " +
@@ -459,8 +435,10 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
     @Test
     public void testDistinctCountOnIndexTab() throws Exception {
+        String tableName=generateUniqueName();
+        String indexName=generateUniqueName();
         long ts = nextTimestamp();
-        String ddl = "create table personal_details (id integer not null, first_name char(15),\n"
+        String ddl = "create table "+tableName+" (id integer not null, first_name char(15),\n"
                 + "    last_name char(15), CONSTRAINT pk PRIMARY KEY (id))";
         Properties props = new Properties();
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 10));
@@ -471,12 +449,12 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
         
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20));
         conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("CREATE INDEX personal_details_idx ON personal_details(first_name)");
+        conn.createStatement().execute("CREATE INDEX "+indexName+" ON "+tableName+"(first_name)");
         conn.close();
 
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 30));
         conn = DriverManager.getConnection(getUrl(), props);
-        stmt = conn.prepareStatement("upsert into personal_details(id, first_name, "
+        stmt = conn.prepareStatement("upsert into "+tableName+" (id, first_name, "
                 + "last_name) VALUES (?, ?, ?)");
         stmt.setInt(1, 1);
         stmt.setString(2, "NAME1");
@@ -495,7 +473,7 @@ public class DistinctCountIT extends BaseClientManagedTimeIT {
 
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40));
         conn = DriverManager.getConnection(getUrl(), props);
-        String query = "SELECT COUNT (DISTINCT first_name) FROM personal_details";
+        String query = "SELECT COUNT (DISTINCT first_name) FROM "+tableName;
         PreparedStatement statement = conn.prepareStatement(query);
         ResultSet rs = statement.executeQuery();
         assertTrue(rs.next());