PHOENIX-4194 Modify RoundFloorCeilFuncIT, RowValueConstructorIT, SaltedTableIT, 
TenantIdTypeIT, StoreNullsIT and RebuildIndexConnectionPropsIT to not use 
CurrentSCN


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

Branch: refs/heads/4.x-HBase-1.2
Commit: 06fbb9a1508144b2bd3d6880d34e819cb29d1538
Parents: 28941bc
Author: Mujtaba <mujt...@apache.org>
Authored: Wed Sep 13 10:56:01 2017 -0700
Committer: Mujtaba <mujt...@apache.org>
Committed: Wed Sep 13 10:56:01 2017 -0700

----------------------------------------------------------------------
 .../phoenix/end2end/RoundFloorCeilFuncIT.java   |  21 +-
 .../phoenix/end2end/RowValueConstructorIT.java  | 365 ++++++++-----------
 .../apache/phoenix/end2end/StoreNullsIT.java    |  27 +-
 .../apache/phoenix/end2end/TenantIdTypeIT.java  |   6 +-
 .../phoenix/end2end/salted/SaltedTableIT.java   | 101 +++--
 .../java/org/apache/phoenix/query/BaseTest.java |  48 ++-
 6 files changed, 242 insertions(+), 326 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fbb9a1/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
index 423876f..b1e218b 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RoundFloorCeilFuncIT.java
@@ -59,7 +59,6 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
     private static final double unsignedDoubleUpserted = 1.264d;
     private static final float floatUpserted = 1.264f;
     private static final float unsignedFloatUpserted = 1.264f;
-
     private String tableName;
     
     @Before
@@ -647,33 +646,23 @@ public class RoundFloorCeilFuncIT extends 
ParallelStatsDisabledIT {
 
   @Test
   public void testRoundOffFunction() throws SQLException {
-    long ts = nextTimestamp();
     Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-    props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
10));
     Connection conn = DriverManager.getConnection(getUrl(), props);
-    String ddl = "create table round_test(k bigint primary key)";
+    String uniquetableName = generateUniqueName();
+    String ddl = "create table " + uniquetableName + "(k bigint primary key)";
     conn.createStatement().execute(ddl);
-    conn.close();
     
-    props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
30));
-    conn = DriverManager.getConnection(getUrl(), props);
-    PreparedStatement stmt = conn.prepareStatement("upsert into round_test 
values(1380603308885)");
+    PreparedStatement stmt = conn.prepareStatement("upsert into " + 
uniquetableName + " values(1380603308885)");
     stmt.execute();
     conn.commit();
-    conn.close();
-    
 
-    props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
-    conn = DriverManager.getConnection(getUrl(), props);
     ResultSet rs;
-    stmt = conn.prepareStatement("select round(k/1000000,0) from round_test");
+    stmt = conn.prepareStatement("select round(k/1000000,0) from " + 
uniquetableName);
     rs = stmt.executeQuery();
     assertTrue(rs.next());
     assertEquals(1380603, rs.getLong(1));
     
-    props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts + 
40));
-    conn = DriverManager.getConnection(getUrl(), props);
-    stmt = conn.prepareStatement("select round(k/1000000,0) x from round_test 
group by x");
+    stmt = conn.prepareStatement("select round(k/1000000,0) x from " + 
uniquetableName + " group by x");
     rs = stmt.executeQuery();
     assertTrue(rs.next());
     assertEquals(1380603, rs.getLong(1));

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fbb9a1/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java
index b7d67f2..df7603a 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/RowValueConstructorIT.java
@@ -22,8 +22,6 @@ import static org.apache.phoenix.util.TestUtil.ENTITYHISTID1;
 import static org.apache.phoenix.util.TestUtil.ENTITYHISTID3;
 import static org.apache.phoenix.util.TestUtil.ENTITYHISTID7;
 import static org.apache.phoenix.util.TestUtil.ENTITYHISTIDS;
-import static 
org.apache.phoenix.util.TestUtil.ENTITY_HISTORY_SALTED_TABLE_NAME;
-import static org.apache.phoenix.util.TestUtil.ENTITY_HISTORY_TABLE_NAME;
 import static org.apache.phoenix.util.TestUtil.PARENTID1;
 import static org.apache.phoenix.util.TestUtil.PARENTID3;
 import static org.apache.phoenix.util.TestUtil.PARENTID7;
@@ -38,7 +36,6 @@ import static org.apache.phoenix.util.TestUtil.ROW7;
 import static org.apache.phoenix.util.TestUtil.ROW8;
 import static org.apache.phoenix.util.TestUtil.ROW9;
 import static org.apache.phoenix.util.TestUtil.TEST_PROPERTIES;
-import static org.apache.phoenix.util.TestUtil.ATABLE_NAME;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -57,19 +54,18 @@ import org.apache.phoenix.util.DateUtil;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
 
 
-public class RowValueConstructorIT extends BaseClientManagedTimeIT {
+public class RowValueConstructorIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testRowValueConstructorInWhereWithEqualsExpression() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) = (7, 5)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) = (7, 5)";
         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);
@@ -89,12 +85,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testRowValueConstructorInWhereWithGreaterThanExpression() 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) >= (4, 4)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) >= (4, 4)";
         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);
@@ -115,12 +109,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testRowValueConstructorInWhereWithUnEqualNumberArgs() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer, y_integer) >= (7, 5)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer, y_integer) >= (7, 5)";
         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);
@@ -141,12 +133,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testBindVarsInRowValueConstructor() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) = (?, ?)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) = (?, ?)";
         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);
@@ -168,12 +158,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testRowValueConstructorOnLHSAndLiteralExpressionOnRHS() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) >= 7";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) >= 7";
         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);
@@ -192,12 +180,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testRowValueConstructorOnRHSLiteralExpressionOnLHS() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND 7 <= (a_integer, x_integer)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND 7 <= (a_integer, x_integer)";
         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);
@@ -216,12 +202,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void 
testRowValueConstructorOnLHSBuiltInFunctionOperatingOnIntegerLiteralRHS() 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) >= to_number('7')";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) >= to_number('7')";
         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);
@@ -240,12 +224,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void 
testRowValueConstructorOnRHSWithBuiltInFunctionOperatingOnIntegerLiteralOnLHS() 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND to_number('7') <= (a_integer, x_integer)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND to_number('7') <= (a_integer, x_integer)";
         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);
@@ -264,12 +246,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void 
testRowValueConstructorOnLHSWithBuiltInFunctionOperatingOnColumnRefOnRHS() 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts - 1, getUrl(), null);
-        String upsertQuery = "UPSERT INTO aTable(organization_id, entity_id, 
a_string) values (?, ?, ?)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String upsertQuery = "UPSERT INTO " + tableName + " (organization_id, 
entity_id, a_string) values (?, ?, ?)";
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(true);
         try {
@@ -312,9 +292,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
             statement.executeUpdate();
             conn.commit();
 
-            props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts + 1));
-            conn = DriverManager.getConnection(getUrl(), props);
-            statement = conn.prepareStatement("select a_string from atable 
where organization_id = ? and (6, x_integer) <= to_number(a_string)");
+            statement = conn.prepareStatement("select a_string from " + 
tableName + " where organization_id = ? and (6, x_integer) <= 
to_number(a_string)");
             statement.setString(1, tenantId);
             ResultSet rs = statement.executeQuery();
             int count = 0;
@@ -330,12 +308,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void 
testRowValueConstructorOnRHSWithBuiltInFunctionOperatingOnColumnRefOnLHS() 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts - 1, getUrl(), null);
-        String upsertQuery = "UPSERT INTO aTable(organization_id, entity_id, 
a_string) values (?, ?, ?)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String upsertQuery = "UPSERT INTO " + tableName + "(organization_id, 
entity_id, a_string) values (?, ?, ?)";
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(true);
         try {
@@ -378,9 +354,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
             statement.executeUpdate();
             conn.commit();
 
-            props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts + 1));
-            conn = DriverManager.getConnection(getUrl(), props);
-            statement = conn.prepareStatement("select a_string from atable 
where organization_id = ? and to_number(a_string) >= (6, 6)");
+            statement = conn.prepareStatement("select a_string from " + 
tableName + " where organization_id = ? and to_number(a_string) >= (6, 6)");
             statement.setString(1, tenantId);
             ResultSet rs = statement.executeQuery();
             int count = 0;
@@ -396,15 +370,13 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testQueryMoreWithInListRowValueConstructor() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         Date date = new Date(System.currentTimeMillis());
-        initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), 
date, ts);
+        String tableName = initEntityHistoryTableValues(null, tenantId, 
getDefaultSplits(tenantId), date, null);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 2));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         
-        PreparedStatement statement = conn.prepareStatement("select parent_id 
from " + ENTITY_HISTORY_TABLE_NAME + 
+        PreparedStatement statement = conn.prepareStatement("select parent_id 
from " + tableName + 
                      " WHERE (organization_id, parent_id, created_date, 
entity_history_id) IN ((?, ?, ?, ?),(?,?,?,?))");
         statement.setString(1, tenantId);
         statement.setString(2, PARENTID3);
@@ -434,16 +406,15 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     }
 
     private void 
_testQueryMoreFunctionalityUsingAllPkColsInRowValueConstructor(boolean salted) 
throws Exception, SQLException {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         Date date = new Date(System.currentTimeMillis());
+        String tableName;
         if(salted) {
-            initSaltedEntityHistoryTableValues(tenantId, null, date, ts - 1);
+            tableName = initSaltedEntityHistoryTableValues(null, tenantId, 
null, date, null);
         } else {
-            initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), 
date, ts - 1);
+            tableName = initEntityHistoryTableValues(null, tenantId, 
getDefaultSplits(tenantId), date, null);
         }
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 2));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         
         String startingOrgId = tenantId;
@@ -451,13 +422,8 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         Date startingDate = date;
         String startingEntityHistId = ENTITYHISTID1;
         PreparedStatement statement = null;
-        if(salted) {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_SALTED_TABLE_NAME + 
-                    " WHERE (organization_id, parent_id, created_date, 
entity_history_id) > (?, ?, ?, ?) ORDER BY organization_id, parent_id, 
created_date, entity_history_id LIMIT 3 ");
-        } else {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_TABLE_NAME + 
-                    " WHERE (organization_id, parent_id, created_date, 
entity_history_id) > (?, ?, ?, ?) ORDER BY organization_id, parent_id, 
created_date, entity_history_id LIMIT 3 ");
-        }
+        statement = conn.prepareStatement("select organization_id, parent_id, 
created_date, entity_history_id, old_value, new_value from " + tableName + 
+                " WHERE (organization_id, parent_id, created_date, 
entity_history_id) > (?, ?, ?, ?) ORDER BY organization_id, parent_id, 
created_date, entity_history_id LIMIT 3 ");
         statement.setString(1, startingOrgId);
         statement.setString(2, startingParentId);
         statement.setDate(3, startingDate);
@@ -515,16 +481,15 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
      * @throws Exception
      */
     private void _testQueryMoreWithSubsetofPKColsInRowValueConstructor(boolean 
salted) throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         Date date = new Date(System.currentTimeMillis());
+        String tableName;
         if(salted) {
-            initSaltedEntityHistoryTableValues(tenantId, null, date, ts - 1);
+            tableName = initSaltedEntityHistoryTableValues(null, tenantId, 
null, date, null);
         } else {
-            initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), 
date, ts - 1);
+            tableName = initEntityHistoryTableValues(null, tenantId, 
getDefaultSplits(tenantId), date, null);
         }
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);
 
         //initial values of pk.
@@ -534,13 +499,8 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         String startingEntityHistId = ENTITYHISTID1;
 
         PreparedStatement statement = null;
-        if(salted) {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_SALTED_TABLE_NAME + 
-                    " WHERE (organization_id, parent_id, entity_history_id) > 
(?, ?, ?) ORDER BY organization_id, parent_id, entity_history_id LIMIT 3 ");
-        } else {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_TABLE_NAME + 
-                    " WHERE (organization_id, parent_id, entity_history_id) > 
(?, ?, ?) ORDER BY organization_id, parent_id, entity_history_id LIMIT 3 ");
-        }
+        statement = conn.prepareStatement("select organization_id, parent_id, 
created_date, entity_history_id, old_value, new_value from " + tableName + 
+                " WHERE (organization_id, parent_id, entity_history_id) > (?, 
?, ?) ORDER BY organization_id, parent_id, entity_history_id LIMIT 3 ");
         statement.setString(1, startingOrgId);
         statement.setString(2, startingParentId);
         statement.setString(3, startingEntityHistId);
@@ -594,28 +554,22 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
      * @throws Exception
      */
     private void 
_testQueryMoreWithLeadingPKColSkippedInRowValueConstructor(boolean salted) 
throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         Date date = new Date(System.currentTimeMillis());
+        String tableName;
         if(salted) {
-            initSaltedEntityHistoryTableValues(tenantId, null, date, ts - 1);
+            tableName = initSaltedEntityHistoryTableValues(null, tenantId, 
null, date, null);
         } else {
-            initEntityHistoryTableValues(tenantId, getDefaultSplits(tenantId), 
date, ts - 1);
+            tableName = initEntityHistoryTableValues(null, tenantId, 
getDefaultSplits(tenantId), date, null);
         }
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         String startingParentId = PARENTID1;
         Date startingDate = date;
         String startingEntityHistId = ENTITYHISTID1;
         PreparedStatement statement = null;
-        if(salted) {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_SALTED_TABLE_NAME + 
-                    " WHERE (parent_id, created_date, entity_history_id) > (?, 
?, ?) ORDER BY parent_id, created_date, entity_history_id LIMIT 3 ");
-        } else {
-            statement = conn.prepareStatement("select organization_id, 
parent_id, created_date, entity_history_id, old_value, new_value from " + 
ENTITY_HISTORY_TABLE_NAME + 
-                    " WHERE (parent_id, created_date, entity_history_id) > (?, 
?, ?) ORDER BY parent_id, created_date, entity_history_id LIMIT 3 ");
-        }
+        statement = conn.prepareStatement("select organization_id, parent_id, 
created_date, entity_history_id, old_value, new_value from " + tableName + 
+                " WHERE (parent_id, created_date, entity_history_id) > (?, ?, 
?) ORDER BY parent_id, created_date, entity_history_id LIMIT 3 ");
         statement.setString(1, startingParentId);
         statement.setDate(2, startingDate);
         statement.setString(3, startingEntityHistId);
@@ -652,12 +606,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithNonLeadingPkColsOfTypesIntegerAndString() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, a_string FROM aTable WHERE 
?=organization_id  AND (a_integer, a_string) <= (5, 'a')";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, a_string FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, a_string) <= (5, 'a')";
         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);
@@ -678,19 +630,17 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithNonLeadingPkColsOfTypesTimeStampAndString() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
         String updateStmt = 
             "upsert into " +
-            "ATABLE(" +
+            tableName + "(" +
             "    ORGANIZATION_ID, " +
             "    ENTITY_ID, " +
             "    A_TIMESTAMP) " +
             "VALUES (?, ?, ?)";
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 1);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection upsertConn = DriverManager.getConnection(url, props);
+        Connection upsertConn = DriverManager.getConnection(getUrl(), props);
         upsertConn.setAutoCommit(true);
         PreparedStatement stmt = upsertConn.prepareStatement(updateStmt);
         stmt.setString(1, tenantId);
@@ -699,9 +649,8 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         stmt.setTimestamp(3, tsValue);
         stmt.execute();
         
-        String query = "SELECT a_timestamp, a_string FROM aTable WHERE 
?=organization_id  AND (a_timestamp, a_string) = (?, 'a')";
+        String query = "SELECT a_timestamp, a_string FROM " + tableName + " 
WHERE ?=organization_id  AND (a_timestamp, a_string) = (?, 'a')";
         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);
@@ -722,16 +671,14 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testNestedRVCBasic() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
         //all the three queries should return the same rows.
-        String[] queries = {"SELECT organization_id, entity_id, a_string FROM 
aTable WHERE ((organization_id, entity_id), a_string) >= ((?, ?), ?)",
-                            "SELECT organization_id, entity_id, a_string FROM 
aTable WHERE (organization_id, entity_id, a_string) >= (?, ?, ?)",
-                            "SELECT organization_id, entity_id, a_string FROM 
aTable WHERE (organization_id, (entity_id, a_string)) >= (?, (?, ?))"
+        String[] queries = {"SELECT organization_id, entity_id, a_string FROM 
" + tableName + " WHERE ((organization_id, entity_id), a_string) >= ((?, ?), 
?)",
+                            "SELECT organization_id, entity_id, a_string FROM 
" + tableName + " WHERE (organization_id, entity_id, a_string) >= (?, ?, ?)",
+                            "SELECT organization_id, entity_id, a_string FROM 
" + tableName + " WHERE (organization_id, (entity_id, 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);
         PreparedStatement statement = null;
         try {
@@ -760,13 +707,11 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithInListClausePossibleNullValues() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
         //we have a row present in aTable where x_integer = 5 and y_integer = 
NULL which gets translated to 0 when retriving from HBase. 
-        String query = "SELECT x_integer, y_integer FROM aTable WHERE ? = 
organization_id AND (x_integer, y_integer) IN ((5))";
+        String query = "SELECT x_integer, y_integer FROM " + tableName + " 
WHERE ? = organization_id AND (x_integer, y_integer) IN ((5))";
         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);
@@ -782,14 +727,12 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithInListClauseUsingSubsetOfPKColsInOrder() throws 
Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
         // Though we have a row present in aTable where organization_id = 
tenantId and  x_integer = 5,
         // we'd also need to have an entity_id that is null (which we don't 
have).
-        String query = "SELECT organization_id, entity_id FROM aTable WHERE 
(organization_id, entity_id) IN (('" + tenantId + "')) AND x_integer = 5";
+        String query = "SELECT organization_id, entity_id FROM " + tableName + 
" WHERE (organization_id, entity_id) IN (('" + tenantId + "')) AND x_integer = 
5";
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 2)); // Execute at timestamp 2
         Connection conn = null;
         PreparedStatement statement = null;
         try {
@@ -812,12 +755,10 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithCeilAndFloorNeededForDecimal() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
null, ts, getUrl(), null);
-        String query = "SELECT a_integer, x_integer FROM aTable WHERE 
?=organization_id  AND (a_integer, x_integer) < (8.6, 4.5) AND (a_integer, 
x_integer) > (6.8, 4)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), null, null, getUrl(), null);
+        String query = "SELECT a_integer, x_integer FROM " + tableName + " 
WHERE ?=organization_id  AND (a_integer, x_integer) < (8.6, 4.5) AND 
(a_integer, x_integer) > (6.8, 4)";
         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);
@@ -837,14 +778,12 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithCeilAndFloorNeededForTimestamp() throws Exception {
-        long ts = nextTimestamp();
         String tenantId = getOrganizationId();
         Date dateUpserted = DateUtil.parseDate("2012-01-01 14:25:28");
         dateUpserted = new Date(dateUpserted.getTime() + 660); // this makes 
the dateUpserted equivalent to 2012-01-01 14:25:28.660
-        initATableValues(ATABLE_NAME, tenantId, getDefaultSplits(tenantId), 
dateUpserted, ts, getUrl(), null);
-        String query = "SELECT a_integer, a_date FROM aTable WHERE 
?=organization_id  AND (a_integer, a_date) <= (9, ?) AND (a_integer, a_date) >= 
(6, ?)";
+        String tableName = initATableValues(null, tenantId, 
getDefaultSplits(tenantId), dateUpserted, null, getUrl(), null);
+        String query = "SELECT a_integer, a_date FROM " + tableName + " WHERE 
?=organization_id  AND (a_integer, a_date) <= (9, ?) AND (a_integer, a_date) >= 
(6, ?)";
         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);
@@ -872,23 +811,20 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testRVCWithMultiCompKeysForIn() throws Exception {
-        long ts = nextTimestamp();
+        String tableName = generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 10));
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("CREATE TABLE t (pk1 varchar, pk2 
varchar, constraint pk primary key (pk1,pk2))");
+        conn.createStatement().execute("CREATE TABLE " + tableName + " (pk1 
varchar, pk2 varchar, constraint pk primary key (pk1,pk2))");
         conn.close();
 
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 20));
         conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(true);
-        conn.createStatement().execute("UPSERT INTO t VALUES('a','a')");
-        conn.createStatement().execute("UPSERT INTO t VALUES('b','b')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " 
VALUES('a','a')");
+        conn.createStatement().execute("UPSERT INTO " + tableName + " 
VALUES('b','b')");
         conn.close();
         
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, Long.toString(ts 
+ 30));
         conn = DriverManager.getConnection(getUrl(), props);
-        ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM t 
WHERE (pk1,pk2) IN (('a','a'),('b','b'))");
+        ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM " + 
tableName + " WHERE (pk1,pk2) IN (('a','a'),('b','b'))");
         assertTrue(rs.next());
         assertEquals("a",rs.getString(1));
         assertEquals("a",rs.getString(2));
@@ -900,7 +836,6 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     private Connection nextConnection(String url) throws SQLException {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
         return DriverManager.getConnection(url, props);
     }
     
@@ -908,25 +843,27 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testInListOfRVC1() throws Exception {
         String tenantId = "ABC";
+        String tableName = generateUniqueName();
+        String viewName = generateUniqueName();
         String tenantSpecificUrl = getUrl() + ";" + 
PhoenixRuntime.TENANT_ID_ATTRIB + '=' + tenantId;
-        String baseTableDDL = "CREATE TABLE t (tenantId varchar(5) NOT NULL, 
pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary 
key (tenantId,pk2,pk3)) MULTI_TENANT=true";
-        createTestTable(getUrl(), baseTableDDL, null, nextTimestamp());
-        String tenantTableDDL = "CREATE VIEW t_view (tenant_col VARCHAR) AS 
SELECT *\n" + 
-                "                FROM t";
-        createTestTable(tenantSpecificUrl, tenantTableDDL, null, 
nextTimestamp());
+        String baseTableDDL = "CREATE TABLE " + tableName + " (tenantId 
varchar(5) NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER 
constraint pk primary key (tenantId,pk2,pk3)) MULTI_TENANT=true";
+        createTestTable(getUrl(), baseTableDDL, null, null);
+        String tenantTableDDL = "CREATE VIEW " + viewName + " (tenant_col 
VARCHAR) AS SELECT *\n" + 
+                "                FROM " + tableName;
+        createTestTable(tenantSpecificUrl, tenantTableDDL, null, null);
 
         Connection conn = nextConnection(tenantSpecificUrl);
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(tenantSpecificUrl);
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from 
t_view WHERE (pk2, pk3) IN ((?, ?), (?, ?)) ORDER BY pk2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ viewName + " WHERE (pk2, pk3) IN ((?, ?), (?, ?)) ORDER BY pk2");
         stmt.setString(1, "helo3");
         stmt.setInt(2, 3);
         stmt.setString(3, "helo5");
@@ -946,25 +883,27 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testInListOfRVC2() throws Exception {
         String tenantId = "ABC";
+        String tableName = generateUniqueName();
+        String viewName = generateUniqueName();
         String tenantSpecificUrl = getUrl() + ";" + 
PhoenixRuntime.TENANT_ID_ATTRIB + '=' + tenantId;
-        String baseTableDDL = "CREATE TABLE t (tenantId varchar(5) NOT NULL, 
pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary 
key (tenantId,pk2,pk3)) MULTI_TENANT=true";
-        createTestTable(getUrl(), baseTableDDL, null, nextTimestamp());
-        String tenantTableDDL = "CREATE VIEW t_view (tenant_col VARCHAR) AS 
SELECT *\n" + 
-                "                FROM t";
-        createTestTable(tenantSpecificUrl, tenantTableDDL, null, 
nextTimestamp());
+        String baseTableDDL = "CREATE TABLE " + tableName + " (tenantId 
varchar(5) NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER 
constraint pk primary key (tenantId,pk2,pk3)) MULTI_TENANT=true";
+        createTestTable(getUrl(), baseTableDDL, null, null);
+        String tenantTableDDL = "CREATE VIEW " + viewName + " (tenant_col 
VARCHAR) AS SELECT *\n" + 
+                "                FROM " + tableName;
+        createTestTable(tenantSpecificUrl, tenantTableDDL, null, null);
 
         Connection conn = nextConnection(tenantSpecificUrl);
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY pk2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY 
pk2");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo3");
         stmt.setInt(3, 3);
@@ -986,21 +925,22 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testInListOfRVC3() throws Exception {
         String tenantId = "ABC";
-        String tableDDL = "CREATE TABLE t (tenantId varchar(5) NOT NULL, pk2 
varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key 
(tenantId,pk2,pk3))";
-        createTestTable(getUrl(), tableDDL, null, nextTimestamp());
+        String tableName = generateUniqueName();
+        String tableDDL = "CREATE TABLE " + tableName + " (tenantId varchar(5) 
NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint 
pk primary key (tenantId,pk2,pk3))";
+        createTestTable(getUrl(), tableDDL, null, null);
 
         Connection conn = nextConnection(getUrl());
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY pk2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY 
pk2");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo3");
         stmt.setInt(3, 3);
@@ -1022,25 +962,27 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test 
     public void testInListOfRVC4() throws Exception {
         String tenantId = "ABC";
+        String tableName = generateUniqueName();
+        String viewName = generateUniqueName();
         String tenantSpecificUrl = getUrl() + ";" + 
PhoenixRuntime.TENANT_ID_ATTRIB + '=' + tenantId;
-        String baseTableDDL = "CREATE TABLE t (tenantId varchar(5) NOT NULL, 
pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary 
key (tenantId,pk2,pk3)) SALT_BUCKETS=4, MULTI_TENANT=true";
-        createTestTable(getUrl(), baseTableDDL, null, nextTimestamp());
-        String tenantTableDDL = "CREATE VIEW t_view (tenant_col VARCHAR) AS 
SELECT *\n" + 
-                "                FROM t";
-        createTestTable(tenantSpecificUrl, tenantTableDDL, null, 
nextTimestamp());
+        String baseTableDDL = "CREATE TABLE " + tableName + " (tenantId 
varchar(5) NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER 
constraint pk primary key (tenantId,pk2,pk3)) SALT_BUCKETS=4, 
MULTI_TENANT=true";
+        createTestTable(getUrl(), baseTableDDL, null, null);
+        String tenantTableDDL = "CREATE VIEW " + viewName + " (tenant_col 
VARCHAR) AS SELECT *\n" + 
+                "                FROM " + tableName;
+        createTestTable(tenantSpecificUrl, tenantTableDDL, null, null);
 
         Connection conn = nextConnection(tenantSpecificUrl);
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + viewName + " 
(pk2, pk3, c1) values ('helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY pk2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY 
pk2");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo3");
         stmt.setInt(3, 3);
@@ -1062,21 +1004,22 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test 
     public void testInListOfRVC5() throws Exception {
         String tenantId = "ABC";
-        String tableDDL = "CREATE TABLE t (tenantId varchar(5) NOT NULL, pk2 
varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key 
(tenantId,pk2,pk3)) SALT_BUCKETS=4";
-        createTestTable(getUrl(), tableDDL, null, nextTimestamp());
+        String tableName = generateUniqueName();
+        String tableDDL = "CREATE TABLE " + tableName + " (tenantId varchar(5) 
NOT NULL, pk2 varchar(5) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint 
pk primary key (tenantId,pk2,pk3)) SALT_BUCKETS=4";
+        createTestTable(getUrl(), tableDDL, null, null);
 
         Connection conn = nextConnection(getUrl());
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY pk2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY 
pk2");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo3");
         stmt.setInt(3, 3);
@@ -1097,21 +1040,22 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test 
     public void testInListOfRVCColumnValuesSmallerLengthThanSchema() throws 
Exception {
         String tenantId = "ABC";
-        String tableDDL = "CREATE TABLE t (tenantId char(15) NOT NULL, pk2 
char(15) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key 
(tenantId,pk2,pk3))";
-        createTestTable(getUrl(), tableDDL, null, nextTimestamp());
+        String tableName = generateUniqueName();
+        String tableDDL = "CREATE TABLE " + tableName + " (tenantId char(15) 
NOT NULL, pk2 char(15) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk 
primary key (tenantId,pk2,pk3))";
+        createTestTable(getUrl(), tableDDL, null, null);
 
         Connection conn = nextConnection(getUrl());
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'hel1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'hel2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'hel3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'hel4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'hel5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'hel1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'hel2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'hel3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'hel4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'hel5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         //order by needed on the query to make the order of rows returned 
deterministic.
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY PK2");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) IN ((?, ?, ?), (?, ?, ?)) ORDER BY 
PK2");
         stmt.setString(1, tenantId);
         stmt.setString(2, "hel3");
         stmt.setInt(3, 3);
@@ -1141,28 +1085,29 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     
     private void testRVCWithComparisonOps(boolean columnValueLengthSmaller) 
throws Exception {
         String tenantId = "ABC";
-        String tableDDLFormat = "CREATE TABLE t (tenantId char(%s) NOT NULL, 
pk2 char(%s) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary 
key (tenantId,pk2,pk3))";
+        String tableName = generateUniqueName();
+        String tableDDLFormat = "CREATE TABLE " + tableName + " (tenantId 
char(%s) NOT NULL, pk2 char(%s) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER 
constraint pk primary key (tenantId,pk2,pk3))";
         String tableDDL;
         if (columnValueLengthSmaller) {
             tableDDL = String.format(tableDDLFormat, 15, 15);
         } else {
             tableDDL = String.format(tableDDLFormat, 3, 5);
         }
-        createTestTable(getUrl(), tableDDL, null, nextTimestamp());
+        createTestTable(getUrl(), tableDDL, null, null);
 
         Connection conn = nextConnection(getUrl());
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo1', 1, 1)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo2', 2, 2)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo3', 3, 3)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo4', 4, 4)");
-        conn.createStatement().executeUpdate("upsert into t (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo5', 5, 5)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo1', 1, 1)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo2', 2, 2)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo3', 3, 3)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo4', 4, 4)");
+        conn.createStatement().executeUpdate("upsert into " + tableName + " 
(tenantId, pk2, pk3, c1) values ('ABC', 'helo5', 5, 5)");
         conn.commit();
         conn.close();
 
         conn = nextConnection(getUrl());
         
         // >
-        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from t 
WHERE (tenantId, pk2, pk3) > (?, ?, ?)");
+        PreparedStatement stmt = conn.prepareStatement("select pk2, pk3 from " 
+ tableName + " WHERE (tenantId, pk2, pk3) > (?, ?, ?)");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo3");
         stmt.setInt(3, 3);
@@ -1177,7 +1122,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         assertFalse(rs.next());
         
         // >=
-        stmt = conn.prepareStatement("select pk2, pk3 from t WHERE (tenantId, 
pk2, pk3) >= (?, ?, ?)");
+        stmt = conn.prepareStatement("select pk2, pk3 from " + tableName + " 
WHERE (tenantId, pk2, pk3) >= (?, ?, ?)");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo4");
         stmt.setInt(3, 4);
@@ -1192,7 +1137,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         assertFalse(rs.next());
         
         // <
-        stmt = conn.prepareStatement("select pk2, pk3 from t WHERE (tenantId, 
pk2, pk3) < (?, ?, ?)");
+        stmt = conn.prepareStatement("select pk2, pk3 from " + tableName + " 
WHERE (tenantId, pk2, pk3) < (?, ?, ?)");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo2");
         stmt.setInt(3, 2);
@@ -1204,7 +1149,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         assertFalse(rs.next());
         
         // <=
-        stmt = conn.prepareStatement("select pk2, pk3 from t WHERE (tenantId, 
pk2, pk3) <= (?, ?, ?)");
+        stmt = conn.prepareStatement("select pk2, pk3 from " + tableName + " 
WHERE (tenantId, pk2, pk3) <= (?, ?, ?)");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo2");
         stmt.setInt(3, 2);
@@ -1219,7 +1164,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         assertFalse(rs.next());
         
         // =
-        stmt = conn.prepareStatement("select pk2, pk3 from t WHERE (tenantId, 
pk2, pk3) = (?, ?, ?)");
+        stmt = conn.prepareStatement("select pk2, pk3 from " + tableName + " 
WHERE (tenantId, pk2, pk3) = (?, ?, ?)");
         stmt.setString(1, tenantId);
         stmt.setString(2, "helo4");
         stmt.setInt(3, 4);
@@ -1233,7 +1178,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testForceSkipScan() throws Exception {
-        String tempTableWithCompositePK = "TEMP_TABLE_COMPOSITE_PK";
+        String tempTableWithCompositePK = generateUniqueName();
         Connection conn = nextConnection(getUrl());
         try {
             conn.createStatement().execute("CREATE TABLE " + 
tempTableWithCompositePK
@@ -1275,7 +1220,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
 
             assertFalse(rs.next());
 
-            String plan = "CLIENT PARALLEL 4-WAY SKIP SCAN ON 12 KEYS OVER 
TEMP_TABLE_COMPOSITE_PK [0,2] - [3,4]\n" +
+            String plan = "CLIENT PARALLEL 4-WAY SKIP SCAN ON 12 KEYS OVER " + 
tempTableWithCompositePK + " [0,2] - [3,4]\n" +
                           "CLIENT MERGE SORT";
             String explainQuery = "EXPLAIN " + query;
             rs = conn.createStatement().executeQuery(explainQuery);
@@ -1289,7 +1234,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testComparisonAgainstRVCCombinedWithOrAnd_1() throws Exception 
{
        String tableDDL = "CREATE TABLE RVC1 (tenantId char(15) NOT NULL, pk2 
char(15) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary key 
(tenantId,pk2,pk3)) SALT_BUCKETS = 4";
-        createTestTable(getUrl(), tableDDL, null, nextTimestamp());
+        createTestTable(getUrl(), tableDDL, null, null);
 
         Connection conn = nextConnection(getUrl());
         conn.createStatement().executeUpdate("upsert into RVC1 (tenantId, pk2, 
pk3, c1) values ('ABC', 'helo1', 1, 1)");
@@ -1339,9 +1284,9 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         String tenantId = "ABC";
         String tenantSpecificUrl = getUrl() + ";" + 
PhoenixRuntime.TENANT_ID_ATTRIB + '=' + tenantId;
         String baseTableDDL = "CREATE TABLE RVC2 (tenant_id char(15) NOT NULL, 
pk2 char(15) NOT NULL, pk3 INTEGER NOT NULL, c1 INTEGER constraint pk primary 
key (tenant_id,pk2,pk3)) MULTI_TENANT=true, SALT_BUCKETS = 4";
-        createTestTable(getUrl(), baseTableDDL, null, nextTimestamp());
+        createTestTable(getUrl(), baseTableDDL, null, null);
         String tenantTableDDL = "CREATE VIEW t_view AS SELECT * FROM RVC2";
-        createTestTable(tenantSpecificUrl, tenantTableDDL, null, 
nextTimestamp());
+        createTestTable(tenantSpecificUrl, tenantTableDDL, null, null);
 
         Connection conn = nextConnection(tenantSpecificUrl);
         conn.createStatement().executeUpdate("upsert into t_view (pk2, pk3, 
c1) values ('helo1', 1, 1)");
@@ -1432,7 +1377,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testCountDistinct1() throws Exception {
         Connection conn = nextConnection(getUrl());
-        String tableName = "testCountDistinct1rvc";
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE " + tableName + " (region_name VARCHAR 
PRIMARY KEY, a INTEGER, b INTEGER)";
         conn.createStatement().execute(ddl);
         
@@ -1456,7 +1401,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testCountDistinct2() throws Exception {
         Connection conn = nextConnection(getUrl());
-        String tableName = "testCountDistinct2rvc";
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE  " + tableName + "  (region_name VARCHAR 
PRIMARY KEY, a VARCHAR, b VARCHAR)";
         conn.createStatement().execute(ddl);
         conn.commit();
@@ -1505,7 +1450,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testCountDistinct4() throws Exception {
         Connection conn = nextConnection(getUrl());
-        String tableName = "testCountDistinct4rvc";
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE  " + tableName + "  (region_name VARCHAR 
PRIMARY KEY, a VARCHAR, b VARCHAR)";
         conn.createStatement().execute(ddl);
         
@@ -1528,7 +1473,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testRVCRequiringExtractNodeClear() throws Exception {
         Connection conn = nextConnection(getUrl());
-        String tableName = "testRVCWithTrailingGT";
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE  " + tableName + "  (k1 VARCHAR, k2 
VARCHAR, k3 VARCHAR, k4 VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2,k3,k4))";
         conn.createStatement().execute(ddl);
         
@@ -1554,7 +1499,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
     @Test
     public void testRVCRequiringNoSkipScan() throws Exception {
         Connection conn = nextConnection(getUrl());
-        String tableName = "testRVCWithTrailingGT";
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE  " + tableName + "  (k1 VARCHAR, k2 
VARCHAR, k3 VARCHAR, k4 VARCHAR, CONSTRAINT pk PRIMARY KEY (k1,k2,k3,k4))";
         conn.createStatement().execute(ddl);
         
@@ -1601,7 +1546,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
         * Index's pks are (pk2, ... , pkn, pk1), n >= 3
         * RVC is (pk2, ... , pkn, pk1), n >= 3
         * 
-        * Expalin select * from t where (pk2, ... , pkn, pk1) > ('201', ..., 
'n01', '101') and pk[2-n] = '[2-n]03'
+        * Expalin select * from " + tableName + " where (pk2, ... , pkn, pk1) 
> ('201', ..., 'n01', '101') and pk[2-n] = '[2-n]03'
         * 
         * You will Get "DEGENERATE SCAN OVER TABLE_NAME"
         * 
@@ -1610,7 +1555,7 @@ public class RowValueConstructorIT extends 
BaseClientManagedTimeIT {
        @Test
        public void testRVCLastPkIsTable1stPkIndex() throws Exception {
                Connection conn = nextConnection(getUrl());
-               String tableName = "t";
+               String tableName = generateUniqueName();
                String ddl = "CREATE TABLE " + tableName 
                                + " (k1 VARCHAR, k2 VARCHAR, k3 VARCHAR, k4 
VARCHAR,"
                                + " CONSTRAINT pk PRIMARY KEY (k1,k2,k3,k4))";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fbb9a1/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
index 49aef9b..abc8411 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/StoreNullsIT.java
@@ -205,6 +205,7 @@ public class StoreNullsIT extends ParallelStatsDisabledIT {
             
             rs.close();
             historicalStmt.close();
+            conn.close();
             historicalConn.close();
         }
 
@@ -244,6 +245,9 @@ public class StoreNullsIT extends ParallelStatsDisabledIT {
             rs = historicalStmt.executeQuery("SELECT name FROM " + 
dataTableName + " WHERE id = 1");
             assertFalse(rs.next());
             rs.close();
+            conn.close();
+            historicalStmt.close();
+            historicalConn.close();
         }
     }
 
@@ -263,51 +267,28 @@ public class StoreNullsIT extends ParallelStatsDisabledIT 
{
         String tableName = generateUniqueName();
         String indexName = generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES);
-        long ts = 1000;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);     
         conn.createStatement().execute("CREATE TABLE " + tableName + "(k1 
CHAR(2) NOT NULL, k2 CHAR(2) NOT NULL, ts TIMESTAMP, V VARCHAR, V2 VARCHAR, "
                 + "CONSTRAINT pk PRIMARY KEY (k1,k2)) STORE_NULLS=" + 
storeNulls + (columnEncoded ? "" : ",COLUMN_ENCODED_BYTES=0"));
-        conn.close();
-
-        ts = 1010;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
-        conn = DriverManager.getConnection(getUrl(), props);
         conn.createStatement().execute("CREATE INDEX " + indexName + " ON " + 
tableName + "(k2,k1,ts) INCLUDE (V, v2)");
-        conn.close();
-        
-        ts = 1020;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
-        conn = DriverManager.getConnection(getUrl(), props);        
         PreparedStatement stmt = conn.prepareStatement("UPSERT INTO " + 
tableName + " VALUES('aa','aa',?, '0')");
         stmt.setTimestamp(1, new Timestamp(1000L));
         stmt.executeUpdate();
         conn.commit();
-        conn.close();
         
         Timestamp expectedTimestamp;
-        ts = 1030;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
-        conn = DriverManager.getConnection(getUrl(), props);
         stmt = conn.prepareStatement("UPSERT INTO " + tableName + " 
VALUES('aa','aa',?, null)");
         expectedTimestamp = null;
         stmt.setTimestamp(1, expectedTimestamp);
         stmt.executeUpdate();
         conn.commit();
         
-        ts = 1040;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
-        conn = DriverManager.getConnection(getUrl(), props);
         stmt = conn.prepareStatement("UPSERT INTO " + tableName + " 
VALUES('aa','aa',?, null)");
         expectedTimestamp = null;
         stmt.setTimestamp(1, expectedTimestamp);
         stmt.executeUpdate();
         conn.commit();
 
-        ts = 1050;
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
-        conn = DriverManager.getConnection(getUrl(), props);
-        
         
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(tableName)));
         
TestUtil.dumpTable(conn.unwrap(PhoenixConnection.class).getQueryServices().getTable(Bytes.toBytes(indexName)));
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fbb9a1/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantIdTypeIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantIdTypeIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantIdTypeIT.java
index 73b3212..a0c13a9 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantIdTypeIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/TenantIdTypeIT.java
@@ -45,14 +45,11 @@ import com.google.common.collect.Lists;
 public class TenantIdTypeIT extends ParallelStatsDisabledIT {
 
     private Connection regularConnection(String url) throws SQLException {
-        Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
-        return DriverManager.getConnection(url, props);
+        return DriverManager.getConnection(url);
     }
 
     private Connection tenantConnection(String url) throws SQLException {
         Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
         String tenantIdProperty = this.tenantId.replaceAll("\'", "");
         props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantIdProperty);
         return DriverManager.getConnection(url, props);
@@ -60,7 +57,6 @@ public class TenantIdTypeIT extends ParallelStatsDisabledIT {
 
     private Connection inconvertibleConnection(String url) throws SQLException 
{
         Properties props = new Properties();
-        props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(nextTimestamp()));
         String tenantIdProperty = "ABigOlString";
         props.setProperty(PhoenixRuntime.TENANT_ID_ATTRIB, tenantIdProperty);
         return DriverManager.getConnection(url, props);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/06fbb9a1/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
index 5ae11bf..a9db576 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableIT.java
@@ -32,9 +32,11 @@ import java.sql.SQLException;
 import java.util.Properties;
 
 import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
+import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.QueryUtil;
+import org.apache.phoenix.util.SchemaUtil;
 import org.junit.Test;
 
 
@@ -42,12 +44,16 @@ import org.junit.Test;
  * Tests for table with transparent salting.
  */
 
-public class SaltedTableIT extends BaseClientManagedTimeIT {
+public class SaltedTableIT extends ParallelStatsDisabledIT {
 
-    private static void initTableValues(byte[][] splits, long ts) throws 
Exception {
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ ts;
+       private static String getUniqueTableName() {
+               return SchemaUtil.getTableName(generateUniqueName(), 
generateUniqueName());
+       }
+       
+    private static String initTableValues(byte[][] splits) throws Exception {
+       String tableName = getUniqueTableName();        
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         
         // Rows we inserted:
         // 1ab123abc111
@@ -58,8 +64,8 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
         // 4abc123jkl444
         try {
             // Upsert with no column specifies.
-            ensureTableCreated(getUrl(), TABLE_WITH_SALTING, 
TABLE_WITH_SALTING, splits, ts-2, null);
-            String query = "UPSERT INTO " + TABLE_WITH_SALTING + " 
VALUES(?,?,?,?,?)";
+            ensureTableCreated(getUrl(), tableName, TABLE_WITH_SALTING, 
splits, null, null);
+            String query = "UPSERT INTO " + tableName + " VALUES(?,?,?,?,?)";
             PreparedStatement stmt = conn.prepareStatement(query);
             stmt.setInt(1, 1);
             stmt.setString(2, "ab");
@@ -78,7 +84,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             conn.commit();
             
             // Test upsert when statement explicitly specifies the columns to 
upsert into.
-            query = "UPSERT INTO " + TABLE_WITH_SALTING +
+            query = "UPSERT INTO " + tableName +
                     " (a_integer, a_string, a_id, b_string, b_integer) " + 
                     " VALUES(?,?,?,?,?)";
             stmt = conn.prepareStatement(query);
@@ -100,7 +106,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             conn.commit();
             
             // Test upsert when order of column is shuffled.
-            query = "UPSERT INTO " + TABLE_WITH_SALTING +
+            query = "UPSERT INTO " + tableName +
                     " (a_string, a_integer, a_id, b_string, b_integer) " + 
                     " VALUES(?,?,?,?,?)";
             stmt = conn.prepareStatement(query);
@@ -122,16 +128,15 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
         } finally {
             conn.close();
         }
+        return tableName;
     }
 
     @Test
     public void testTableWithInvalidBucketNumber() throws Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            String query = "create table salted_table (a_integer integer not 
null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS = 257";
+            String query = "create table " + getUniqueTableName() + " 
(a_integer integer not null CONSTRAINT pk PRIMARY KEY (a_integer)) SALT_BUCKETS 
= 257";
             PreparedStatement stmt = conn.prepareStatement(query);
             stmt.execute();
             fail("Should have caught exception");
@@ -145,8 +150,8 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
     @Test
     public void testTableWithSplit() throws Exception {
         try {
-            createTestTable(getUrl(), "create table salted_table (a_integer 
integer not null primary key) SALT_BUCKETS = 4",
-                    new byte[][] {{1}, {2,3}, {2,5}, {3}}, nextTimestamp());
+            createTestTable(getUrl(), "create table " + getUniqueTableName() + 
" (a_integer integer not null primary key) SALT_BUCKETS = 4",
+                    new byte[][] {{1}, {2,3}, {2,5}, {3}}, null);
             fail("Should have caught exception");
         } catch (SQLException e) {
             assertTrue(e.getMessage(), e.getMessage().contains("ERROR 1022 
(42Y81): Should not specify split points on salted table with default row key 
order."));
@@ -155,14 +160,12 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testSelectValueNoWhereClause() throws Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             
-            String query = "SELECT * FROM " + TABLE_WITH_SALTING;
+            String query = "SELECT * FROM " + tableName;
             PreparedStatement statement = conn.prepareStatement(query);
             ResultSet rs = statement.executeQuery();
             
@@ -216,18 +219,16 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testSelectValueWithFullyQualifiedWhereClause() throws 
Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             String query;
             PreparedStatement stmt;
             ResultSet rs;
             
             // Variable length slot with bounded ranges.
-            query = "SELECT * FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT * FROM " + tableName + 
                     " WHERE a_integer = 1 AND a_string >= 'ab' AND a_string < 
'de' AND a_id = '123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -240,7 +241,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
 
             // all single slots with one value.
-            query = "SELECT * FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT * FROM " + tableName + 
                     " WHERE a_integer = 1 AND a_string = 'ab' AND a_id = 
'123'";
             stmt = conn.prepareStatement(query);
             
@@ -254,7 +255,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // all single slots with multiple values.
-            query = "SELECT * FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT * FROM " + tableName + 
                     " WHERE a_integer in (2, 4) AND a_string = 'abc' AND a_id 
= '123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -274,7 +275,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertEquals(444, rs.getInt(5));
             assertFalse(rs.next());
             
-            query = "SELECT a_integer, a_string FROM " + TABLE_WITH_SALTING +
+            query = "SELECT a_integer, a_string FROM " + tableName +
                     " WHERE a_integer in (1,2,3,4) AND a_string in ('a', 
'abc', 'de') AND a_id = '123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -297,7 +298,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // fixed length slot with bounded ranges.
-            query = "SELECT a_string, a_id FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT a_string, a_id FROM " + tableName + 
                     " WHERE a_integer > 1 AND a_integer < 4 AND a_string = 
'abc' AND a_id = '123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -311,7 +312,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // fixed length slot with unbound ranges.
-            query = "SELECT b_string, b_integer FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT b_string, b_integer FROM " + tableName + 
                     " WHERE a_integer > 1 AND a_string = 'abc' AND a_id = 
'123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -329,7 +330,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // Variable length slot with unbounded ranges.
-            query = "SELECT * FROM " + TABLE_WITH_SALTING + 
+            query = "SELECT * FROM " + tableName + 
                     " WHERE a_integer = 1 AND a_string > 'ab' AND a_id = 
'123'";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
@@ -348,15 +349,13 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testSelectValueWithNotFullyQualifiedWhereClause() throws 
Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             
             // Where without fully qualified key, point query.
-            String query = "SELECT * FROM " + TABLE_WITH_SALTING + " WHERE 
a_integer = ? AND a_string = ?";
+            String query = "SELECT * FROM " + tableName + " WHERE a_integer = 
? AND a_string = ?";
             PreparedStatement stmt = conn.prepareStatement(query);
             
             stmt.setInt(1, 1);
@@ -371,7 +370,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // Where without fully qualified key, range query.
-            query = "SELECT * FROM " + TABLE_WITH_SALTING + " WHERE a_integer 
>= 2";
+            query = "SELECT * FROM " + tableName + " WHERE a_integer >= 2";
             stmt = conn.prepareStatement(query);
             rs = stmt.executeQuery();
             assertTrue(rs.next());
@@ -397,7 +396,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertFalse(rs.next());
             
             // With point query.
-            query = "SELECT a_string FROM " + TABLE_WITH_SALTING + " WHERE 
a_string = ?";
+            query = "SELECT a_string FROM " + tableName + " WHERE a_string = 
?";
             stmt = conn.prepareStatement(query);
             stmt.setString(1, "de");
             rs = stmt.executeQuery();
@@ -405,7 +404,7 @@ public class SaltedTableIT extends BaseClientManagedTimeIT {
             assertEquals("de", rs.getString(1));
             assertFalse(rs.next());
             
-            query = "SELECT a_id FROM " + TABLE_WITH_SALTING + " WHERE a_id = 
?";
+            query = "SELECT a_id FROM " + tableName + " WHERE a_id = ?";
             stmt = conn.prepareStatement(query);
             stmt.setString(1, "456");
             rs = stmt.executeQuery();
@@ -419,14 +418,12 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testSelectWithGroupBy() throws Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             
-            String query = "SELECT a_integer FROM " + TABLE_WITH_SALTING + " 
GROUP BY a_integer";
+            String query = "SELECT a_integer FROM " + tableName + " GROUP BY 
a_integer";
             PreparedStatement stmt = conn.prepareStatement(query);
             ResultSet rs = stmt.executeQuery();
             int count = 0;
@@ -441,14 +438,12 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
 
     @Test
     public void testLimitScan() throws Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             
-            String query = "SELECT a_integer FROM " + TABLE_WITH_SALTING + " 
WHERE a_string='abc' LIMIT 1";
+            String query = "SELECT a_integer FROM " + tableName + " WHERE 
a_string='abc' LIMIT 1";
             PreparedStatement stmt = conn.prepareStatement(query);
             ResultSet rs = stmt.executeQuery();
             assertTrue(rs.next());
@@ -461,18 +456,16 @@ public class SaltedTableIT extends 
BaseClientManagedTimeIT {
     
     @Test
     public void testSelectWithOrderByRowKey() throws Exception {
-        long ts = nextTimestamp();
-        String url = getUrl() + ";" + PhoenixRuntime.CURRENT_SCN_ATTRIB + "=" 
+ (ts + 5);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-        Connection conn = DriverManager.getConnection(url, props);
+        Connection conn = DriverManager.getConnection(getUrl(), props);
         try {
-            initTableValues(null, ts);
+            String tableName = initTableValues(null);
             
-            String query = "SELECT * FROM " + TABLE_WITH_SALTING + " ORDER  BY 
 a_integer, a_string, a_id";
+            String query = "SELECT * FROM " + tableName + " ORDER  BY  
a_integer, a_string, a_id";
             PreparedStatement statement = conn.prepareStatement(query);
             ResultSet explainPlan = statement.executeQuery("EXPLAIN " + query);
             // Confirm that ORDER BY in row key order will be optimized out 
for salted table
-            assertEquals("CLIENT PARALLEL 4-WAY FULL SCAN OVER 
TABLE_WITH_SALTING\n" + 
+            assertEquals("CLIENT PARALLEL 4-WAY FULL SCAN OVER " + tableName + 
"\n" + 
                     "CLIENT MERGE SORT", 
QueryUtil.getExplainPlan(explainPlan));
             ResultSet rs = statement.executeQuery();
             

Reply via email to