Repository: phoenix
Updated Branches:
  refs/heads/txn 8387bf03f -> 0d02b963d


Remove DROP_METADATA_ATTRIB from tests


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

Branch: refs/heads/txn
Commit: 0d02b963dbf84ce3d8726f81c02acbe1204dd643
Parents: 8387bf0
Author: Thomas D'Silva <[email protected]>
Authored: Wed Nov 18 17:23:26 2015 -0800
Committer: Thomas D'Silva <[email protected]>
Committed: Wed Nov 18 17:23:26 2015 -0800

----------------------------------------------------------------------
 .../phoenix/end2end/index/txn/RollbackIT.java   |   4 +-
 .../apache/phoenix/execute/PartialCommitIT.java |   3 +-
 .../org/apache/phoenix/tx/TxCheckpointIT.java   | 127 +++++++++++--------
 .../apache/phoenix/jdbc/PhoenixConnection.java  |   2 +
 4 files changed, 76 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d02b963/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 4993d7b..3b6bcaf 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
@@ -78,8 +78,8 @@ public class RollbackIT extends BaseTest {
     }
     
     private void setTableNames() {
-               tableName = TestUtil.DEFAULT_DATA_TABLE_NAME + "_1_" + 
System.currentTimeMillis();
-        indexName = "IDX1"  + "_" + System.currentTimeMillis();
+               tableName = TestUtil.DEFAULT_DATA_TABLE_NAME + "_" + 
System.currentTimeMillis();
+        indexName = "IDX"  + "_" + System.currentTimeMillis();
         fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, 
tableName);
        }
     

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d02b963/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
index a87761e..c12b6aa 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/execute/PartialCommitIT.java
@@ -104,8 +104,7 @@ public class PartialCommitIT extends BaseTest {
 
       Map<String, String> props = Maps.newHashMapWithExpectedSize(1);
       // Must update config before starting server
-      props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
-      driver = initAndRegisterDriver(url, new 
ReadOnlyProps(props.entrySet().iterator()));
+      driver = initAndRegisterDriver(url, ReadOnlyProps.EMPTY_PROPS);
       clusterInitialized = true;
       setupTxManager();
       createTablesWithABitOfData();

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d02b963/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 a493518..79d7590 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
@@ -33,28 +33,35 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.Properties;
 
-import co.cask.tephra.Transaction.VisibilityLevel;
-
 import org.apache.phoenix.end2end.BaseHBaseManagedTimeIT;
 import org.apache.phoenix.end2end.Shadower;
 import org.apache.phoenix.execute.MutationState;
 import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.query.BaseTest;
 import org.apache.phoenix.query.QueryServices;
 import org.apache.phoenix.util.PropertiesUtil;
 import org.apache.phoenix.util.ReadOnlyProps;
+import org.apache.phoenix.util.SchemaUtil;
+import org.apache.phoenix.util.TestUtil;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
 
+import co.cask.tephra.Transaction.VisibilityLevel;
+
 import com.google.common.collect.Maps;
 
 @RunWith(Parameterized.class)
-public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
+public class TxCheckpointIT extends BaseTest {
        
        private final boolean localIndex;
        private final boolean mutable;
+       private String tableName;
+    private String indexName;
+    private String seqName;
+    private String fullTableName;
 
        public TxCheckpointIT(boolean localIndex, boolean mutable) {
                this.localIndex = localIndex;
@@ -64,11 +71,8 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
        @BeforeClass
     @Shadower(classBeingShadowed = BaseHBaseManagedTimeIT.class)
     public static void doSetup() throws Exception {
-        Map<String,String> props = Maps.newHashMapWithExpectedSize(2);
+        Map<String,String> props = Maps.newHashMapWithExpectedSize(1);
         props.put(QueryServices.DEFAULT_TRANSACTIONAL_ATTRIB, 
Boolean.toString(true));
-        // We need this b/c we don't allow a transactional table to be created 
if the underlying
-        // HBase table already exists (since we don't know if it was 
transactional before).
-        props.put(QueryServices.DROP_METADATA_ATTRIB, Boolean.toString(true));
         setUpTestDriver(new ReadOnlyProps(props.entrySet().iterator()));
     }
        
@@ -78,23 +82,31 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
                  { false, false }, { false, true }, { true, false }, { true, 
true }  
            });
     }
+    
+    private void setTableNames() {
+        tableName = TestUtil.DEFAULT_DATA_TABLE_NAME + "_" + 
System.currentTimeMillis();
+        indexName = "IDX_" + System.currentTimeMillis();
+        seqName = "SEQ_" + System.currentTimeMillis();
+        fullTableName = SchemaUtil.getTableName(TestUtil.DEFAULT_SCHEMA_NAME, 
tableName);
+    }
 
     @Test
     public void testUpsertSelectDoesntSeeUpsertedData() throws Exception {
+        setTableNames();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         props.setProperty(QueryServices.MUTATE_BATCH_SIZE_ATTRIB, 
Integer.toString(3));
         props.setProperty(QueryServices.SCAN_CACHE_SIZE_ATTRIB, 
Integer.toString(3));
         props.setProperty(QueryServices.SCAN_RESULT_CHUNK_SIZE, 
Integer.toString(3));
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(true);
-        conn.createStatement().execute("CREATE SEQUENCE keys");
-        conn.createStatement().execute("CREATE TABLE txfoo (pk INTEGER PRIMARY 
KEY, val INTEGER)"+(!mutable? " IMMUTABLE_ROWS=true" : ""));
-        conn.createStatement().execute("CREATE "+(localIndex? "LOCAL " : 
"")+"INDEX idx ON txfoo (val)");
+        conn.createStatement().execute("CREATE SEQUENCE "+seqName);
+        conn.createStatement().execute("CREATE TABLE " + fullTableName + "(pk 
INTEGER PRIMARY KEY, val INTEGER)"+(!mutable? " IMMUTABLE_ROWS=true" : ""));
+        conn.createStatement().execute("CREATE "+(localIndex? "LOCAL " : 
"")+"INDEX " + indexName + " ON " + fullTableName + "(val)");
 
-        conn.createStatement().execute("UPSERT INTO txfoo VALUES (NEXT VALUE 
FOR keys,1)");
+        conn.createStatement().execute("UPSERT INTO " + fullTableName + " 
VALUES (NEXT VALUE FOR " + seqName + ",1)");
         for (int i=0; i<6; i++) {
             Statement stmt = conn.createStatement();
-            int upsertCount = stmt.executeUpdate("UPSERT INTO txfoo SELECT 
NEXT VALUE FOR keys, val FROM txfoo");
+            int upsertCount = stmt.executeUpdate("UPSERT INTO " + 
fullTableName + " SELECT NEXT VALUE FOR " + seqName + ", val FROM " + 
fullTableName);
             assertEquals((int)Math.pow(2, i), upsertCount);
         }
         conn.close();
@@ -102,19 +114,20 @@ public class TxCheckpointIT extends 
BaseHBaseManagedTimeIT {
     
     @Test
     public void testRollbackOfUncommittedDelete() throws Exception {
+        setTableNames();
         Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
         Connection conn = DriverManager.getConnection(getUrl(), props);
         conn.setAutoCommit(false);
         try {
             Statement stmt = conn.createStatement();
-            stmt.execute("CREATE TABLE DEMO(k VARCHAR PRIMARY KEY, v1 VARCHAR, 
v2 VARCHAR)"+(!mutable? " IMMUTABLE_ROWS=true" : ""));
-            stmt.execute("CREATE "+(localIndex? "LOCAL " : "")+"INDEX DEMO_idx 
ON DEMO (v1) INCLUDE(v2)");
+            stmt.execute("CREATE TABLE " + fullTableName + "(k VARCHAR PRIMARY 
KEY, v1 VARCHAR, v2 VARCHAR)"+(!mutable? " IMMUTABLE_ROWS=true" : ""));
+            stmt.execute("CREATE "+(localIndex? "LOCAL " : "")+"INDEX " + 
fullTableName + "_idx ON " + fullTableName + " (v1) INCLUDE(v2)");
             
-            stmt.executeUpdate("upsert into DEMO values('x1', 'y1', 'a1')");
-            stmt.executeUpdate("upsert into DEMO values('x2', 'y2', 'a2')");
+            stmt.executeUpdate("upsert into " + fullTableName + " values('x1', 
'y1', 'a1')");
+            stmt.executeUpdate("upsert into " + fullTableName + " values('x2', 
'y2', 'a2')");
             
             //assert values in data table
-            ResultSet rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER 
BY k");
+            ResultSet rs = stmt.executeQuery("select k, v1, v2 from " + 
fullTableName + " ORDER BY k");
             assertTrue(rs.next());
             assertEquals("x1", rs.getString(1));
             assertEquals("y1", rs.getString(2));
@@ -126,7 +139,7 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
             assertFalse(rs.next());
             
             //assert values in index table
-            rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER BY v1");
+            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName + 
" ORDER BY v1");
             assertTrue(rs.next());
             assertEquals("x1", rs.getString(1));
             assertEquals("y1", rs.getString(2));
@@ -139,9 +152,9 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
             
             conn.commit();
             
-            stmt.executeUpdate("DELETE FROM DEMO WHERE k='x1' AND v1='y1' AND 
v2='a1'");
+            stmt.executeUpdate("DELETE FROM " + fullTableName + " WHERE k='x1' 
AND v1='y1' AND v2='a1'");
             //assert row is delete in data table
-            rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER BY k");
+            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName + 
" ORDER BY k");
             assertTrue(rs.next());
             assertEquals("x2", rs.getString(1));
             assertEquals("y2", rs.getString(2));
@@ -149,7 +162,7 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
             assertFalse(rs.next());
             
             //assert row is delete in index table
-            rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER BY v1");
+            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName + 
" ORDER BY v1");
             assertTrue(rs.next());
             assertEquals("x2", rs.getString(1));
             assertEquals("y2", rs.getString(2));
@@ -159,7 +172,7 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
             conn.rollback();
             
             //assert two rows in data table
-            rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER BY k");
+            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName + 
" ORDER BY k");
             assertTrue(rs.next());
             assertEquals("x1", rs.getString(1));
             assertEquals("y1", rs.getString(2));
@@ -171,7 +184,7 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
             assertFalse(rs.next());
             
             //assert two rows in index table
-            rs = stmt.executeQuery("select k, v1, v2 from DEMO ORDER BY v1");
+            rs = stmt.executeQuery("select k, v1, v2 from " + fullTableName + 
" ORDER BY v1");
             assertTrue(rs.next());
             assertEquals("x1", rs.getString(1));
             assertEquals("y1", rs.getString(2));
@@ -188,19 +201,20 @@ public class TxCheckpointIT extends 
BaseHBaseManagedTimeIT {
     
        @Test
        public void testCheckpointForUpsertSelect() throws Exception {
+           setTableNames();
                Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
                try (Connection conn = DriverManager.getConnection(getUrl(), 
props);) {
                        conn.setAutoCommit(false);
                        Statement stmt = conn.createStatement();
 
-                       stmt.execute("CREATE TABLE DEMO(ID BIGINT NOT NULL 
PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)"
+                       stmt.execute("CREATE TABLE " + fullTableName + "(ID 
BIGINT NOT NULL PRIMARY KEY, v1 VARCHAR, v2 VARCHAR)"
                                        + (!mutable ? " IMMUTABLE_ROWS=true" : 
""));
                        stmt.execute("CREATE " + (localIndex ? "LOCAL " : "")
-                                       + "INDEX IDX ON DEMO (v1) INCLUDE(v2)");
+                                       + "INDEX " + indexName + " ON " + 
fullTableName + " (v1) INCLUDE(v2)");
 
-            stmt.executeUpdate("upsert into DEMO values(1, 'a2', 'b1')");
-            stmt.executeUpdate("upsert into DEMO values(2, 'a2', 'b2')");
-            stmt.executeUpdate("upsert into DEMO values(3, 'a3', 'b3')");
+            stmt.executeUpdate("upsert into " + fullTableName + " values(1, 
'a2', 'b1')");
+            stmt.executeUpdate("upsert into " + fullTableName + " values(2, 
'a2', 'b2')");
+            stmt.executeUpdate("upsert into " + fullTableName + " values(3, 
'a3', 'b3')");
                        conn.commit();
 
                        upsertRows(conn);
@@ -216,13 +230,13 @@ public class TxCheckpointIT extends 
BaseHBaseManagedTimeIT {
        private void verifyRows(Connection conn, int expectedMaxId) throws 
SQLException {
                ResultSet rs;
                //query the data table
-               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ max(id) from DEMO");
+               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ max(id) from " + fullTableName + "");
                assertTrue(rs.next());
                assertEquals(expectedMaxId, rs.getLong(1));
                assertFalse(rs.next());
                
                // query the index
-               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ max(id) from DEMO");
+               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ max(id) from " + fullTableName + "");
                assertTrue(rs.next());
                assertEquals(expectedMaxId, rs.getLong(1));
                assertFalse(rs.next());
@@ -235,38 +249,38 @@ public class TxCheckpointIT extends 
BaseHBaseManagedTimeIT {
                state.startTransaction();
                long wp = state.getWritePointer();
                conn.createStatement().execute(
-                               "upsert into DEMO select max(id)+1, 'a4', 'b4' 
from DEMO");
+                               "upsert into " + fullTableName + " select 
max(id)+1, 'a4', 'b4' from " + fullTableName + "");
                assertEquals(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT,
                                state.getVisibilityLevel());
                assertEquals(wp, state.getWritePointer()); // Make sure write 
ptr
                                                                                
                        // didn't move
-               rs = conn.createStatement().executeQuery("select max(id) from 
DEMO");
+               rs = conn.createStatement().executeQuery("select max(id) from " 
+ fullTableName + "");
 
                assertTrue(rs.next());
                assertEquals(4, rs.getLong(1));
                assertFalse(rs.next());
 
                conn.createStatement().execute(
-                               "upsert into DEMO select max(id)+1, 'a5', 'b5' 
from DEMO");
+                               "upsert into " + fullTableName + " select 
max(id)+1, 'a5', 'b5' from " + fullTableName + "");
                assertEquals(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT,
                                state.getVisibilityLevel());
                assertNotEquals(wp, state.getWritePointer()); // Make sure 
write ptr
                                                                                
                                // moves
                wp = state.getWritePointer();
-               rs = conn.createStatement().executeQuery("select max(id) from 
DEMO");
+               rs = conn.createStatement().executeQuery("select max(id) from " 
+ fullTableName + "");
 
                assertTrue(rs.next());
                assertEquals(5, rs.getLong(1));
                assertFalse(rs.next());
                
                conn.createStatement().execute(
-                               "upsert into DEMO select max(id)+1, 'a6', 'b6' 
from DEMO");
+                               "upsert into " + fullTableName + " select 
max(id)+1, 'a6', 'b6' from " + fullTableName + "");
                assertEquals(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT,
                                state.getVisibilityLevel());
                assertNotEquals(wp, state.getWritePointer()); // Make sure 
write ptr
                                                                                
                                // moves
                wp = state.getWritePointer();
-               rs = conn.createStatement().executeQuery("select max(id) from 
DEMO");
+               rs = conn.createStatement().executeQuery("select max(id) from " 
+ fullTableName + "");
 
                assertTrue(rs.next());
                assertEquals(6, rs.getLong(1));
@@ -275,79 +289,80 @@ public class TxCheckpointIT extends 
BaseHBaseManagedTimeIT {
        
        @Test
     public void testCheckpointForDeleteAndUpsert() throws Exception {
+           setTableNames();
                Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
                ResultSet rs;
                try (Connection conn = DriverManager.getConnection(getUrl(), 
props);) {
                        conn.setAutoCommit(false);
                        Statement stmt = conn.createStatement();
-                       stmt.execute("CREATE TABLE DEMO1(ID1 BIGINT NOT NULL 
PRIMARY KEY, FK1A INTEGER, FK1B INTEGER)"
+                       stmt.execute("CREATE TABLE " + fullTableName + "1(ID1 
BIGINT NOT NULL PRIMARY KEY, FK1A INTEGER, FK1B INTEGER)"
                                        + (!mutable ? " IMMUTABLE_ROWS=true" : 
""));
-                       stmt.execute("CREATE TABLE DEMO2(ID2 BIGINT NOT NULL 
PRIMARY KEY, FK2 INTEGER)"
+                       stmt.execute("CREATE TABLE " + fullTableName + "2(ID2 
BIGINT NOT NULL PRIMARY KEY, FK2 INTEGER)"
                                        + (!mutable ? " IMMUTABLE_ROWS=true" : 
""));
                        stmt.execute("CREATE " + (localIndex ? "LOCAL " : "")
-                                       + "INDEX IDX ON DEMO1 (FK1B)");
+                                       + "INDEX " + indexName + " ON " + 
fullTableName + "1 (FK1B)");
                        
-                       stmt.executeUpdate("upsert into DEMO1 values (1, 3, 
3)");
-                       stmt.executeUpdate("upsert into DEMO1 values (2, 2, 
2)");
-                       stmt.executeUpdate("upsert into DEMO1 values (3, 1, 
1)");
-                       stmt.executeUpdate("upsert into DEMO2 values (1, 1)");
+                       stmt.executeUpdate("upsert into " + fullTableName + "1 
values (1, 3, 3)");
+                       stmt.executeUpdate("upsert into " + fullTableName + "1 
values (2, 2, 2)");
+                       stmt.executeUpdate("upsert into " + fullTableName + "1 
values (3, 1, 1)");
+                       stmt.executeUpdate("upsert into " + fullTableName + "2 
values (1, 1)");
                        conn.commit();
 
                MutationState state = 
conn.unwrap(PhoenixConnection.class).getMutationState();
                state.startTransaction();
                long wp = state.getWritePointer();
-               conn.createStatement().execute("delete from DEMO1 where 
id1=fk1b AND fk1b=id1");
+               conn.createStatement().execute("delete from " + fullTableName + 
"1 where id1=fk1b AND fk1b=id1");
                assertEquals(VisibilityLevel.SNAPSHOT, 
state.getVisibilityLevel());
                assertEquals(wp, state.getWritePointer()); // Make sure write 
ptr didn't move
        
-               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from DEMO1");
+               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from " + fullTableName + "1");
                assertTrue(rs.next());
                assertEquals(1,rs.getLong(1));
                assertTrue(rs.next());
                assertEquals(3,rs.getLong(1));
                assertFalse(rs.next());
                
-               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from DEMO1");
+               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from " + fullTableName + "1");
             assertTrue(rs.next());
                assertEquals(3,rs.getLong(1));
                assertTrue(rs.next());
                assertEquals(1,rs.getLong(1));
                assertFalse(rs.next());
        
-               conn.createStatement().execute("delete from DEMO1 where id1 in 
(select fk1a from DEMO1 join DEMO2 on (fk2=id1))");
+               conn.createStatement().execute("delete from " + fullTableName + 
"1 where id1 in (select fk1a from " + fullTableName + "1 join " + fullTableName 
+ "2 on (fk2=id1))");
                assertEquals(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT, 
state.getVisibilityLevel());
                assertNotEquals(wp, state.getWritePointer()); // Make sure 
write ptr moved
        
-               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from DEMO1");
+               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from " + fullTableName + "1");
                assertTrue(rs.next());
                assertEquals(1,rs.getLong(1));
                assertFalse(rs.next());
        
-            rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from DEMO1");
+            rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from " + fullTableName + "1");
             assertTrue(rs.next());
             assertEquals(1,rs.getLong(1));
             assertFalse(rs.next());
     
-            stmt.executeUpdate("upsert into DEMO1 SELECT id1 + 3, id1, id1 
FROM DEMO1");
-            stmt.executeUpdate("upsert into DEMO2 values (2, 4)");
+            stmt.executeUpdate("upsert into " + fullTableName + "1 SELECT id1 
+ 3, id1, id1 FROM " + fullTableName + "1");
+            stmt.executeUpdate("upsert into " + fullTableName + "2 values (2, 
4)");
 
-            conn.createStatement().execute("delete from DEMO1 where id1 in 
(select fk1a from DEMO1 join DEMO2 on (fk2=id1))");
+            conn.createStatement().execute("delete from " + fullTableName + "1 
where id1 in (select fk1a from " + fullTableName + "1 join " + fullTableName + 
"2 on (fk2=id1))");
             assertEquals(VisibilityLevel.SNAPSHOT_EXCLUDE_CURRENT, 
state.getVisibilityLevel());
             assertNotEquals(wp, state.getWritePointer()); // Make sure write 
ptr moved
     
-            rs = conn.createStatement().executeQuery("select /*+ NO_INDEX */ 
id1 from DEMO1");
+            rs = conn.createStatement().executeQuery("select /*+ NO_INDEX */ 
id1 from " + fullTableName + "1");
             assertTrue(rs.next());
             assertEquals(4,rs.getLong(1));
             assertFalse(rs.next());
     
-            rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from DEMO1");
+            rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from " + fullTableName + "1");
             assertTrue(rs.next());
             assertEquals(4,rs.getLong(1));
             assertFalse(rs.next());
     
                conn.rollback();
                
-               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from DEMO1");
+               rs = conn.createStatement().executeQuery("select /*+ NO_INDEX 
*/ id1 from " + fullTableName + "1");
                assertTrue(rs.next());
                assertEquals(1,rs.getLong(1));
                assertTrue(rs.next());
@@ -356,7 +371,7 @@ public class TxCheckpointIT extends BaseHBaseManagedTimeIT {
                assertEquals(3,rs.getLong(1));
                assertFalse(rs.next());
 
-               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from DEMO1");
+               rs = conn.createStatement().executeQuery("select /*+ INDEX(DEMO 
IDX) */ id1 from " + fullTableName + "1");
             assertTrue(rs.next());
             assertEquals(3,rs.getLong(1));
             assertTrue(rs.next());

http://git-wip-us.apache.org/repos/asf/phoenix/blob/0d02b963/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java 
b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
index 63156d6..e864bfe 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixConnection.java
@@ -464,6 +464,8 @@ public class PhoenixConnection implements Connection, 
org.apache.phoenix.jdbc.Jd
         this.statements = Lists.newArrayList();
         try {
             mutationState.rollback();
+        } catch (SQLException e) {
+            // ignore any exceptions while rolling back
         } finally {
             try {
                 SQLCloseables.closeAll(statements);

Reply via email to