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/18 17:31:00 UTC

phoenix git commit: PHOENIX-4209 Disallow DML operations on connections with CURRENT_SCN set - DistinctCountIT

Repository: phoenix
Updated Branches:
  refs/heads/master df5b0d213 -> 711b5bfad


PHOENIX-4209 Disallow DML operations on connections with CURRENT_SCN set - DistinctCountIT


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

Branch: refs/heads/master
Commit: 711b5bfad0ea6bb9402ef6834b76fb292991969f
Parents: df5b0d2
Author: James Taylor <jt...@salesforce.com>
Authored: Mon Sep 18 10:31:01 2017 -0700
Committer: James Taylor <jt...@salesforce.com>
Committed: Mon Sep 18 10:31:01 2017 -0700

----------------------------------------------------------------------
 .../org/apache/phoenix/end2end/DistinctCountIT.java | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/711b5bfa/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 34ce4f1..e586ebc 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,7 +45,6 @@ import java.sql.ResultSet;
 import java.sql.Types;
 import java.util.Properties;
 
-import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.junit.Test;
 
@@ -247,7 +246,7 @@ public class DistinctCountIT extends ParallelStatsDisabledIT {
     }
     
     @Test
-    public void testDistinctCountONEWithEmptyResult() throws Exception {
+    public void testDistinctCountOneWithEmptyResult() throws Exception {
         String tenantId = getOrganizationId();
         String tableName = generateUniqueName();
         initATableValues(null, null, getDefaultSplits(tenantId), null, tableName);
@@ -437,23 +436,15 @@ public class DistinctCountIT extends ParallelStatsDisabledIT {
     public void testDistinctCountOnIndexTab() throws Exception {
         String tableName=generateUniqueName();
         String indexName=generateUniqueName();
-        long ts = nextTimestamp();
         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));
+        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         PreparedStatement stmt = conn.prepareStatement(ddl);
         stmt.execute(ddl);
-        conn.close();
         
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 20));
-        conn = DriverManager.getConnection(getUrl(), props);
         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 "+tableName+" (id, first_name, "
                 + "last_name) VALUES (?, ?, ?)");
         stmt.setInt(1, 1);
@@ -469,10 +460,7 @@ public class DistinctCountIT extends ParallelStatsDisabledIT {
         stmt.setString(3, "LN3");
         stmt.execute();
         conn.commit();
-        conn.close();
 
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 40));
-        conn = DriverManager.getConnection(getUrl(), props);
         String query = "SELECT COUNT (DISTINCT first_name) FROM "+tableName;
         PreparedStatement statement = conn.prepareStatement(query);
         ResultSet rs = statement.executeQuery();