Repository: phoenix
Updated Branches:
  refs/heads/master 16f0da3d9 -> bebb5cedf


http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
index e5dfb0d..0a89eff 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/MutableIndexIT.java
@@ -102,8 +102,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
                conn.setAutoCommit(false);
-                       String tableName = "TBL_" + generateRandomString();
-                       String indexName = "IDX_" + generateRandomString();
+                       String tableName = "TBL_" + generateUniqueName();
+                       String indexName = "IDX_" + generateUniqueName();
                        String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
                        String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
 
@@ -200,8 +200,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     @Test
     public void testCoveredColumns() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
                String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
                String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
@@ -310,8 +310,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     @Test
     public void testCompoundIndexKey() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
                String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
                String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
@@ -429,8 +429,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     @Test
     public void testMultipleUpdatesToSingleRow() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
                String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
                String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
@@ -513,8 +513,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     @Test
     public void testUpsertingNullForIndexedColumns() throws Exception {
        Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
                String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         String testTableName = tableName + "_" + System.currentTimeMillis();
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
@@ -599,7 +599,7 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     public void testAlterTableWithImmutability() throws Exception {
         String query;
         ResultSet rs;
-               String tableName = "TBL_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
                String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
 
 
@@ -638,8 +638,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
         props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, 
Integer.toString(2));
         props.put(QueryServices.FORCE_ROW_KEY_ORDER_ATTRIB, 
Boolean.toString(false));
         Connection conn1 = DriverManager.getConnection(getUrl());
-               String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
                HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
         dropTable(admin, conn1);
         try{
@@ -660,8 +660,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
 
     private void dropTable(HBaseAdmin admin, Connection conn) throws 
SQLException, IOException {
 
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
         conn.createStatement().execute("DROP TABLE IF EXISTS "+ tableName);
         if(admin.tableExists(tableName)) {
             admin.disableTable(TableName.valueOf(tableName));
@@ -690,8 +690,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     public void testIndexHalfStoreFileReader() throws Exception {
         Connection conn1 = DriverManager.getConnection(getUrl());
         HBaseAdmin admin = driver.getConnectionQueryServices(getUrl(), 
TestUtil.TEST_PROPERTIES).getAdmin();
-               String tableName = "TBL_" + generateRandomString();
-               String indexName = "IDX_" + generateRandomString();
+               String tableName = "TBL_" + generateUniqueName();
+               String indexName = "IDX_" + generateUniqueName();
         try {
             dropTable(admin, conn1);
             createBaseTable(conn1, tableName, "('e')");
@@ -836,8 +836,8 @@ public class MutableIndexIT extends ParallelStatsDisabledIT 
{
     
   @Test
   public void testTenantSpecificConnection() throws Exception {
-         String tableName = "TBL_" + generateRandomString();
-         String indexName = "IDX_" + generateRandomString();
+         String tableName = "TBL_" + generateUniqueName();
+         String indexName = "IDX_" + generateUniqueName();
          String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
          Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
       try (Connection conn = DriverManager.getConnection(getUrl(), props)) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java
index ebdd565..5bf0c58 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/SaltedIndexIT.java
@@ -73,8 +73,8 @@ public class SaltedIndexIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testMutableTableIndexMaintanenceSaltedSalted() throws 
Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IND_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
         String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
         String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         testMutableTableIndexMaintanence(tableName, fullTableName, indexName, 
fullIndexName, TABLE_SPLITS, INDEX_SPLITS);
@@ -84,8 +84,8 @@ public class SaltedIndexIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testMutableTableIndexMaintanenceSalted() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IND_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
         String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
         String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         testMutableTableIndexMaintanence(tableName, fullTableName, indexName, 
fullIndexName, null, INDEX_SPLITS);
@@ -95,8 +95,8 @@ public class SaltedIndexIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testMutableTableIndexMaintanenceUnsalted() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IND_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
         String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
         String fullIndexName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, indexName);
         testMutableTableIndexMaintanence(tableName, fullTableName, indexName, 
fullIndexName, null, null);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
index 7bd1478..99a8b4d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/ViewIndexIT.java
@@ -92,10 +92,10 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
 
     @Test
     public void testDeleteViewIndexSequences() throws Exception {
-        String schemaName = generateRandomString();
-        String tableName = schemaName + "." + generateRandomString();
-        String indexName = "IND_" + generateRandomString();
-        String VIEW_NAME = "VIEW_" + generateRandomString();
+        String schemaName = generateUniqueName();
+        String tableName = schemaName + "." + generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
+        String VIEW_NAME = "VIEW_" + generateUniqueName();
         String viewName = schemaName + "." + VIEW_NAME;
 
         createBaseTable(schemaName, tableName, false, null, null);
@@ -120,10 +120,10 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testMultiTenantViewLocalIndex() throws Exception {
-        String schemaName = generateRandomString();
-        String tableName =  generateRandomString();
-        String indexName = "IND_" + generateRandomString();
-        String VIEW_NAME = "VIEW_" + generateRandomString();
+        String schemaName = generateUniqueName();
+        String tableName =  generateUniqueName();
+        String indexName = "IND_" + generateUniqueName();
+        String VIEW_NAME = "VIEW_" + generateUniqueName();
         createBaseTable(schemaName, tableName, true, null, null);
         Connection conn = DriverManager.getConnection(getUrl());
         PreparedStatement stmt = conn.prepareStatement(
@@ -167,9 +167,9 @@ public class ViewIndexIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testCreatingIndexOnGlobalView() throws Exception {
-        String baseTable =  generateRandomString();
-        String globalView = generateRandomString();
-        String globalViewIdx =  generateRandomString();
+        String baseTable =  generateUniqueName();
+        String globalView = generateUniqueName();
+        String globalViewIdx =  generateUniqueName();
         try (Connection conn = DriverManager.getConnection(getUrl())) {
             conn.createStatement().execute("CREATE TABLE " + baseTable + " 
(TENANT_ID CHAR(15) NOT NULL, PK2 DATE NOT NULL, PK3 INTEGER NOT NULL, KV1 
VARCHAR, KV2 VARCHAR, KV3 CHAR(15) CONSTRAINT PK PRIMARY KEY(TENANT_ID, PK2 
ROW_TIMESTAMP, PK3)) MULTI_TENANT=true");
             conn.createStatement().execute("CREATE VIEW " + globalView + " AS 
SELECT * FROM " + baseTable);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
index 44ec7a5..3ffade0 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/MutableRollbackIT.java
@@ -77,11 +77,11 @@ public class MutableRollbackIT extends 
ParallelStatsDisabledIT {
     public void testRollbackOfUncommittedExistingKeyValueIndexUpdate() throws 
Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName1 = "TBL1_" + generateRandomString();
-        String indexName1 = "IDX1_" + generateRandomString();
+        String tableName1 = "TBL1_" + generateUniqueName();
+        String indexName1 = "IDX1_" + generateUniqueName();
         String fullTableName1 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName1);
-        String tableName2 = "TBL2_" + generateRandomString();
-        String indexName2 = "IDX2_" + generateRandomString();
+        String tableName2 = "TBL2_" + generateUniqueName();
+        String indexName2 = "IDX2_" + generateUniqueName();
         String fullTableName2 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName2);
         conn.setAutoCommit(false);
         try {
@@ -209,11 +209,11 @@ public class MutableRollbackIT extends 
ParallelStatsDisabledIT {
 
        @Test
     public void testRollbackOfUncommittedExistingRowKeyIndexUpdate() throws 
Exception {
-        String tableName1 = "TBL1_" + generateRandomString();
-        String indexName1 = "IDX1_" + generateRandomString();
+        String tableName1 = "TBL1_" + generateUniqueName();
+        String indexName1 = "IDX1_" + generateUniqueName();
         String fullTableName1 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName1);
-        String tableName2 = "TBL2_" + generateRandomString();
-        String indexName2 = "IDX2_" + generateRandomString();
+        String tableName2 = "TBL2_" + generateUniqueName();
+        String indexName2 = "IDX2_" + generateUniqueName();
         String fullTableName2 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName2);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -352,10 +352,10 @@ public class MutableRollbackIT extends 
ParallelStatsDisabledIT {
     public void testMultiRollbackOfUncommittedExistingRowKeyIndexUpdate() 
throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName1 = "TBL1_" + generateRandomString();
-        String indexName1 = "IDX1_" + generateRandomString();
+        String tableName1 = "TBL1_" + generateUniqueName();
+        String indexName1 = "IDX1_" + generateUniqueName();
         String fullTableName1 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName1);
-        String tableName2 = "TBL2_" + generateRandomString();
+        String tableName2 = "TBL2_" + generateUniqueName();
         conn.setAutoCommit(false);
         try {
             Statement stmt = conn.createStatement();
@@ -458,10 +458,10 @@ public class MutableRollbackIT extends 
ParallelStatsDisabledIT {
     public void testCheckpointAndRollback() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName1 = "TBL1_" + generateRandomString();
-        String indexName1 = "IDX1_" + generateRandomString();
+        String tableName1 = "TBL1_" + generateUniqueName();
+        String indexName1 = "IDX1_" + generateUniqueName();
         String fullTableName1 = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName1);
-        String tableName2 = "TBL2_" + generateRandomString();
+        String tableName2 = "TBL2_" + generateUniqueName();
         conn.setAutoCommit(false);
         try {
             Statement stmt = conn.createStatement();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/RollbackIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/RollbackIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/RollbackIT.java
index fb50548..5153a68 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/RollbackIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/index/txn/RollbackIT.java
@@ -76,8 +76,8 @@ public class RollbackIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testRollbackOfUncommittedKeyValueIndexInsert() throws 
Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
@@ -124,8 +124,8 @@ public class RollbackIT extends ParallelStatsDisabledIT {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = 
SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, tableName);
         try {
             Statement stmt = conn.createStatement();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java
index d680954..0b805c6 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableUpsertSelectIT.java
@@ -44,11 +44,11 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source = generateRandomString();
+            String source = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER)";
             createTestTable(getUrl(), ddl);
-            String target = generateRandomString();
+            String target = generateUniqueName();
             ddl = "CREATE TABLE IF NOT EXISTS " + target +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER) 
SALT_BUCKETS=4";
             createTestTable(getUrl(), ddl);
@@ -83,11 +83,11 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source = generateRandomString();
+            String source = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER) 
SALT_BUCKETS=4";
             createTestTable(getUrl(), ddl);
-            String target = generateRandomString();
+            String target = generateUniqueName();
             ddl = "CREATE TABLE IF NOT EXISTS " + target +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER)";
             createTestTable(getUrl(), ddl);
@@ -127,11 +127,11 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source = generateRandomString();
+            String source = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER) 
SALT_BUCKETS=4";
             createTestTable(getUrl(), ddl);
-            String target = generateRandomString();
+            String target = generateUniqueName();
             ddl = "CREATE TABLE IF NOT EXISTS " + target +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col INTEGER) 
SALT_BUCKETS=4";
             createTestTable(getUrl(), ddl);
@@ -166,7 +166,7 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source = generateRandomString();
+            String source = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source +
                     " (pk VARCHAR NOT NULL PRIMARY KEY, col1 INTEGER, col2 
INTEGER) SALT_BUCKETS=4";
             createTestTable(getUrl(), ddl);
@@ -200,7 +200,7 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source1 = generateRandomString();
+            String source1 = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source1 +
                     " (pk1 varchar NULL, pk2 varchar NULL, pk3 integer NOT 
NULL, col1 INTEGER" + 
                     " CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) 
SALT_BUCKETS=4";
@@ -241,7 +241,7 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
-            String source1 = generateRandomString();
+            String source1 = generateUniqueName();
             String ddl = "CREATE TABLE IF NOT EXISTS " + source1 +
                     " (pk1 varchar NULL, pk2 varchar NULL, pk3 integer NOT 
NULL, col1 INTEGER" +
                     " CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) 
SALT_BUCKETS=4";
@@ -258,7 +258,7 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
             }
             conn.commit();
 
-            String source2 = generateRandomString();
+            String source2 = generateUniqueName();
             String ddl2 = "CREATE TABLE IF NOT EXISTS " + source2 +
                     " (pk1 varchar NULL, pk2 varchar NULL, pk3 integer NOT 
NULL, col1 INTEGER" +
                     " CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) 
SALT_BUCKETS=4";
@@ -275,7 +275,7 @@ public class SaltedTableUpsertSelectIT extends 
ParallelStatsDisabledIT {
             }
             conn.commit();
 
-            String dest = generateRandomString();
+            String dest = generateUniqueName();
             String ddl3 = "CREATE TABLE IF NOT EXISTS " + dest +
                     " (pk1 varchar NULL, pk2 varchar NULL, pk3 integer NOT 
NULL, col1 INTEGER" +
                     " CONSTRAINT pk PRIMARY KEY (pk1, pk2, pk3)) 
SALT_BUCKETS=4";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
index c3f331b..fa43876 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/salted/SaltedTableVarLengthRowKeyIT.java
@@ -36,7 +36,7 @@ import org.junit.Test;
 
 public class SaltedTableVarLengthRowKeyIT extends ParallelStatsDisabledIT {
 
-    private static final String TEST_TABLE = generateRandomString();
+    private static final String TEST_TABLE = generateUniqueName();
 
     private static void initTableValues() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/iterate/PhoenixQueryTimeoutIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/PhoenixQueryTimeoutIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/PhoenixQueryTimeoutIT.java
index 7b3b286..8fcdebb 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/PhoenixQueryTimeoutIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/PhoenixQueryTimeoutIT.java
@@ -37,7 +37,7 @@ import org.junit.Test;
  */
 public class PhoenixQueryTimeoutIT extends ParallelStatsDisabledIT {
 
-    private static final String QUERY_TIMEOUT_TEST = generateRandomString();
+    private static final String QUERY_TIMEOUT_TEST = generateUniqueName();
 
     @Test
     /**

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorIT.java
index ba35f4e..47261ac 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/iterate/RoundRobinResultIteratorIT.java
@@ -78,7 +78,7 @@ public class RoundRobinResultIteratorIT extends 
ParallelStatsDisabledIT {
 
     @Test
     public void testRoundRobinAfterTableSplit() throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         byte[] tableNameBytes = Bytes.toBytes(tableName);
         int numRows = setupTableForSplit(tableName);
         Connection conn = DriverManager.getConnection(getUrl());
@@ -128,7 +128,7 @@ public class RoundRobinResultIteratorIT extends 
ParallelStatsDisabledIT {
     }
 
     private void testSelectAllRowsWithDifferentFetchSizes(boolean salted) 
throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         int numRows = 9;
         Set<String> expectedKeys = 
Collections.unmodifiableSet(createTableAndInsertRows(tableName, numRows, 
salted, false));
         Connection conn = DriverManager.getConnection(getUrl());
@@ -152,7 +152,7 @@ public class RoundRobinResultIteratorIT extends 
ParallelStatsDisabledIT {
     }
 
     private void testSelectRowsWithFilterAndDifferentFetchSizes(boolean 
salted) throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         int numRows = 6;
         Set<String> insertedKeys = createTableAndInsertRows(tableName, 
numRows, salted, false);
         Connection conn = DriverManager.getConnection(getUrl());
@@ -205,7 +205,7 @@ public class RoundRobinResultIteratorIT extends 
ParallelStatsDisabledIT {
 
     @Test
     public void testFetchSizesAndRVCExpression() throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         Set<String> insertedKeys = 
Collections.unmodifiableSet(createTableAndInsertRows(tableName, 4, false, 
false));
         Connection conn = DriverManager.getConnection(getUrl());
         PreparedStatement stmt = conn.prepareStatement("SELECT K FROM " + 
tableName + " WHERE (K, V)  > (?, ?)");
@@ -280,7 +280,7 @@ public class RoundRobinResultIteratorIT extends 
ParallelStatsDisabledIT {
         int insertedRowsA = 10;
         int insertedRowsB = 5;
         int insertedRowsC = 7;
-        String baseTableName = generateRandomString();
+        String baseTableName = generateUniqueName();
         String tableA = "TABLEA" + baseTableName;
         String tableB = "TABLEB" + baseTableName;
         String tableC = "TABLEC" + baseTableName;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
index 56f9f4b..930f454 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheIT.java
@@ -76,7 +76,7 @@ public class UpdateCacheIT extends ParallelStatsDisabledIT {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
             conn.createStatement().execute(
-            "create table " + fullTableName + TEST_TABLE_SCHEMA);
+            "create table " + fullTableName + TestUtil.TEST_TABLE_SCHEMA);
         }
     }
     
@@ -84,33 +84,33 @@ public class UpdateCacheIT extends ParallelStatsDisabledIT {
     public void testUpdateCacheForTxnTable() throws Exception {
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + TRANSACTIONAL_DATA_TABLE;
         Connection conn = DriverManager.getConnection(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
-        conn.createStatement().execute("create table " + fullTableName + 
TEST_TABLE_SCHEMA + "TRANSACTIONAL=true");
+        conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + "TRANSACTIONAL=true");
         helpTestUpdateCache(fullTableName, null, new int[] {1, 1});
     }
     
     @Test
     public void testUpdateCacheForNonTxnTable() throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + tableName;
         Connection conn = DriverManager.getConnection(getUrl(), 
PropertiesUtil.deepCopy(TEST_PROPERTIES));
-        conn.createStatement().execute("create table " + fullTableName + 
TEST_TABLE_SCHEMA);
+        conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA);
         helpTestUpdateCache(fullTableName, null, new int[] {1, 3});
     }
        
     @Test
     public void testUpdateCacheForNonTxnSystemTable() throws Exception {
-        String fullTableName = QueryConstants.SYSTEM_SCHEMA_NAME + 
QueryConstants.NAME_SEPARATOR + generateRandomString();
+        String fullTableName = QueryConstants.SYSTEM_SCHEMA_NAME + 
QueryConstants.NAME_SEPARATOR + generateUniqueName();
         setupSystemTable(fullTableName);
         helpTestUpdateCache(fullTableName, null, new int[] {0, 0});
     }
     
     @Test
     public void testUpdateCacheForNeverUpdatedTable() throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + tableName;
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-            conn.createStatement().execute("create table " + fullTableName + 
TEST_TABLE_SCHEMA);
+            conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA);
             conn.createStatement().execute(
             "alter table " + fullTableName + " SET 
UPDATE_CACHE_FREQUENCY=NEVER");
         }
@@ -119,20 +119,20 @@ public class UpdateCacheIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testUpdateCacheForAlwaysUpdatedTable() throws Exception {
-        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateRandomString();
+        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=always");
+            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=always");
         }
         helpTestUpdateCache(fullTableName, null, new int[] {1, 3});
     }
     
     @Test
     public void testUpdateCacheForTimeLimitedUpdateTable() throws Exception {
-        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateRandomString();
+        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=" + 10000);
+            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=" + 10000);
         }
         helpTestUpdateCache(fullTableName, null, new int[] {0, 0});
         Thread.sleep(10000);
@@ -141,10 +141,10 @@ public class UpdateCacheIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testUpdateCacheForChangingUpdateTable() throws Exception {
-        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateRandomString();
+        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
-            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=never");
+            conn.createStatement().execute("CREATE TABLE " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA + " UPDATE_CACHE_FREQUENCY=never");
         }
         helpTestUpdateCache(fullTableName, null, new int[] {0, 0});
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheWithScnIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheWithScnIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheWithScnIT.java
index 75f67b3..b0d672d 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheWithScnIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/rpc/UpdateCacheWithScnIT.java
@@ -29,6 +29,7 @@ import org.apache.phoenix.end2end.BaseClientManagedTimeIT;
 import org.apache.phoenix.query.QueryConstants;
 import org.apache.phoenix.util.PhoenixRuntime;
 import org.apache.phoenix.util.PropertiesUtil;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.Test;
 
 public class UpdateCacheWithScnIT extends BaseClientManagedTimeIT {
@@ -40,7 +41,7 @@ public class UpdateCacheWithScnIT extends 
BaseClientManagedTimeIT {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         props.setProperty(PhoenixRuntime.CURRENT_SCN_ATTRIB, 
Long.toString(ts));
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        conn.createStatement().execute("create table " + fullTableName + 
TEST_TABLE_SCHEMA);
+        conn.createStatement().execute("create table " + fullTableName + 
TestUtil.TEST_TABLE_SCHEMA);
         // FIXME: given that the scn is advancing in the test, why aren't 
there more RPCs?
                UpdateCacheIT.helpTestUpdateCache(fullTableName, ts+2, new 
int[] {1, 1});
        }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
index f0319c0..dbb34ba 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTableMetricsWriterIT.java
@@ -43,7 +43,7 @@ public class PhoenixTableMetricsWriterIT extends 
BaseTracingTestIT {
     public void testCreatesTable() throws Exception {
         PhoenixMetricsSink sink = new PhoenixMetricsSink();
         Connection conn = getConnectionWithoutTracing();
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         sink.initForTesting(conn, tableName);
 
         // check for existence of the tracing table
@@ -74,7 +74,7 @@ public class PhoenixTableMetricsWriterIT extends 
BaseTracingTestIT {
         // hook up a phoenix sink
         PhoenixMetricsSink sink = new PhoenixMetricsSink();
         Connection conn = getConnectionWithoutTracing();
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         sink.initForTesting(conn, tableName);
 
         // create a simple metrics record

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTraceReaderIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTraceReaderIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTraceReaderIT.java
index a7bd730..723810f 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTraceReaderIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTraceReaderIT.java
@@ -55,7 +55,7 @@ public class PhoenixTraceReaderIT extends BaseTracingTestIT {
         PhoenixMetricsSink sink = new PhoenixMetricsSink();
         Properties props = new Properties(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         sink.initForTesting(conn, tableName);
 
         // create a simple metrics record
@@ -88,7 +88,7 @@ public class PhoenixTraceReaderIT extends BaseTracingTestIT {
         // hook up a phoenix sink
         PhoenixMetricsSink sink = new PhoenixMetricsSink();
         Connection conn = getConnectionWithoutTracing();
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         sink.initForTesting(conn, tableName);
 
         // create a simple metrics record

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
index 8097cc9..19fc75f 100644
--- 
a/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/trace/PhoenixTracingEndToEndIT.java
@@ -70,11 +70,11 @@ public class PhoenixTracingEndToEndIT extends 
BaseTracingTestIT {
     public void setupMetrics() throws Exception {
         PhoenixMetricsSink pWriter = new PhoenixMetricsSink();
         Connection conn = getConnectionWithoutTracing();
-        tracingTableName = "TRACING_" + generateRandomString();
+        tracingTableName = "TRACING_" + generateUniqueName();
         pWriter.initForTesting(conn, tracingTableName);
         sink = new DisableableMetricsWriter(pWriter);
-        enabledForLoggingTable = "ENABLED_FOR_LOGGING_" + 
generateRandomString();
-        enableForLoggingIndex = "ENABALED_FOR_LOGGING_INDEX_" + 
generateRandomString();
+        enabledForLoggingTable = "ENABLED_FOR_LOGGING_" + generateUniqueName();
+        enableForLoggingIndex = "ENABALED_FOR_LOGGING_INDEX_" + 
generateUniqueName();
 
         TracingTestUtil.registerSink(sink, tracingTableName);
     }

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/tx/NotThreadSafeTransactionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/tx/NotThreadSafeTransactionIT.java
 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/NotThreadSafeTransactionIT.java
new file mode 100644
index 0000000..6fea975
--- /dev/null
+++ 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/NotThreadSafeTransactionIT.java
@@ -0,0 +1,163 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.tx;
+
+import static org.apache.phoenix.util.TestUtil.INDEX_DATA_SCHEMA;
+import static org.apache.phoenix.util.TestUtil.createTransactionalTable;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.Map;
+
+import javax.annotation.concurrent.NotThreadSafe;
+
+import org.apache.phoenix.end2end.ParallelStatsDisabledIT;
+import org.apache.phoenix.end2end.Shadower;
+import org.apache.phoenix.query.QueryConstants;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.TestUtil;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.collect.Maps;
+
+@NotThreadSafe
+public class NotThreadSafeTransactionIT extends ParallelStatsDisabledIT {
+    
+    @BeforeClass
+    @Shadower(classBeingShadowed = ParallelStatsDisabledIT.class)
+    public static void doSetup() throws Exception {
+        Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
+        props.put(QueryServices.TRANSACTIONS_ENABLED, Boolean.toString(true));
+        setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
+    }
+
+    @Test
+    public void testInflightUpdateNotSeen() throws Exception {
+        String transTableName = generateUniqueName();
+        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
+        String selectSQL = "SELECT * FROM " + fullTableName;
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Connection conn1 = DriverManager.getConnection(getUrl()); 
+                Connection conn2 = DriverManager.getConnection(getUrl())) {
+            createTransactionalTable(conn, fullTableName);
+            conn1.setAutoCommit(false);
+            conn2.setAutoCommit(true);
+            ResultSet rs = conn1.createStatement().executeQuery(selectSQL);
+            assertFalse(rs.next());
+            
+            String upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, 
char_pk, int_pk, long_pk, decimal_pk, date_pk) VALUES(?, ?, ?, ?, ?, ?)";
+            PreparedStatement stmt = conn1.prepareStatement(upsert);
+            // upsert two rows
+            TestUtil.setRowKeyColumns(stmt, 1);
+            stmt.execute();
+            conn1.commit();
+            
+            TestUtil.setRowKeyColumns(stmt, 2);
+            stmt.execute();
+            
+            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 IS NULL");
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            
+            upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, char_pk, 
int_pk, long_pk, decimal_pk, date_pk, int_col1) VALUES(?, ?, ?, ?, ?, ?, 1)";
+            stmt = conn1.prepareStatement(upsert);
+            TestUtil.setRowKeyColumns(stmt, 1);
+            stmt.execute();
+            
+            rs = conn1.createStatement().executeQuery("SELECT int_col1 FROM " 
+ fullTableName + " WHERE int_col1 = 1");
+            assertTrue(rs.next());
+            assertEquals(1, rs.getInt(1));
+            assertFalse(rs.next());
+            
+            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 = 1");
+            assertTrue(rs.next());
+            assertEquals(0, rs.getInt(1));
+            rs = conn2.createStatement().executeQuery("SELECT * FROM " + 
fullTableName + " WHERE int_col1 = 1");
+            assertFalse(rs.next());
+            
+            conn1.commit();
+            
+            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 = 1");
+            assertTrue(rs.next());
+            assertEquals(1, rs.getInt(1));
+            rs = conn2.createStatement().executeQuery("SELECT * FROM " + 
fullTableName + " WHERE int_col1 = 1");
+            assertTrue(rs.next());
+            assertFalse(rs.next());
+        }
+    }
+    
+    @Test
+    public void testInflightDeleteNotSeen() throws Exception {
+        String transTableName = generateUniqueName();
+        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
+        String selectSQL = "SELECT * FROM " + fullTableName;
+        try (Connection conn = DriverManager.getConnection(getUrl());
+                Connection conn1 = DriverManager.getConnection(getUrl()); 
+                Connection conn2 = DriverManager.getConnection(getUrl())) {
+            createTransactionalTable(conn, fullTableName);
+            conn1.setAutoCommit(false);
+            conn2.setAutoCommit(true);
+            ResultSet rs = conn1.createStatement().executeQuery(selectSQL);
+            assertFalse(rs.next());
+            
+            String upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, 
char_pk, int_pk, long_pk, decimal_pk, date_pk) VALUES(?, ?, ?, ?, ?, ?)";
+            PreparedStatement stmt = conn1.prepareStatement(upsert);
+            // upsert two rows
+            TestUtil.setRowKeyColumns(stmt, 1);
+            stmt.execute();
+            TestUtil.setRowKeyColumns(stmt, 2);
+            stmt.execute();
+            
+            conn1.commit();
+            
+            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            
+            String delete = "DELETE FROM " + fullTableName + " WHERE 
varchar_pk = 'varchar1'";
+            stmt = conn1.prepareStatement(delete);
+            int count = stmt.executeUpdate();
+            assertEquals(1,count);
+            
+            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
+            assertTrue(rs.next());
+            assertEquals(1, rs.getInt(1));
+            assertFalse(rs.next());
+            
+            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
+            assertTrue(rs.next());
+            assertEquals(2, rs.getInt(1));
+            assertFalse(rs.next());
+            
+            conn1.commit();
+            
+            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
+            assertTrue(rs.next());
+            assertEquals(1, rs.getInt(1));
+            assertFalse(rs.next());
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
index c219158..bf99c4b 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/tx/TransactionIT.java
@@ -60,6 +60,7 @@ import org.apache.phoenix.schema.types.PInteger;
 import org.apache.phoenix.util.ByteUtil;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.StringUtil;
 import org.apache.phoenix.util.TestUtil;
 import org.apache.tephra.TransactionContext;
 import org.apache.tephra.TransactionSystemClient;
@@ -83,17 +84,13 @@ public class TransactionIT extends ParallelStatsDisabledIT {
         setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
 
-    private static void createTable(Connection conn, String tableName) throws 
SQLException {
-        conn.createStatement().execute("create table " + tableName + 
TEST_TABLE_SCHEMA + "TRANSACTIONAL=true");
-    }
-    
     @Test
     public void testReadOwnWrites() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         String selectSql = "SELECT * FROM "+ fullTableName;
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn.setAutoCommit(false);
             ResultSet rs = conn.createStatement().executeQuery(selectSql);
             assertFalse(rs.next());
@@ -124,11 +121,11 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testTxnClosedCorrecty() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         String selectSql = "SELECT * FROM "+fullTableName;
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn.setAutoCommit(false);
             ResultSet rs = conn.createStatement().executeQuery(selectSql);
             assertFalse(rs.next());
@@ -158,13 +155,13 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testDelete() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         String selectSQL = "SELECT * FROM " + fullTableName;
         try (Connection conn = DriverManager.getConnection(getUrl());
                 Connection conn1 = DriverManager.getConnection(getUrl()); 
                 Connection conn2 = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn1.setAutoCommit(false);
             ResultSet rs = conn1.createStatement().executeQuery(selectSQL);
             assertFalse(rs.next());
@@ -198,10 +195,10 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testAutoCommitQuerySingleTable() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn.setAutoCommit(true);
             // verify no rows returned
             ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM 
" + fullTableName);
@@ -211,10 +208,10 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testAutoCommitQueryMultiTables() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn.setAutoCommit(true);
             // verify no rows returned
             ResultSet rs = conn.createStatement().executeQuery("SELECT * FROM 
" + fullTableName + " a JOIN " + fullTableName + " b ON (a.long_pk = 
b.int_pk)");
@@ -224,11 +221,11 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testColConflicts() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         try (Connection conn1 = DriverManager.getConnection(getUrl()); 
                 Connection conn2 = DriverManager.getConnection(getUrl())) {
-            createTable(conn1, fullTableName);
+            TestUtil.createTransactionalTable(conn1, fullTableName);
             conn1.setAutoCommit(false);
             conn2.setAutoCommit(false);
             String selectSql = "SELECT * FROM "+fullTableName;
@@ -297,26 +294,26 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     
     @Test
     public void testRowConflictDetected() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         Connection conn = DriverManager.getConnection(getUrl());
-        createTable(conn, fullTableName);
+        TestUtil.createTransactionalTable(conn, fullTableName);
         testRowConflicts(fullTableName);
     }
     
     @Test
     public void testNoConflictDetectionForImmutableRows() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         Connection conn = DriverManager.getConnection(getUrl());
-        createTable(conn, fullTableName);
+        TestUtil.createTransactionalTable(conn, fullTableName);
         conn.createStatement().execute("ALTER TABLE " + fullTableName + " SET 
IMMUTABLE_ROWS=true");
         testRowConflicts(fullTableName);
     }
     
     @Test
     public void testNonTxToTxTable() throws Exception {
-        String nonTxTableName = generateRandomString();
+        String nonTxTableName = generateUniqueName();
 
         Connection conn = DriverManager.getConnection(getUrl());
         conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "(k 
INTEGER PRIMARY KEY, v VARCHAR)");
@@ -380,7 +377,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     @Ignore
     @Test
     public void testNonTxToTxTableFailure() throws Exception {
-        String nonTxTableName = generateRandomString();
+        String nonTxTableName = generateUniqueName();
 
         Connection conn = DriverManager.getConnection(getUrl());
         // Put table in SYSTEM schema to prevent attempts to update the cache 
after we disable SYSTEM.CATALOG
@@ -422,7 +419,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testProperties() throws Exception {
-        String nonTxTableName = generateRandomString();
+        String nonTxTableName = generateUniqueName();
 
         Connection conn = DriverManager.getConnection(getUrl());
         conn.createStatement().execute("CREATE TABLE " + nonTxTableName + "1(k 
INTEGER PRIMARY KEY, a.v VARCHAR, b.v VARCHAR, c.v VARCHAR) TTL=1000");
@@ -503,8 +500,8 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     public void testCreateTableToBeTransactional() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String t1 = generateRandomString();
-        String t2 = generateRandomString();
+        String t1 = generateUniqueName();
+        String t2 = generateUniqueName();
         String ddl = "CREATE TABLE " + t1 + " (k varchar primary key) 
transactional=true";
         conn.createStatement().execute(ddl);
         PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
@@ -547,11 +544,11 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
 
     @Test
     public void testCurrentDate() throws Exception {
-        String transTableName = generateRandomString();
+        String transTableName = generateUniqueName();
         String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
         String selectSql = "SELECT current_date() FROM "+fullTableName;
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
+            TestUtil.createTransactionalTable(conn, fullTableName);
             conn.setAutoCommit(false);
             ResultSet rs = conn.createStatement().executeQuery(selectSql);
             assertFalse(rs.next());
@@ -580,7 +577,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testReCreateTxnTableAfterDroppingExistingNonTxnTable() throws 
SQLException {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
@@ -595,7 +592,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testRowTimestampDisabled() throws SQLException {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         try (Connection conn = DriverManager.getConnection(getUrl(), props)) {
             conn.setAutoCommit(false);
@@ -624,7 +621,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
-        String fullTableName = generateRandomString();
+        String fullTableName = generateUniqueName();
         PhoenixConnection pconn = conn.unwrap(PhoenixConnection.class);
         
         TransactionSystemClient txServiceClient = 
pconn.getQueryServices().getTransactionSystemClient();
@@ -743,7 +740,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     public void testCheckpointAndRollback() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
-        String fullTableName = generateRandomString();
+        String fullTableName = generateUniqueName();
         conn.setAutoCommit(false);
         try {
             Statement stmt = conn.createStatement();
@@ -784,113 +781,6 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     }
     
     @Test
-    public void testInflightUpdateNotSeen() throws Exception {
-        String transTableName = generateRandomString();
-        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
-        String selectSQL = "SELECT * FROM " + fullTableName;
-        try (Connection conn = DriverManager.getConnection(getUrl());
-                Connection conn1 = DriverManager.getConnection(getUrl()); 
-                Connection conn2 = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
-            conn1.setAutoCommit(false);
-            conn2.setAutoCommit(true);
-            ResultSet rs = conn1.createStatement().executeQuery(selectSQL);
-            assertFalse(rs.next());
-            
-            String upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, 
char_pk, int_pk, long_pk, decimal_pk, date_pk) VALUES(?, ?, ?, ?, ?, ?)";
-            PreparedStatement stmt = conn1.prepareStatement(upsert);
-            // upsert two rows
-            TestUtil.setRowKeyColumns(stmt, 1);
-            stmt.execute();
-            conn1.commit();
-            
-            TestUtil.setRowKeyColumns(stmt, 2);
-            stmt.execute();
-            
-            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 IS NULL");
-            assertTrue(rs.next());
-            assertEquals(2, rs.getInt(1));
-            
-            upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, char_pk, 
int_pk, long_pk, decimal_pk, date_pk, int_col1) VALUES(?, ?, ?, ?, ?, ?, 1)";
-            stmt = conn1.prepareStatement(upsert);
-            TestUtil.setRowKeyColumns(stmt, 1);
-            stmt.execute();
-            
-            rs = conn1.createStatement().executeQuery("SELECT int_col1 FROM " 
+ fullTableName + " WHERE int_col1 = 1");
-            assertTrue(rs.next());
-            assertEquals(1, rs.getInt(1));
-            assertFalse(rs.next());
-            
-            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 = 1");
-            assertTrue(rs.next());
-            assertEquals(0, rs.getInt(1));
-            rs = conn2.createStatement().executeQuery("SELECT * FROM " + 
fullTableName + " WHERE int_col1 = 1");
-            assertFalse(rs.next());
-            
-            conn1.commit();
-            
-            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName + " WHERE int_col1 = 1");
-            assertTrue(rs.next());
-            assertEquals(1, rs.getInt(1));
-            rs = conn2.createStatement().executeQuery("SELECT * FROM " + 
fullTableName + " WHERE int_col1 = 1");
-            assertTrue(rs.next());
-            assertFalse(rs.next());
-        }
-    }
-    
-    @Test
-    public void testInflightDeleteNotSeen() throws Exception {
-        String transTableName = generateRandomString();
-        String fullTableName = INDEX_DATA_SCHEMA + 
QueryConstants.NAME_SEPARATOR + transTableName;
-        String selectSQL = "SELECT * FROM " + fullTableName;
-        try (Connection conn = DriverManager.getConnection(getUrl());
-                Connection conn1 = DriverManager.getConnection(getUrl()); 
-                Connection conn2 = DriverManager.getConnection(getUrl())) {
-            createTable(conn, fullTableName);
-            conn1.setAutoCommit(false);
-            conn2.setAutoCommit(true);
-            ResultSet rs = conn1.createStatement().executeQuery(selectSQL);
-            assertFalse(rs.next());
-            
-            String upsert = "UPSERT INTO " + fullTableName + "(varchar_pk, 
char_pk, int_pk, long_pk, decimal_pk, date_pk) VALUES(?, ?, ?, ?, ?, ?)";
-            PreparedStatement stmt = conn1.prepareStatement(upsert);
-            // upsert two rows
-            TestUtil.setRowKeyColumns(stmt, 1);
-            stmt.execute();
-            TestUtil.setRowKeyColumns(stmt, 2);
-            stmt.execute();
-            
-            conn1.commit();
-            
-            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
-            assertTrue(rs.next());
-            assertEquals(2, rs.getInt(1));
-            
-            String delete = "DELETE FROM " + fullTableName + " WHERE 
varchar_pk = 'varchar1'";
-            stmt = conn1.prepareStatement(delete);
-            int count = stmt.executeUpdate();
-            assertEquals(1,count);
-            
-            rs = conn1.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
-            assertTrue(rs.next());
-            assertEquals(1, rs.getInt(1));
-            assertFalse(rs.next());
-            
-            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
-            assertTrue(rs.next());
-            assertEquals(2, rs.getInt(1));
-            assertFalse(rs.next());
-            
-            conn1.commit();
-            
-            rs = conn2.createStatement().executeQuery("SELECT count(*) FROM " 
+ fullTableName);
-            assertTrue(rs.next());
-            assertEquals(1, rs.getInt(1));
-            assertFalse(rs.next());
-        }
-    }
-
-    @Test
     public void testParallelUpsertSelect() throws Exception {
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, 
Integer.toString(3));
@@ -898,16 +788,19 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
         props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, 
Integer.toString(3));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
-        conn.createStatement().execute("CREATE SEQUENCE S1");
-        conn.createStatement().execute("CREATE TABLE SALTEDT1 (pk INTEGER 
PRIMARY KEY, val INTEGER) SALT_BUCKETS=4,TRANSACTIONAL=true");
-        conn.createStatement().execute("CREATE TABLE T2 (pk INTEGER PRIMARY 
KEY, val INTEGER) TRANSACTIONAL=true");
+        String fullTableName1 = generateUniqueName();
+        String fullTableName2 = generateUniqueName();
+        String sequenceName = "S_" + generateUniqueName();
+        conn.createStatement().execute("CREATE SEQUENCE " + sequenceName);
+        conn.createStatement().execute("CREATE TABLE " + fullTableName1 + " 
(pk INTEGER PRIMARY KEY, val INTEGER) SALT_BUCKETS=4,TRANSACTIONAL=true");
+        conn.createStatement().execute("CREATE TABLE " + fullTableName2 + " 
(pk INTEGER PRIMARY KEY, val INTEGER) TRANSACTIONAL=true");
 
         for (int i = 0; i < 100; i++) {
-            conn.createStatement().execute("UPSERT INTO SALTEDT1 VALUES (NEXT 
VALUE FOR S1, " + (i%10) + ")");
+            conn.createStatement().execute("UPSERT INTO " + fullTableName1 + " 
VALUES (NEXT VALUE FOR " + sequenceName + ", " + (i%10) + ")");
         }
         conn.commit();
         conn.setAutoCommit(true);
-        int upsertCount = conn.createStatement().executeUpdate("UPSERT INTO T2 
SELECT pk, val FROM SALTEDT1");
+        int upsertCount = conn.createStatement().executeUpdate("UPSERT INTO " 
+ fullTableName2 + " SELECT pk, val FROM " + fullTableName1);
         assertEquals(100,upsertCount);
         conn.close();
     }
@@ -916,24 +809,24 @@ public class TransactionIT extends 
ParallelStatsDisabledIT {
     public void testTransactionalTableMetadata() throws SQLException {
 
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            String transactTableName = "TR";
+            String transactTableName = generateUniqueName();
             Statement stmt = conn.createStatement();
             stmt.execute("CREATE TABLE " + transactTableName + " (k VARCHAR 
PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " +
                 "TRANSACTIONAL=true");
             conn.commit();
 
             DatabaseMetaData dbmd = conn.getMetaData();
-            ResultSet rs = dbmd.getTables(null, null, transactTableName, null);
+            ResultSet rs = dbmd.getTables(null, null, 
StringUtil.escapeLike(transactTableName), null);
             assertTrue(rs.next());
             assertEquals("Transactional table was not marked as transactional 
in JDBC API.",
                 "true", rs.getString(PhoenixDatabaseMetaData.TRANSACTIONAL));
 
-            String nonTransactTableName = "NOTR";
+            String nonTransactTableName = generateUniqueName();
             Statement stmt2 = conn.createStatement();
             stmt2.execute("CREATE TABLE " + nonTransactTableName + "(k VARCHAR 
PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) ");
             conn.commit();
 
-            ResultSet rs2 = dbmd.getTables(null, null, nonTransactTableName, 
null);
+            ResultSet rs2 = dbmd.getTables(null, null, 
StringUtil.escapeLike(nonTransactTableName), null);
             assertTrue(rs2.next());
             assertEquals("Non-transactional table was marked as transactional 
in JDBC API.",
                 "false", rs2.getString(PhoenixDatabaseMetaData.TRANSACTIONAL));
@@ -944,7 +837,7 @@ public class TransactionIT extends ParallelStatsDisabledIT {
     public void testInflightPartialEval() throws SQLException {
 
         try (Connection conn = DriverManager.getConnection(getUrl())) {
-            String transactTableName = "TR" + generateRandomString();
+            String transactTableName = generateUniqueName();
             Statement stmt = conn.createStatement();
             stmt.execute("CREATE TABLE " + transactTableName + " (k VARCHAR 
PRIMARY KEY, v1 VARCHAR, v2 VARCHAR) " +
                 "TRANSACTIONAL=true");

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/it/java/org/apache/phoenix/tx/TxCheckpointIT.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/it/java/org/apache/phoenix/tx/TxCheckpointIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/tx/TxCheckpointIT.java
index 5a42a97..21ea072 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/tx/TxCheckpointIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/tx/TxCheckpointIT.java
@@ -80,9 +80,9 @@ public class TxCheckpointIT extends ParallelStatsDisabledIT {
     
     @Test
     public void testUpsertSelectDoesntSeeUpsertedData() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
-        String seqName = "SEQ_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
+        String seqName = "SEQ_" + generateUniqueName();
         String fullTableName = SchemaUtil.getTableName(tableName, tableName);
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, 
Integer.toString(3));
@@ -105,8 +105,8 @@ public class TxCheckpointIT extends ParallelStatsDisabledIT 
{
     
     @Test
     public void testRollbackOfUncommittedDeleteSingleCol() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = SchemaUtil.getTableName(tableName, tableName);
         String indexDDL = "CREATE "+(localIndex? "LOCAL " : "")+"INDEX " + 
indexName + " ON " + fullTableName + " (v1) INCLUDE(v2)";
         testRollbackOfUncommittedDelete(indexDDL, fullTableName);
@@ -114,8 +114,8 @@ public class TxCheckpointIT extends ParallelStatsDisabledIT 
{
 
     @Test
     public void testRollbackOfUncommittedDeleteMultiCol() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = SchemaUtil.getTableName(tableName, tableName);
         String indexDDL = "CREATE "+(localIndex? "LOCAL " : "")+"INDEX " + 
indexName + " ON " + fullTableName + " (v1, v2)";
         testRollbackOfUncommittedDelete(indexDDL, fullTableName);
@@ -208,8 +208,8 @@ public class TxCheckpointIT extends ParallelStatsDisabledIT 
{
     
        @Test
        public void testCheckpointForUpsertSelect() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = SchemaUtil.getTableName(tableName, tableName);
                Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
                try (Connection conn = DriverManager.getConnection(getUrl(), 
props);) {
@@ -298,8 +298,8 @@ public class TxCheckpointIT extends ParallelStatsDisabledIT 
{
        
        @Test
     public void testCheckpointForDeleteAndUpsert() throws Exception {
-        String tableName = "TBL_" + generateRandomString();
-        String indexName = "IDX_" + generateRandomString();
+        String tableName = "TBL_" + generateUniqueName();
+        String indexName = "IDX_" + generateUniqueName();
         String fullTableName = SchemaUtil.getTableName(tableName, tableName);
                Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
                ResultSet rs;

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java 
b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
index 7d7abef..7008911 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java
@@ -111,10 +111,10 @@ import java.util.concurrent.Future;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
 
 import javax.annotation.Nonnull;
 
-import org.apache.commons.lang.RandomStringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
@@ -189,26 +189,6 @@ import com.google.inject.util.Providers;
  */
 
 public abstract class BaseTest {
-    protected static final String TEST_TABLE_SCHEMA = "(" +
-            "   varchar_pk VARCHAR NOT NULL, " +
-            "   char_pk CHAR(10) NOT NULL, " +
-            "   int_pk INTEGER NOT NULL, "+ 
-            "   long_pk BIGINT NOT NULL, " +
-            "   decimal_pk DECIMAL(31, 10) NOT NULL, " +
-            "   date_pk DATE NOT NULL, " +
-            "   a.varchar_col1 VARCHAR, " +
-            "   a.char_col1 CHAR(10), " +
-            "   a.int_col1 INTEGER, " +
-            "   a.long_col1 BIGINT, " +
-            "   a.decimal_col1 DECIMAL(31, 10), " +
-            "   a.date1 DATE, " +
-            "   b.varchar_col2 VARCHAR, " +
-            "   b.char_col2 CHAR(10), " +
-            "   b.int_col2 INTEGER, " +
-            "   b.long_col2 BIGINT, " +
-            "   b.decimal_col2 DECIMAL(31, 10), " +
-            "   b.date2 DATE " +
-            "   CONSTRAINT pk PRIMARY KEY (varchar_pk, char_pk, int_pk, 
long_pk DESC, decimal_pk, date_pk)) ";
     private static final Map<String,String> tableDDLMap;
     private static final Logger logger = 
LoggerFactory.getLogger(BaseTest.class);
     protected static final int DEFAULT_TXN_TIMEOUT_SECONDS = 30;
@@ -801,8 +781,16 @@ public abstract class BaseTest {
         createTestTable(url, ddl, splits, ts);
     }
 
-    public static String generateRandomString() {
-      return RandomStringUtils.randomAlphabetic(20).toUpperCase();
+    private static AtomicInteger NAME_SUFFIX = new AtomicInteger(0);
+    private static final int MAX_SUFFIX_VALUE = 1000000;
+    
+    public static String generateUniqueName() {
+        int nextName = NAME_SUFFIX.incrementAndGet();
+        if (nextName >= MAX_SUFFIX_VALUE) {
+            throw new IllegalStateException("Used up all unique names");
+        }
+        return "T" + Integer.toString(MAX_SUFFIX_VALUE + 
nextName).substring(1);
+        //return RandomStringUtils.randomAlphabetic(20).toUpperCase();
     }
 
     protected static void createTestTable(String url, String ddl) throws 
SQLException {
@@ -1112,7 +1100,7 @@ public abstract class BaseTest {
     
     protected static String initATableValues(String tableName, String 
tenantId, byte[][] splits, Date date, Long ts, String url) throws Exception {
         if(tableName == null) {
-            tableName = generateRandomString();
+            tableName = generateUniqueName();
         }
         String tableDDLType = ATABLE_NAME;
         if (ts == null) {

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java 
b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
index 50180d1..de5af46 100644
--- a/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
+++ b/phoenix-core/src/test/java/org/apache/phoenix/util/TestUtil.java
@@ -17,7 +17,7 @@
  */
 package org.apache.phoenix.util;
 
-import static org.apache.phoenix.query.BaseTest.generateRandomString;
+import static org.apache.phoenix.query.BaseTest.generateUniqueName;
 import static org.apache.phoenix.query.QueryConstants.MILLIS_IN_DAY;
 import static 
org.apache.phoenix.query.QueryConstants.SINGLE_COLUMN_FAMILY_NAME;
 import static org.apache.phoenix.query.QueryConstants.SINGLE_COLUMN_NAME;
@@ -125,6 +125,27 @@ public class TestUtil {
     public static final String DEFAULT_INDEX_TABLE_NAME = "I";
     public static final String DEFAULT_DATA_TABLE_FULL_NAME = 
SchemaUtil.getTableName(DEFAULT_SCHEMA_NAME, "T");
     public static final String DEFAULT_INDEX_TABLE_FULL_NAME = 
SchemaUtil.getTableName(DEFAULT_SCHEMA_NAME, "I");
+
+    public static final String TEST_TABLE_SCHEMA = "(" +
+    "   varchar_pk VARCHAR NOT NULL, " +
+    "   char_pk CHAR(10) NOT NULL, " +
+    "   int_pk INTEGER NOT NULL, "+ 
+    "   long_pk BIGINT NOT NULL, " +
+    "   decimal_pk DECIMAL(31, 10) NOT NULL, " +
+    "   date_pk DATE NOT NULL, " +
+    "   a.varchar_col1 VARCHAR, " +
+    "   a.char_col1 CHAR(10), " +
+    "   a.int_col1 INTEGER, " +
+    "   a.long_col1 BIGINT, " +
+    "   a.decimal_col1 DECIMAL(31, 10), " +
+    "   a.date1 DATE, " +
+    "   b.varchar_col2 VARCHAR, " +
+    "   b.char_col2 CHAR(10), " +
+    "   b.int_col2 INTEGER, " +
+    "   b.long_col2 BIGINT, " +
+    "   b.decimal_col2 DECIMAL(31, 10), " +
+    "   b.date2 DATE " +
+    "   CONSTRAINT pk PRIMARY KEY (varchar_pk, char_pk, int_pk, long_pk DESC, 
decimal_pk, date_pk)) ";
     
     private TestUtil() {
     }
@@ -509,7 +530,7 @@ public class TestUtil {
      *            list of values to be inserted into the pk column
      */
     public static String initTables(Connection conn, String inputSqlType, 
List<Object> inputList) throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         createTable(conn, inputSqlType, tableName, "ASC");
         createTable(conn, inputSqlType, tableName, "DESC");
         for (int i = 0; i < inputList.size(); ++i) {
@@ -768,5 +789,9 @@ public class TestUtil {
             }
         }
     }
+
+    public static void createTransactionalTable(Connection conn, String 
tableName) throws SQLException {
+        conn.createStatement().execute("create table " + tableName + 
TestUtil.TEST_TABLE_SCHEMA + "TRANSACTIONAL=true");
+    }
 }
 

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-flume/src/it/java/org/apache/phoenix/flume/PhoenixSinkIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-flume/src/it/java/org/apache/phoenix/flume/PhoenixSinkIT.java 
b/phoenix-flume/src/it/java/org/apache/phoenix/flume/PhoenixSinkIT.java
index 2d52fc2..e78a964 100644
--- a/phoenix-flume/src/it/java/org/apache/phoenix/flume/PhoenixSinkIT.java
+++ b/phoenix-flume/src/it/java/org/apache/phoenix/flume/PhoenixSinkIT.java
@@ -131,7 +131,7 @@ public class PhoenixSinkIT extends BaseHBaseManagedTimeIT {
     
     @Test
     public void testSinkLifecycle () {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
 
         String ddl = "CREATE TABLE " + tableName +
                 "  (flume_time timestamp not null, col1 varchar , col2 
varchar" +
@@ -162,7 +162,7 @@ public class PhoenixSinkIT extends BaseHBaseManagedTimeIT {
     
     @Test
     public void testCreateTable () throws Exception {
-        String tableName = generateRandomString();
+        String tableName = generateUniqueName();
         String ddl = "CREATE TABLE " + tableName + " " +
                 "  (flume_time timestamp not null, col1 varchar , col2 
varchar" +
                 "  CONSTRAINT pk PRIMARY KEY (flume_time))\n";

http://git-wip-us.apache.org/repos/asf/phoenix/blob/bebb5ced/phoenix-flume/src/it/java/org/apache/phoenix/flume/RegexEventSerializerIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-flume/src/it/java/org/apache/phoenix/flume/RegexEventSerializerIT.java
 
b/phoenix-flume/src/it/java/org/apache/phoenix/flume/RegexEventSerializerIT.java
index 7348a65..9548e65 100644
--- 
a/phoenix-flume/src/it/java/org/apache/phoenix/flume/RegexEventSerializerIT.java
+++ 
b/phoenix-flume/src/it/java/org/apache/phoenix/flume/RegexEventSerializerIT.java
@@ -59,7 +59,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     @Test
     public void testKeyGenerator() throws EventDeliveryException, SQLException 
{
         
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         initSinkContextWithDefaults(fullTableName);
         
         sink = new PhoenixSink();
@@ -94,7 +94,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     @Test
     public void testMismatchKeyGenerator() throws EventDeliveryException, 
SQLException {
         
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         initSinkContextWithDefaults(fullTableName);
         setConfig(FlumeConstants.CONFIG_SERIALIZER_PREFIX + 
FlumeConstants.CONFIG_ROWKEY_TYPE_GENERATOR,DefaultKeyGenerator.UUID.name());
      
@@ -127,7 +127,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     @Test
     public void testMissingColumnsInEvent() throws EventDeliveryException, 
SQLException {
         
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         initSinkContextWithDefaults(fullTableName);
       
         sink = new PhoenixSink();
@@ -160,7 +160,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     @Test
     public void testBatchEvents() throws EventDeliveryException, SQLException {
         
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         initSinkContextWithDefaults(fullTableName);
       
         sink = new PhoenixSink();
@@ -205,7 +205,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     public void testApacheLogRegex() throws Exception {
         
         sinkContext = new Context ();
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         final String logRegex = "([^ ]*) ([^ ]*) ([^ ]*) (-|\\[[^\\]]*\\]) 
\"([^ ]+) ([^ ]+)" +
                                 " ([^\"]+)\" (-|[0-9]*) (-|[0-9]*)(?: ([^ 
\"]*|\"[^\"]*\")" +
                                 " ([^ \"]*|\"[^\"]*\"))?";
@@ -280,7 +280,7 @@ public class RegexEventSerializerIT extends 
BaseHBaseManagedTimeIT {
     public void testEventsWithHeaders() throws Exception {
         
         sinkContext = new Context ();
-        final String fullTableName = generateRandomString();
+        final String fullTableName = generateUniqueName();
         final String ddl = "CREATE TABLE " + fullTableName +
                 "  (rowkey VARCHAR not null, col1 varchar , cf1.col2 varchar , 
host varchar , source varchar \n" +
                 "  CONSTRAINT pk PRIMARY KEY (rowkey))\n";

Reply via email to