You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by an...@apache.org on 2016/09/20 23:44:24 UTC

[1/3] incubator-trafodion git commit: jira TRAFIDION-1435 SQL support for region transactions

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 16ebe09a1 -> 552b9496f


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/regress/seabase/EXPECTED011
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED011 b/core/sql/regress/seabase/EXPECTED011
index 90087d3..6e0165d 100644
--- a/core/sql/regress/seabase/EXPECTED011
+++ b/core/sql/regress/seabase/EXPECTED011
@@ -7,7 +7,7 @@
 >>invoke T011T1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T011T1
--- Definition current  Fri Jun 17 18:21:40 2016
+-- Definition current  Sat Sep 17 10:17:58 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -143,7 +143,7 @@ A            B
 ------------------------------------------------------------------ PLAN SUMMARY
 MODULE_NAME .............. DYNAMICALLY COMPILED
 STATEMENT_NAME ........... NOT NAMED
-PLAN_ID .................. 212332947701427332
+PLAN_ID .................. 212340867480003695
 ROWS_OUT ................. 7
 EST_TOTAL_COST ........... 0.01
 STATEMENT ................ select * from t011t1 where a >= 3 and a < 5;
@@ -182,7 +182,7 @@ DESCRIPTION
   SCHEMA ................. TRAFODION.SCH
   QUERY_CACHE ............ 0
   GENERATE_EXPLAIN ....... ON
-  ObjectUIDs ............. 4977141353440105723
+  ObjectUIDs ............. 2232205300326972159
   select_list ............ TRAFODION.SCH.T011T1.A, TRAFODION.SCH.T011T1.B
 
 
@@ -713,7 +713,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 
 7    .    8    root                                                  1.00E+004
 5    6    7    tuple_flow                                            1.00E+004
-.    .    6    trafodion_vsbb_upser            T011T3                1.00E+000
+.    .    6    trafodion_vsbb_upser  h         T011T3                1.00E+000
 4    .    5    transpose                                             1.00E+004
 3    .    4    transpose                                             1.00E+003
 2    .    3    transpose                                             1.00E+002
@@ -750,7 +750,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 
 7    .    8    root                                                  1.00E+004
 5    6    7    tuple_flow                                            1.00E+004
-.    .    6    trafodion_load                  T011T3                1.00E+000
+.    .    6    trafodion_load        h         T011T3                1.00E+000
 4    .    5    transpose                                             1.00E+004
 3    .    4    transpose                                             1.00E+003
 2    .    3    transpose                                             1.00E+002
@@ -861,7 +861,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 
 3    .    4    root                                                  2.00E+000
 1    2    3    tuple_flow                                            2.00E+000
-.    .    2    trafodion_load                  T011T1                1.00E+000
+.    .    2    trafodion_load        h         T011T1                1.00E+000
 .    .    1    tuplelist                                             2.00E+000
 
 --- SQL operation complete.
@@ -872,7 +872,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 
 3    .    4    root                                                  2.00E+000
 1    2    3    tuple_flow                                            2.00E+000
-.    .    2    trafodion_vsbb_upser            T011T1                1.00E+000
+.    .    2    trafodion_vsbb_upser  h         T011T1                1.00E+000
 .    .    1    tuplelist                                             2.00E+000
 
 --- SQL operation complete.
@@ -1269,7 +1269,7 @@ METRIC_TEXT_TABLE
 >>invoke trafodion."_REPOS_".metric_query_table;
 
 -- Definition of Trafodion table TRAFODION."_REPOS_".METRIC_QUERY_TABLE
--- Definition current  Fri Jun 17 18:23:24 2016
+-- Definition current  Sat Sep 17 10:20:09 2016
 
   (
     INSTANCE_ID                      INT UNSIGNED NO DEFAULT NOT NULL NOT
@@ -1457,7 +1457,7 @@ METRIC_TEXT_TABLE
 >>-- get qid for the prepared stmt
 >>get qid for statement explstmt;
 
-MXID11000008841212332947682096000000000000206U3333300_1994_EXPLSTMT
+MXID11000020349212340867451005125000000000206U3333300_2184_EXPLSTMT
 
 --- SQL operation complete.
 >>
@@ -1509,7 +1509,7 @@ SEQ_NUM      OPERATOR
 --- SQL command prepared.
 >>get qid for statement explstmt2;
 
-MXID11000008841212332947682096000000000000206U3333300_2005_EXPLSTMT2
+MXID11000020349212340867451005125000000000206U3333300_2195_EXPLSTMT2
 
 --- SQL operation complete.
 >>set qid MXID123456 for explstmt2;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/regress/seabase/EXPECTED025
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED025 b/core/sql/regress/seabase/EXPECTED025
index 522f424..6e93916 100644
--- a/core/sql/regress/seabase/EXPECTED025
+++ b/core/sql/regress/seabase/EXPECTED025
@@ -1613,7 +1613,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 7    .    8    esp_exchange                    1:4(hash2)            1.00E+004
 6    .    7    esp_exchange                    4(hash2):1            1.00E+004
 4    5    6    tuple_flow                                            1.00E+004
-.    .    5    trafodion_load                  T025T007              1.00E+000
+.    .    5    trafodion_load        h         T025T007              1.00E+000
 3    .    4    transpose                                             1.00E+004
 2    .    3    transpose                                             1.00E+003
 1    .    2    transpose                                             1.00E+002
@@ -1656,7 +1656,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 4    .    5    esp_exchange                    1:4(hash2)            1.00E+002
 3    .    4    esp_exchange                    4(hash2):1            1.00E+002
 1    2    3    tuple_flow                                            1.00E+002
-.    .    2    trafodion_load                  T025T008              1.00E+000
+.    .    2    trafodion_load        h         T025T008              1.00E+000
 .    .    1    trafodion_scan                  T025T007              1.00E+002
 
 --- SQL operation complete.
@@ -1884,7 +1884,7 @@ CREATE TABLE TRAFODION.S025.T025T004
 >>insert into T025T003 values  	
 +>(DEFAULT,-3,0,1,'dasf',2.1,'dfaf','dfa','dfa','d');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.S025.T025T003_527751321_8674 on table TRAFODION.S025.T025T003.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.S025.T025T003_526657384_3912 on table TRAFODION.S025.T025T003.
 
 --- 0 row(s) inserted.
 >>
@@ -1894,7 +1894,7 @@ CREATE TABLE TRAFODION.S025.T025T004
 +>(DEFAULT,-2,1,1,'dasf',2.1,'dfaf','dfa','dfa','d'),	
 +>(DEFAULT,-1,2,1,'dasf',2.1,'dfaf','dfa','dfa','d');
 
-*** ERROR[8101] The operation is prevented by check constraint TRAFODION.S025.T025T003_527751321_8674 on table TRAFODION.S025.T025T003.
+*** ERROR[8101] The operation is prevented by check constraint TRAFODION.S025.T025T003_526657384_3912 on table TRAFODION.S025.T025T003.
 
 --- 0 row(s) inserted.
 >>
@@ -2603,7 +2603,7 @@ CREATE VOLATILE TABLE T025T00V2
 >>invoke T025T00V2;
 
 -- Definition of Trafodion volatile table T025T00V2
--- Definition current  Thu Feb 25 09:56:14 2016
+-- Definition current  Sat Sep 17 11:25:16 2016
 
   (
     SURROGATE_KEY                    SMALLINT UNSIGNED GENERATED BY DEFAULT AS

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/sqlcomp/DefaultConstants.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/DefaultConstants.h b/core/sql/sqlcomp/DefaultConstants.h
index be9bf5a..e569a1f 100644
--- a/core/sql/sqlcomp/DefaultConstants.h
+++ b/core/sql/sqlcomp/DefaultConstants.h
@@ -3587,6 +3587,10 @@ enum DefaultConstants
   // It is run using underlying hbase single row transaction consistency.
   TRAF_NO_DTM_XN,
 
+  // if set to ON, then query is run as part of localized region transaction.
+  // No external transaction is started to run it.
+  TRAF_USE_REGION_XN,
+
   // HBASE_HASH2_PARTITIONING (ON - OFF for now):
   // - OFF: Treat salted table like a non-salted table
   // - ON: Always use HASH2 for salted table

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/sqlcomp/nadefaults.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/nadefaults.cpp b/core/sql/sqlcomp/nadefaults.cpp
index c9d73b4..59c1513 100644
--- a/core/sql/sqlcomp/nadefaults.cpp
+++ b/core/sql/sqlcomp/nadefaults.cpp
@@ -3412,6 +3412,8 @@ XDDkwd__(SUBQUERY_UNNESTING,			"ON"),
   DDint__(TRAF_UPSERT_WB_SIZE,                         "2097152"),
   DDkwd__(TRAF_UPSERT_WRITE_TO_WAL,                    "OFF"),
 
+  DDkwd__(TRAF_USE_REGION_XN,                          "OFF"),
+
   DDkwd__(TRAF_USE_RWRS_FOR_MD_INSERT,                   "ON"),
 
   DDkwd__(TRY_DP2_REPARTITION_ALWAYS,		"OFF"),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
----------------------------------------------------------------------
diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
index 6a1ed65..909c75a 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -1607,14 +1607,15 @@ public class HBaseClient {
   }
 
   public boolean insertRow(long jniObject, String tblName, boolean useTRex, long transID, byte[] rowID,
-                         Object row,
-                         long timestamp,
-                         boolean checkAndPut,
-                         boolean asyncOperation) throws IOException, InterruptedException, ExecutionException {
+                           Object row,
+                           long timestamp,
+                           boolean checkAndPut,
+                           boolean asyncOperation,
+                           boolean useRegionXn) throws IOException, InterruptedException, ExecutionException {
 
       HTableClient htc = getHTableClient(jniObject, tblName, useTRex);
       boolean ret = htc.putRow(transID, rowID, row, null, null,
-                                checkAndPut, asyncOperation);
+                               checkAndPut, asyncOperation, useRegionXn);
       if (asyncOperation == true)
          htc.setJavaObject(jniObject);
       else
@@ -1623,14 +1624,15 @@ public class HBaseClient {
   }
 
   public boolean checkAndUpdateRow(long jniObject, String tblName, boolean useTRex, long transID, byte[] rowID,
-                         Object columnsToUpdate,
-                         byte[] columnToCheck, byte[] columnValToCheck,
-                         long timestamp,
-                         boolean asyncOperation) throws IOException, InterruptedException, ExecutionException {
+                                   Object columnsToUpdate,
+                                   byte[] columnToCheck, byte[] columnValToCheck,
+                                   long timestamp,
+                                   boolean asyncOperation,
+                                   boolean useRegionXn) throws IOException, InterruptedException, ExecutionException {
       boolean checkAndPut = true;
       HTableClient htc = getHTableClient(jniObject, tblName, useTRex);
       boolean ret = htc.putRow(transID, rowID, columnsToUpdate, columnToCheck, columnValToCheck,
-                                checkAndPut, asyncOperation);
+                               checkAndPut, asyncOperation, useRegionXn);
       if (asyncOperation == true)
          htc.setJavaObject(jniObject);
       else
@@ -1654,11 +1656,13 @@ public class HBaseClient {
   }
 
   public boolean deleteRow(long jniObject, String tblName, boolean useTRex, long transID, 
-                                 byte[] rowID,
-                                 Object[] columns,
-                                 long timestamp, boolean asyncOperation) throws IOException {
+                           byte[] rowID,
+                           Object[] columns,
+                           long timestamp, 
+                           boolean asyncOperation, boolean useRegionXn) throws IOException {
       HTableClient htc = getHTableClient(jniObject, tblName, useTRex);
-      boolean ret = htc.deleteRow(transID, rowID, columns, timestamp, asyncOperation);
+      boolean ret = htc.deleteRow(transID, rowID, columns, timestamp, 
+                                  asyncOperation, useRegionXn);
       if (asyncOperation == true)
          htc.setJavaObject(jniObject);
       else
@@ -1679,11 +1683,13 @@ public class HBaseClient {
   }
 
   public boolean checkAndDeleteRow(long jniObject, String tblName, boolean useTRex, long transID, 
-                                 byte[] rowID,
-                                 byte[] columnToCheck, byte[] colValToCheck,
-                                 long timestamp, boolean asyncOperation) throws IOException {
+                                   byte[] rowID,
+                                   byte[] columnToCheck, byte[] colValToCheck,
+                                   long timestamp, boolean asyncOperation,
+                                   boolean useRegionXn
+                                   ) throws IOException {
       HTableClient htc = getHTableClient(jniObject, tblName, useTRex);
-      boolean ret = htc.checkAndDeleteRow(transID, rowID, columnToCheck, colValToCheck, timestamp);
+      boolean ret = htc.checkAndDeleteRow(transID, rowID, columnToCheck, colValToCheck, timestamp, useRegionXn);
       if (asyncOperation == true)
          htc.setJavaObject(jniObject);
       else

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
----------------------------------------------------------------------
diff --git a/core/sql/src/main/java/org/trafodion/sql/HTableClient.java b/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
index 3573e90..fce661a 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HTableClient.java
@@ -103,7 +103,6 @@ public class HTableClient {
 	private static final int SCAN_FETCH = 3;
 	private boolean useTRex;
 	private boolean useTRexScanner;
-	private boolean useRegionTransaction;
 	private String tableName;
         private static Connection connection;
 	private ResultScanner scanner = null;
@@ -328,7 +327,6 @@ public class HTableClient {
 	    if (logger.isDebugEnabled()) logger.debug("Enter HTableClient::init, tableName: " + tblName);
 	    this.useTRex = useTRex;
 	    tableName = tblName;
-        this.useRegionTransaction = false;
 	    
 	    if ( !this.useTRex ) {
 		this.useTRexScanner = false;
@@ -1364,56 +1362,57 @@ public class HTableClient {
 	public boolean deleteRow(final long transID, byte[] rowID, 
 				 Object[] columns,
 				 long timestamp,
-                                 boolean asyncOperation) throws IOException {
+                                 boolean asyncOperation,
+                                 boolean useRegionXn) throws IOException {
 
-		if (logger.isTraceEnabled()) logger.trace("Enter deleteRow(" + new String(rowID) + ", "
-			     + timestamp + ") " + tableName);
-
-		final Delete del;
-		if (timestamp == -1)
-			del = new Delete(rowID);
-		else
-			del = new Delete(rowID, timestamp);
-
-		if (columns != null) {
-			for (int i = 0; i < columns.length ; i++) {
-				byte[] col = (byte[]) columns[i];
-				del.deleteColumns(getFamily(col), getName(col));
-			}
-		}
-               	if (asyncOperation) {
-			future = executorService.submit(new Callable() {
- 				public Object call() throws IOException {
-					boolean res = true;
-					if (useTRex && (transID != 0)) {
-			           table.delete(transID, del);
-                    }
-//                    else if (useRegionTransaction){
-//                        logger.info("deleteRow using region TX");
-//                        table.deleteRegionTx(del, /* auto-commit */ true);
-//                    }
-                    else {
-//                       logger.info("deleteRow without transID ");
-                       table.delete(del);
-                    }
-					return true;
-				}
-			});
-		}
-		else {
-			if (useTRex && (transID != 0)) {
-	           table.delete(transID, del);
+            if (logger.isTraceEnabled()) logger.trace("Enter deleteRow(" + new String(rowID) + ", "
+                                                      + timestamp + ") " + tableName);
+            
+            final Delete del;
+            if (timestamp == -1)
+                del = new Delete(rowID);
+            else
+                del = new Delete(rowID, timestamp);
+            
+            if (columns != null) {
+                for (int i = 0; i < columns.length ; i++) {
+                    byte[] col = (byte[]) columns[i];
+                    del.deleteColumns(getFamily(col), getName(col));
+                }
+            }
+            if (asyncOperation) {
+                future = executorService.submit(new Callable() {
+                        public Object call() throws IOException {
+                            boolean res = true;
+                            if (useTRex && (transID != 0)) {
+                                table.delete(transID, del);
+                            }
+                            //                    else if (useRegionXn){
+                            //                        logger.info("deleteRow using region TX");
+                            //                        table.deleteRegionTx(del, /* auto-commit */ true);
+                            //                    }
+                            else {
+                                //                       logger.info("deleteRow without transID ");
+                                table.delete(del);
+                            }
+                            return true;
+                        }
+                    });
             }
-//            else if (useRegionTransaction){
-//               logger.info("deleteRow using region TX");
-//               table.deleteRegionTx(del, /* auto-commit */ true);
-//            }
             else {
-               table.delete(del);
+                if (useTRex && (transID != 0)) {
+                    table.delete(transID, del);
+                }
+                //            else if (useRegionXn){
+                //               logger.info("deleteRow using region TX");
+                //               table.deleteRegionTx(del, /* auto-commit */ true);
+                //            }
+                else {
+                    table.delete(del);
+                }
             }
-		}
-		if (logger.isTraceEnabled()) logger.trace("Exit deleteRow");
-		return true;
+            if (logger.isTraceEnabled()) logger.trace("Exit deleteRow");
+            return true;
 	}
 
 	public boolean deleteRows(final long transID, short rowIDLen, Object rowIDs,
@@ -1479,46 +1478,47 @@ public class HTableClient {
     
 	public boolean checkAndDeleteRow(long transID, byte[] rowID, 
 					 byte[] columnToCheck, byte[] colValToCheck,
-					 long timestamp) throws IOException {
+					 long timestamp, boolean useRegionXn) throws IOException {
 
-		if (logger.isTraceEnabled()) logger.trace("Enter checkAndDeleteRow(" + new String(rowID) + ", "
-			     + new String(columnToCheck) + ", " + new String(colValToCheck) + ", " + timestamp + ") " + tableName);
-
-			Delete del;
-			if (timestamp == -1)
-				del = new Delete(rowID);
-			else
-				del = new Delete(rowID, timestamp);
-
-			byte[] family = null;
-			byte[] qualifier = null;
-
-			if (columnToCheck.length > 0) {
-				family = getFamily(columnToCheck);
-				qualifier = getName(columnToCheck);
-			}
-			
-			boolean res;
-			if (useTRex && (transID != 0)) {
-			    res = table.checkAndDelete(transID, rowID, family, qualifier, colValToCheck, del);
+            if (logger.isTraceEnabled()) logger.trace("Enter checkAndDeleteRow(" + new String(rowID) + ", "
+                                                      + new String(columnToCheck) + ", " + new String(colValToCheck) + ", " + timestamp + ") " + tableName);
+            
+            Delete del;
+            if (timestamp == -1)
+                del = new Delete(rowID);
+            else
+                del = new Delete(rowID, timestamp);
+            
+            byte[] family = null;
+            byte[] qualifier = null;
+            
+            if (columnToCheck.length > 0) {
+                family = getFamily(columnToCheck);
+                qualifier = getName(columnToCheck);
+            }
+            
+            boolean res;
+            if (useTRex && (transID != 0)) {
+                res = table.checkAndDelete(transID, rowID, family, qualifier, colValToCheck, del);
             }
-//            else if (useRegionTransaction){
-//               logger.info("checkAndDeleteRow using region TX");
-//               res = table.checkAndDeleteRegionTx(rowID, family, qualifier, colValToCheck,
-//               		         del, /* autoCommit */ true);
-//            }
+            //            else if (useRegionXn){
+            //               logger.info("checkAndDeleteRow using region TX");
+            //               res = table.checkAndDeleteRegionTx(rowID, family, qualifier, colValToCheck,
+            //               		         del, /* autoCommit */ true);
+            //            }
             else {
-			   res = table.checkAndDelete(rowID, family, qualifier, colValToCheck, del);
+                res = table.checkAndDelete(rowID, family, qualifier, colValToCheck, del);
             }
-
-			if (res == false)
-			    return false;
-		return true;
+            
+            if (res == false)
+                return false;
+            return true;
 	}
-
+    
 	public boolean putRow(final long transID, final byte[] rowID, Object row,
-		byte[] columnToCheck, final byte[] colValToCheck,
-		final boolean checkAndPut, boolean asyncOperation) throws IOException, InterruptedException, 
+                              byte[] columnToCheck, final byte[] colValToCheck,
+                              final boolean checkAndPut, boolean asyncOperation,
+                              final boolean useRegionXn) throws IOException, InterruptedException, 
                           ExecutionException 
 	{
 		if (logger.isTraceEnabled()) logger.trace("Enter putRow() " + tableName);
@@ -1556,79 +1556,79 @@ public class HTableClient {
 		final byte[] family1 = family;
 		final byte[] qualifier1 = qualifier;
 		if (asyncOperation) {
-			future = executorService.submit(new Callable() {
-				public Object call() throws IOException {
-					boolean res = true;
-
-					if (checkAndPut) {
-                       if (useTRex && (transID != 0)){
-                          res = table.checkAndPut(transID, rowID,
-                                     family1, qualifier1, colValToCheck, put);
-                       }
-                       else if (useRegionTransaction){
-                           if (logger.isTraceEnabled()) logger.trace("checkAndPutRegionTx with regionTX ");
-                           res = table.checkAndPutRegionTx(rowID, 
-                                           family1, qualifier1, colValToCheck, put, /* auto-commit */ true);
-                    	   
-                       }
-                       else {
-                          res = table.checkAndPut(rowID, 
-                                          family1, qualifier1, colValToCheck, put);
-                       }
-					}
-					else {
-                       if (useTRex && (transID != 0)){
-                          table.put(transID, put);
-                       }
-                       else if (useRegionTransaction){
-                          if (logger.isTraceEnabled()) logger.trace("putRow using putRegionTx");
-                          table.putRegionTx(put, /* auto-commit */ true);
-                       }else{ 
-                          table.put(put);
-					   }
-					}
-					return new Boolean(res);
-				}
+                    future = executorService.submit(new Callable() {
+                            public Object call() throws IOException {
+                                boolean res = true;
+                                
+                                if (checkAndPut) {
+                                    if (useTRex && (transID != 0)){
+                                        res = table.checkAndPut(transID, rowID,
+                                                                family1, qualifier1, colValToCheck, put);
+                                    }
+                                    else if (useRegionXn){
+                                        if (logger.isTraceEnabled()) logger.trace("checkAndPutRegionTx with regionTX ");
+                                        res = table.checkAndPutRegionTx(rowID, 
+                                                                        family1, qualifier1, colValToCheck, put, /* auto-commit */ true);
+                                        
+                                    }
+                                    else {
+                                        res = table.checkAndPut(rowID, 
+                                                                family1, qualifier1, colValToCheck, put);
+                                    }
+                                }
+                                else {
+                                    if (useTRex && (transID != 0)){
+                                        table.put(transID, put);
+                                    }
+                                    else if (useRegionXn){
+                                        if (logger.isTraceEnabled()) logger.trace("putRow using putRegionTx");
+                                        table.putRegionTx(put, /* auto-commit */ true);
+                                    }else{ 
+                                        table.put(put);
+                                    }
+                                }
+                                return new Boolean(res);
+                            }
 			});
-			return true;
+                    return true;
 		} else {
-		 	boolean result = true;
-			if (checkAndPut) {
-               if (useTRex && (transID != 0)){
-                  result = table.checkAndPut(transID, rowID, 
-						family1, qualifier1, colValToCheck, put);
-               }
-               else if (useRegionTransaction){
-                   if (logger.isTraceEnabled()) logger.trace("checkAndPutRegionTx using regionTX ");
-                   result = table.checkAndPutRegionTx(rowID, family1, qualifier1,
-                		   colValToCheck, put, /* auto-commit */ true);
-               }
-               else {
-                  result = table.checkAndPut(rowID, 
-						family1, qualifier1, colValToCheck, put);
-               }
-			}
-			else {
-               if (useTRex && (transID != 0)){
-                  table.put(transID, put);
-               }
-               else if (useRegionTransaction){
-                  if (logger.isTraceEnabled()) logger.trace("putRow using putRegionTx");
-                  table.putRegionTx(put, true /* also commit */);
-               }else{
-                  table.put(put);
-               }
-			}
-			return result;
+                    boolean result = true;
+                    if (checkAndPut) {
+                        if (useTRex && (transID != 0)){
+                            result = table.checkAndPut(transID, rowID, 
+                                                       family1, qualifier1, colValToCheck, put);
+                        }
+                        else if (useRegionXn){
+                            if (logger.isTraceEnabled()) logger.trace("checkAndPutRegionTx using regionTX ");
+                            result = table.checkAndPutRegionTx(rowID, family1, qualifier1,
+                                                               colValToCheck, put, /* auto-commit */ true);
+                        }
+                        else {
+                            result = table.checkAndPut(rowID, 
+                                                       family1, qualifier1, colValToCheck, put);
+                        }
+                    }
+                    else {
+                        if (useTRex && (transID != 0)){
+                            table.put(transID, put);
+                        }
+                        else if (useRegionXn){
+                            if (logger.isTraceEnabled()) logger.trace("putRow using putRegionTx");
+                            table.putRegionTx(put, true /* also commit */);
+                        }else{
+                            table.put(put);
+                        }
+                    }
+                    return result;
 		}	
 	}
-
-	public boolean insertRow(long transID, byte[] rowID, 
+    
+    public boolean insertRow(long transID, byte[] rowID, 
                          Object row, 
 			 long timestamp,
                          boolean asyncOperation) throws IOException, InterruptedException, ExecutionException {
 		return putRow(transID, rowID, row, null, null, 
-				false, asyncOperation);
+                              false, asyncOperation, false);
 	}
 
 	public boolean putRows(final long transID, short rowIDLen, Object rowIDs, 
@@ -1722,7 +1722,7 @@ public class HTableClient {
 			 long timestamp,
                          boolean asyncOperation) throws IOException, InterruptedException, ExecutionException  {
 		return putRow(transID, rowID, row, null, null, 
-				true, asyncOperation);
+                              true, asyncOperation, false);
 	}
 
 	public boolean checkAndUpdateRow(long transID, byte[] rowID, 
@@ -1730,8 +1730,8 @@ public class HTableClient {
              long timestamp, boolean asyncOperation) throws IOException, InterruptedException, 
                                     ExecutionException, Throwable  {
 		return putRow(transID, rowID, columns, columnToCheck, 
-			colValToCheck, 
-				true, asyncOperation);
+                              colValToCheck, 
+                              true, asyncOperation, false);
 	}
 
         public byte[] coProcAggr(long transID, int aggrType, 


[2/3] incubator-trafodion git commit: jira TRAFIDION-1435 SQL support for region transactions

Posted by an...@apache.org.
jira TRAFIDION-1435 SQL support for region transactions

This checkin is to add support for sql compiler/executor support
for dtm region transactions.

cqd traf_use_region_xn 'ON' enables it.
Off by default for now until dtm support is complete and tested.

Explain (full and short) will also show if region transactions
are being used.

core/test116 has been enhanced with additional tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/632f52fb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/632f52fb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/632f52fb

Branch: refs/heads/master
Commit: 632f52fb411d7c9c50c303ecf6ce9fe455a5f257
Parents: 4418ed3
Author: Anoop Sharma <an...@esgyn.com>
Authored: Sun Sep 18 00:13:28 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Sun Sep 18 00:13:28 2016 +0000

----------------------------------------------------------------------
 core/sql/comexe/ComTdbHbaseAccess.h             |   7 +-
 core/sql/executor/ExExeUtilExplain.cpp          |  19 +
 core/sql/executor/ExHbaseIUD.cpp                |  19 +-
 core/sql/executor/HBaseClient_JNI.cpp           |  68 ++-
 core/sql/executor/HBaseClient_JNI.h             |  32 +-
 core/sql/exp/ExpHbaseInterface.cpp              |  81 ++-
 core/sql/exp/ExpHbaseInterface.h                |  59 +-
 core/sql/generator/GenExplain.cpp               |   8 +
 core/sql/generator/GenPreCode.cpp               |  99 +--
 core/sql/generator/GenRelUpdate.cpp             |  49 +-
 core/sql/optimizer/BindRelExpr.cpp              |   3 +-
 core/sql/optimizer/RelUpdate.h                  |   6 +
 core/sql/regress/core/EXPECTED116               | 604 ++++++++++++++++++-
 core/sql/regress/core/TEST116                   | 192 ++++++
 core/sql/regress/seabase/EXPECTED011            |  20 +-
 core/sql/regress/seabase/EXPECTED025            |  10 +-
 core/sql/sqlcomp/DefaultConstants.h             |   4 +
 core/sql/sqlcomp/nadefaults.cpp                 |   2 +
 .../java/org/trafodion/sql/HBaseClient.java     |  42 +-
 .../java/org/trafodion/sql/HTableClient.java    | 300 ++++-----
 20 files changed, 1243 insertions(+), 381 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/comexe/ComTdbHbaseAccess.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdbHbaseAccess.h b/core/sql/comexe/ComTdbHbaseAccess.h
index c785a8d..e2645a7 100644
--- a/core/sql/comexe/ComTdbHbaseAccess.h
+++ b/core/sql/comexe/ComTdbHbaseAccess.h
@@ -727,6 +727,10 @@ public:
   void setUseHbaseXn(NABoolean v)
   {(v ? flags_ |= USE_HBASE_XN : flags_ &= ~USE_HBASE_XN); };
   NABoolean useHbaseXn() { return (flags_ & USE_HBASE_XN) != 0; };
+
+  void setUseRegionXn(NABoolean v)
+  {(v ? flags_ |= USE_REGION_XN : flags_ &= ~USE_REGION_XN); };
+  NABoolean useRegionXn() { return (flags_ & USE_REGION_XN) != 0; };
  
   void setAlignedFormat(NABoolean v)
   {(v ? flags_ |= ALIGNED_FORMAT : flags_ &= ~ALIGNED_FORMAT); };
@@ -904,7 +908,8 @@ public:
     USE_HBASE_XN                     = 0x2000,
     ALIGNED_FORMAT                   = 0x4000,
     ASYNC_OPERATIONS                 = 0x8000,
-    USE_CIF                          = 0x10000
+    USE_CIF                          = 0x10000,
+    USE_REGION_XN                    = 0x20000
   };
 
   enum

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/executor/ExExeUtilExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExExeUtilExplain.cpp b/core/sql/executor/ExExeUtilExplain.cpp
index 69cfe78..dc79d44 100644
--- a/core/sql/executor/ExExeUtilExplain.cpp
+++ b/core/sql/executor/ExExeUtilExplain.cpp
@@ -977,6 +977,25 @@ void ExExeUtilDisplayExplainTcb::FormatForF()
       remaining_width -= 2;
     }
 
+  if (str_cmp_c(operName_, "TRAFODION_INSERT") == 0 || 
+      str_cmp_c(operName_, "TRAFODION_UPSERT") == 0 || 
+      str_cmp_c(operName_, "TRAFODION_VSBB_UPSERT") == 0 || 
+      str_cmp_c(operName_, "TRAFODION_LOAD") == 0 || 
+      str_cmp_c(operName_, "TRAFODION_DELETE") == 0 ||
+      str_cmp_c(operName_, "TRAFODION_UPDATE") == 0)
+    {
+      if ((str_str(description_, "region_transaction: enabled") != 0) ||
+          (str_str(description_, "hbase_transaction: used") != 0))
+        {
+          if (str_str(description_, "region_transaction: enabled") != 0)
+            str_cpy(current, "r", 1);
+          else if (str_str(description_, "hbase_transaction: used") != 0)
+            str_cpy(current, "h", 1);
+          ++current;
+          --remaining_width;
+        }
+    } // insert, upsert, delete
+
   //now adjust the pointer so that the width is not exceeded
   if (remaining_width <= 0)
     current += remaining_width;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/executor/ExHbaseIUD.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/ExHbaseIUD.cpp b/core/sql/executor/ExHbaseIUD.cpp
index f5b9af5..7024eec 100644
--- a/core/sql/executor/ExHbaseIUD.cpp
+++ b/core/sql/executor/ExHbaseIUD.cpp
@@ -167,6 +167,7 @@ ExWorkProcRetcode ExHbaseAccessInsertTcb::work()
 				      rowID, 
 				      row_,
                                       hbaseAccessTdb().useHbaseXn(),
+                                      hbaseAccessTdb().useRegionXn(),
 				      *insColTS_,
                                       FALSE); // AsyncOperations is always FALSE for native HBase
 
@@ -337,6 +338,7 @@ ExWorkProcRetcode ExHbaseAccessInsertRowwiseTcb::work()
 					  rowID,
 					  row_,
                                           hbaseAccessTdb().useHbaseXn(),
+                                          hbaseAccessTdb().useRegionXn(),
 					  -1,  //*insColTS_
                                           FALSE); // AsyncOperations is always FALSE for native HBase
 
@@ -536,6 +538,7 @@ ExWorkProcRetcode ExHbaseAccessInsertSQTcb::work()
                                               rowID,
 	                                      row_,
                                               hbaseAccessTdb().useHbaseXn(),
+                                              hbaseAccessTdb().useRegionXn(),
                                               insColTSval_,
                                               asyncOperation_);
 
@@ -613,6 +616,7 @@ ExWorkProcRetcode ExHbaseAccessInsertSQTcb::work()
 				      rowID,
 				      row_,
                                       hbaseAccessTdb().useHbaseXn(),
+                                      hbaseAccessTdb().useRegionXn(),
 				      insColTSval_,
                                       asyncOperation_);
 
@@ -2081,7 +2085,8 @@ ExWorkProcRetcode ExHbaseUMDtrafUniqueTaskTcb::work(short &rc)
             retcode =  tcb_->ehi_->insertRow(tcb_->table_,
                                              tcb_->rowIds_[tcb_->currRowidIdx_],
 	                                     tcb_->row_,
-					     (tcb_->hbaseAccessTdb().useHbaseXn() ? TRUE : FALSE),
+					     tcb_->hbaseAccessTdb().useHbaseXn(),
+					     tcb_->hbaseAccessTdb().useRegionXn(),
 					     -1, //colTS_
                                              tcb_->asyncOperation_);
 	    if ( tcb_->setupError(retcode, "ExpHbaseInterface::insertRow"))
@@ -2116,6 +2121,7 @@ ExWorkProcRetcode ExHbaseUMDtrafUniqueTaskTcb::work(short &rc)
 						     columnToCheck_,
 						     colValToCheck_,
                                                      tcb_->hbaseAccessTdb().useHbaseXn(),
+                                                     tcb_->hbaseAccessTdb().useRegionXn(),
 						     -1, //colTS_
                                                      tcb_->asyncOperation_);
 
@@ -2175,6 +2181,7 @@ ExWorkProcRetcode ExHbaseUMDtrafUniqueTaskTcb::work(short &rc)
                                                      rowID,
                                                      tcb_->row_,
                                                      tcb_->hbaseAccessTdb().useHbaseXn(),
+                                                     tcb_->hbaseAccessTdb().useRegionXn(),
 						     -1, // colTS
                                                      tcb_->asyncOperation_); 
 
@@ -2234,6 +2241,7 @@ ExWorkProcRetcode ExHbaseUMDtrafUniqueTaskTcb::work(short &rc)
                                              tcb_->rowIds_[tcb_->currRowidIdx_],
                                              NULL,
                                              tcb_->hbaseAccessTdb().useHbaseXn(),
+                                             tcb_->hbaseAccessTdb().useRegionXn(),
                                              latestRowTimestamp_,
                                              tcb_->asyncOperation_);
 	    if ( tcb_->setupError(retcode, "ExpHbaseInterface::deleteRow"))
@@ -2296,6 +2304,7 @@ ExWorkProcRetcode ExHbaseUMDtrafUniqueTaskTcb::work(short &rc)
 						     columnToCheck_, 
 						     colValToCheck_,
                                                      tcb_->hbaseAccessTdb().useHbaseXn(),
+                                                     tcb_->hbaseAccessTdb().useRegionXn(),
 						     -1 //colTS_
 						     );
 
@@ -2684,6 +2693,7 @@ ExWorkProcRetcode ExHbaseUMDnativeUniqueTaskTcb::work(short &rc)
                                              tcb_->rowIds_[tcb_->currRowidIdx_],
                                              &tcb_->deletedColumns_,
                                              tcb_->hbaseAccessTdb().useHbaseXn(),
+                                             tcb_->hbaseAccessTdb().useRegionXn(),
                                              -1 ,
                                              tcb_->asyncOperation_);
 	    if ( tcb_->setupError(retcode, "ExpHbaseInterface::deleteRow"))
@@ -2711,6 +2721,7 @@ ExWorkProcRetcode ExHbaseUMDnativeUniqueTaskTcb::work(short &rc)
                                                  tcb_->rowIds_[tcb_->currRowidIdx_],
                                                  tcb_->row_,
                                                  tcb_->hbaseAccessTdb().useHbaseXn(),
+                                                 tcb_->hbaseAccessTdb().useRegionXn(),
                                                  -1, // colTS_
                                                  tcb_->asyncOperation_);
 
@@ -2974,6 +2985,7 @@ ExWorkProcRetcode ExHbaseUMDtrafSubsetTaskTcb::work(short &rc)
 					    rowID,
 					    tcb_->row_,
                                             tcb_->hbaseAccessTdb().useHbaseXn(),
+                                            tcb_->hbaseAccessTdb().useRegionXn(),
 					    -1, // colTS_
                                             tcb_->asyncOperation_);
 	    if (tcb_->setupError(retcode, "ExpHbaseInterface::insertRow"))
@@ -3009,6 +3021,7 @@ ExWorkProcRetcode ExHbaseUMDtrafSubsetTaskTcb::work(short &rc)
 					     rowID,
 					     NULL,
                                              tcb_->hbaseAccessTdb().useHbaseXn(),
+                                             tcb_->hbaseAccessTdb().useRegionXn(),
 					     -1,
 					     tcb_->asyncOperation_);
 	    if ( tcb_->setupError(retcode, "ExpHbaseInterface::deleteRow"))
@@ -3384,7 +3397,8 @@ ExWorkProcRetcode ExHbaseUMDnativeSubsetTaskTcb::work(short &rc)
 		retcode = tcb_->ehi_->insertRow(tcb_->table_,
 						tcb_->rowId_,
 						tcb_->row_,
-                                                tcb_->hbaseAccessTdb().useHbaseXn(),						
+                                                tcb_->hbaseAccessTdb().useHbaseXn(),
+                                                tcb_->hbaseAccessTdb().useRegionXn(),
 						-1,// colTS_
                                                 tcb_->asyncOperation_); 
 		if (tcb_->setupError(retcode, "ExpHbaseInterface::insertRow"))
@@ -3409,6 +3423,7 @@ ExWorkProcRetcode ExHbaseUMDnativeSubsetTaskTcb::work(short &rc)
 					     tcb_->rowId_,
 					     &tcb_->deletedColumns_,
                                              tcb_->hbaseAccessTdb().useHbaseXn(),
+                                             tcb_->hbaseAccessTdb().useRegionXn(),
 					     -1,
 					     tcb_->asyncOperation_);
 	    if ( tcb_->setupError(retcode, "ExpHbaseInterface::deleteRow"))

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/executor/HBaseClient_JNI.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/HBaseClient_JNI.cpp b/core/sql/executor/HBaseClient_JNI.cpp
index 3022555..df8e924 100644
--- a/core/sql/executor/HBaseClient_JNI.cpp
+++ b/core/sql/executor/HBaseClient_JNI.cpp
@@ -266,17 +266,17 @@ HBC_RetCode HBaseClient_JNI::init()
     JavaMethods_[JM_GET_REGN_NODES].jm_name      = "getRegionsNodeName";
     JavaMethods_[JM_GET_REGN_NODES].jm_signature = "(Ljava/lang/String;[Ljava/lang/String;)Z";
     JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].jm_name      = "insertRow";
-    JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].jm_signature = "(JLjava/lang/String;ZJ[BLjava/lang/Object;JZZ)Z";
+    JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].jm_signature = "(JLjava/lang/String;ZJ[BLjava/lang/Object;JZZZ)Z";
     JavaMethods_[JM_HBC_DIRECT_INSERT_ROWS].jm_name      = "insertRows";
     JavaMethods_[JM_HBC_DIRECT_INSERT_ROWS].jm_signature = "(JLjava/lang/String;ZJSLjava/lang/Object;Ljava/lang/Object;JZ)Z";
     JavaMethods_[JM_HBC_DIRECT_CHECKANDUPDATE_ROW].jm_name      = "checkAndUpdateRow";
-    JavaMethods_[JM_HBC_DIRECT_CHECKANDUPDATE_ROW].jm_signature = "(JLjava/lang/String;ZJ[BLjava/lang/Object;[B[BJZ)Z";
+    JavaMethods_[JM_HBC_DIRECT_CHECKANDUPDATE_ROW].jm_signature = "(JLjava/lang/String;ZJ[BLjava/lang/Object;[B[BJZZ)Z";
     JavaMethods_[JM_HBC_DELETE_ROW ].jm_name      = "deleteRow";
-    JavaMethods_[JM_HBC_DELETE_ROW ].jm_signature = "(JLjava/lang/String;ZJ[B[Ljava/lang/Object;JZ)Z";
+    JavaMethods_[JM_HBC_DELETE_ROW ].jm_signature = "(JLjava/lang/String;ZJ[B[Ljava/lang/Object;JZZ)Z";
     JavaMethods_[JM_HBC_DIRECT_DELETE_ROWS ].jm_name      = "deleteRows";
     JavaMethods_[JM_HBC_DIRECT_DELETE_ROWS ].jm_signature = "(JLjava/lang/String;ZJSLjava/lang/Object;JZ)Z";
     JavaMethods_[JM_HBC_CHECKANDDELETE_ROW ].jm_name      = "checkAndDeleteRow";
-    JavaMethods_[JM_HBC_CHECKANDDELETE_ROW ].jm_signature = "(JLjava/lang/String;ZJ[B[B[BJZ)Z";
+    JavaMethods_[JM_HBC_CHECKANDDELETE_ROW ].jm_signature = "(JLjava/lang/String;ZJ[B[B[BJZZ)Z";
     JavaMethods_[JM_HBC_GETSTARTKEYS ].jm_name      = "getStartKeys";
     JavaMethods_[JM_HBC_GETSTARTKEYS ].jm_signature = "(Ljava/lang/String;Z)[[B";
     JavaMethods_[JM_HBC_GETENDKEYS ].jm_name      = "getEndKeys";
@@ -2638,7 +2638,7 @@ HBC_RetCode HBaseClient_JNI::getHbaseTableInfo(const char* tblName,
 HBC_RetCode HBaseClient_JNI::insertRow(NAHeap *heap, const char *tableName,
       ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID,
       HbaseStr row, Int64 timestamp, bool checkAndPut, bool asyncOperation,
-      HTableClient_JNI **outHtc)
+      bool useRegionXn, HTableClient_JNI **outHtc)
 {
   
   HTableClient_JNI *htc = NULL;
@@ -2689,12 +2689,14 @@ HBC_RetCode HBaseClient_JNI::insertRow(NAHeap *heap, const char *tableName,
   jlong j_ts = timestamp;
   jboolean j_checkAndPut = checkAndPut;
   jboolean j_asyncOperation = asyncOperation;
- 
+  jboolean j_useRegionXn = useRegionXn;
+
   if (hbs)
     hbs->getHbaseTimer().start();
   tsRecentJMFromJNI = JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].jm_full_name;
-  jboolean jresult = jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].methodID, 
-               	j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, jRow, j_ts, j_checkAndPut, j_asyncOperation);
+  jboolean jresult = 
+    jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_HBC_DIRECT_INSERT_ROW].methodID, 
+                             j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, jRow, j_ts, j_checkAndPut, j_asyncOperation, j_useRegionXn);
   if (hbs) {
       hbs->incHbaseCalls();
       if (!asyncOperation)
@@ -2817,10 +2819,10 @@ HBC_RetCode HBaseClient_JNI::insertRows(NAHeap *heap, const char *tableName,
 // 
 //////////////////////////////////////////////////////////////////////////////
 HBC_RetCode HBaseClient_JNI::checkAndUpdateRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID,
-      HbaseStr row, HbaseStr columnToCheck, HbaseStr columnValToCheck,
-       Int64 timestamp, bool asyncOperation,
-      HTableClient_JNI **outHtc)
+                                               ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID,
+                                               HbaseStr row, HbaseStr columnToCheck, HbaseStr columnValToCheck,
+                                               Int64 timestamp, bool asyncOperation, bool useRegionXn,
+                                               HTableClient_JNI **outHtc)
 {
   
   HTableClient_JNI *htc = NULL;
@@ -2891,13 +2893,15 @@ HBC_RetCode HBaseClient_JNI::checkAndUpdateRow(NAHeap *heap, const char *tableNa
   jlong j_tid = transID;  
   jlong j_ts = timestamp;
   jboolean j_asyncOperation = asyncOperation;
- 
+  jboolean j_useRegionXn = useRegionXn;
+
   if (hbs)
     hbs->getHbaseTimer().start();
   tsRecentJMFromJNI = JavaMethods_[JM_HBC_DIRECT_CHECKANDUPDATE_ROW].jm_full_name;
   jboolean jresult = jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_HBC_DIRECT_CHECKANDUPDATE_ROW].methodID, 
-               	j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, jRow,
-                jba_columnToCheck, jba_columnValToCheck,  j_ts, j_asyncOperation);
+                                              j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, jRow,
+                                              jba_columnToCheck, jba_columnValToCheck,  j_ts, 
+                                              j_asyncOperation, j_useRegionXn);
   if (hbs) {
       hbs->incHbaseCalls();
       if (!asyncOperation)
@@ -2930,8 +2934,12 @@ HBC_RetCode HBaseClient_JNI::checkAndUpdateRow(NAHeap *heap, const char *tableNa
 // 
 //////////////////////////////////////////////////////////////////////////////
 HBC_RetCode HBaseClient_JNI::deleteRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, const LIST(HbaseStr) *cols, 
-      Int64 timestamp, bool asyncOperation, HTableClient_JNI **outHtc)
+                                       ExHbaseAccessStats *hbs, bool useTRex, 
+                                       Int64 transID, HbaseStr rowID, 
+                                       const LIST(HbaseStr) *cols, 
+                                       Int64 timestamp, 
+                                       bool asyncOperation, bool useRegionXn,
+                                       HTableClient_JNI **outHtc)
 {
   QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HBaseClient_JNI::deleteRow(%ld, %s) called.", transID, rowID.val);
 
@@ -2985,12 +2993,14 @@ HBC_RetCode HBaseClient_JNI::deleteRow(NAHeap *heap, const char *tableName,
   jlong j_tid = transID;  
   jlong j_ts = timestamp;
   jboolean j_asyncOperation = asyncOperation;
+  jboolean j_useRegionXn = useRegionXn;
   if (hbs)
     hbs->getHbaseTimer().start();
   tsRecentJMFromJNI = JavaMethods_[JM_HBC_DELETE_ROW].jm_full_name;
-  jboolean jresult = jenv_->CallBooleanMethod(javaObj_, 
-          JavaMethods_[JM_HBC_DELETE_ROW].methodID, j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, 
-          j_cols, j_ts, j_asyncOperation);
+  jboolean jresult = 
+    jenv_->CallBooleanMethod(javaObj_, 
+                             JavaMethods_[JM_HBC_DELETE_ROW].methodID, j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, 
+                             j_cols, j_ts, j_asyncOperation, j_useRegionXn);
   if (hbs) {
       hbs->incHbaseCalls();
       if (!asyncOperation) 
@@ -3106,9 +3116,10 @@ HBC_RetCode HBaseClient_JNI::deleteRows(NAHeap *heap, const char *tableName,
 // 
 //////////////////////////////////////////////////////////////////////////////
 HBC_RetCode HBaseClient_JNI::checkAndDeleteRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, 
-      HbaseStr columnToCheck, HbaseStr columnValToCheck,
-      Int64 timestamp, bool asyncOperation, HTableClient_JNI **outHtc)
+                                               ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, 
+                                               HbaseStr columnToCheck, HbaseStr columnValToCheck,
+                                               Int64 timestamp, bool asyncOperation, bool useRegionXn,
+                                               HTableClient_JNI **outHtc)
 {
   QRLogger::log(CAT_SQL_HBASE, LL_DEBUG, "HBaseClient_JNI::checkAndDeleteRow(%ld, %s) called.", transID, rowID.val);
 
@@ -3167,12 +3178,14 @@ HBC_RetCode HBaseClient_JNI::checkAndDeleteRow(NAHeap *heap, const char *tableNa
   jlong j_tid = transID;  
   jlong j_ts = timestamp;
   jboolean j_asyncOperation = asyncOperation;
+  jboolean j_useRegionXn = useRegionXn;
   if (hbs)
     hbs->getHbaseTimer().start();
   tsRecentJMFromJNI = JavaMethods_[JM_HBC_CHECKANDDELETE_ROW].jm_full_name;
   jboolean jresult = jenv_->CallBooleanMethod(javaObj_, 
-          JavaMethods_[JM_HBC_CHECKANDDELETE_ROW].methodID, j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, 
-          jba_columnToCheck, jba_columnValToCheck, j_ts, j_asyncOperation);
+                                              JavaMethods_[JM_HBC_CHECKANDDELETE_ROW].methodID, j_htc, js_tblName, j_useTRex, j_tid, jba_rowID, 
+                                              jba_columnToCheck, jba_columnValToCheck, j_ts, 
+                                              j_asyncOperation, j_useRegionXn);
   if (hbs) {
       hbs->incHbaseCalls();
       if (!asyncOperation) 
@@ -3360,7 +3373,7 @@ HTC_RetCode HTableClient_JNI::init()
     JavaMethods_[JM_SCAN_OPEN  ].jm_name      = "startScan";
     JavaMethods_[JM_SCAN_OPEN  ].jm_signature = "(J[B[B[Ljava/lang/Object;JZZI[Ljava/lang/Object;[Ljava/lang/Object;[Ljava/lang/Object;FFZZILjava/lang/String;Ljava/lang/String;II)Z";
     JavaMethods_[JM_DELETE     ].jm_name      = "deleteRow";
-    JavaMethods_[JM_DELETE     ].jm_signature = "(J[B[Ljava/lang/Object;JZ)Z";
+    JavaMethods_[JM_DELETE     ].jm_signature = "(J[B[Ljava/lang/Object;JZZ)Z";
     JavaMethods_[JM_COPROC_AGGR     ].jm_name      = "coProcAggr";
     JavaMethods_[JM_COPROC_AGGR     ].jm_signature = "(JI[B[B[B[BZI)[B";
     JavaMethods_[JM_GET_NAME   ].jm_name      = "getTableName";
@@ -3640,8 +3653,9 @@ HTC_RetCode HTableClient_JNI::deleteRow(Int64 transID, HbaseStr &rowID, const LI
     hbs_->getHbaseTimer().start();
   tsRecentJMFromJNI = JavaMethods_[JM_DELETE].jm_full_name;
   jboolean j_asyncOperation = FALSE;
+  jboolean j_useRegionXn = FALSE;
   jboolean jresult = jenv_->CallBooleanMethod(javaObj_, 
-          JavaMethods_[JM_DELETE].methodID, j_tid, jba_rowID, j_cols, j_ts, j_asyncOperation);
+                                              JavaMethods_[JM_DELETE].methodID, j_tid, jba_rowID, j_cols, j_ts, j_asyncOperation, j_useRegionXn);
   if (hbs_)
     {
       hbs_->incMaxHbaseIOTime(hbs_->getHbaseTimer().stop());

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/executor/HBaseClient_JNI.h
----------------------------------------------------------------------
diff --git a/core/sql/executor/HBaseClient_JNI.h b/core/sql/executor/HBaseClient_JNI.h
index 1052fc5..d0eeeb2 100644
--- a/core/sql/executor/HBaseClient_JNI.h
+++ b/core/sql/executor/HBaseClient_JNI.h
@@ -476,28 +476,36 @@ public:
                  const char * qualName , Int64 incr, Int64 & count);
   HBC_RetCode createCounterTable( const char * tabName,  const char * famName);
   HBC_RetCode insertRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID,
-      HbaseStr row, Int64 timestamp,bool checkAndPut, bool asyncOperation,
-      HTableClient_JNI **outHtc);
+                        ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, 
+                        HbaseStr rowID,
+                        HbaseStr row, Int64 timestamp,bool checkAndPut, 
+                        bool asyncOperation, bool useRegionXn, 
+                        HTableClient_JNI **outHtc);
   HBC_RetCode insertRows(NAHeap *heap, const char *tableName,
       ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, short rowIDLen, HbaseStr rowIDs,
       HbaseStr rows, Int64 timestamp,  bool asyncOperation,
       HTableClient_JNI **outHtc);
   HBC_RetCode checkAndUpdateRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID,
-      HbaseStr row, HbaseStr columnToCheck, HbaseStr columnValToCheck,
-       Int64 timestamp, bool asyncOperation,
-      HTableClient_JNI **outHtc);
+                                ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, 
+                                HbaseStr rowID,
+                                HbaseStr row, HbaseStr columnToCheck, HbaseStr columnValToCheck,
+                                Int64 timestamp, bool asyncOperation, bool useRegionXn,
+                                HTableClient_JNI **outHtc);
   HBC_RetCode deleteRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, const LIST(HbaseStr) *cols, 
-      Int64 timestamp, bool asyncOperation, HTableClient_JNI **outHtc);
+      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, 
+                        const LIST(HbaseStr) *cols, 
+                        Int64 timestamp, 
+                        bool asyncOperation, 
+                        bool useRegionXn,
+                        HTableClient_JNI **outHtc);
   HBC_RetCode deleteRows(NAHeap *heap, const char *tableName,
       ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, short rowIDLen, HbaseStr rowIDs, 
       Int64 timestamp, bool asyncOperation, HTableClient_JNI **outHtc);
   HBC_RetCode checkAndDeleteRow(NAHeap *heap, const char *tableName,
-      ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, 
-      HbaseStr columnToCheck, HbaseStr columnValToCheck,
-      Int64 timestamp, bool asyncOperation, HTableClient_JNI **outHtc);
+                                ExHbaseAccessStats *hbs, bool useTRex, Int64 transID, HbaseStr rowID, 
+                                HbaseStr columnToCheck, HbaseStr columnValToCheck,
+                                Int64 timestamp, bool asyncOperation, bool useRegionXn,
+                                HTableClient_JNI **outHtc);
   NAArray<HbaseStr>* getStartKeys(NAHeap *heap, const char *tableName, bool useTRex);
   NAArray<HbaseStr>* getEndKeys(NAHeap *heap, const char * tableName, bool useTRex);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/exp/ExpHbaseInterface.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpHbaseInterface.cpp b/core/sql/exp/ExpHbaseInterface.cpp
index 83fe298..0b5a77f 100644
--- a/core/sql/exp/ExpHbaseInterface.cpp
+++ b/core/sql/exp/ExpHbaseInterface.cpp
@@ -420,7 +420,7 @@ Lng32 ExpHbaseInterface_JNI::create(HbaseStr &tblName,
 				    NAText * hbaseCreateOptionsArray,
                                     int numSplits, int keyLength,
                                     const char ** splitValues,
-                                    NABoolean noXn,
+                                    NABoolean useHbaseXn,
                                     NABoolean isMVCC)
 {
   if (client_ == NULL)
@@ -430,7 +430,7 @@ Lng32 ExpHbaseInterface_JNI::create(HbaseStr &tblName,
   }
   
   Int64 transID;
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -448,7 +448,7 @@ Lng32 ExpHbaseInterface_JNI::create(HbaseStr &tblName,
 //----------------------------------------------------------------------------
 Lng32 ExpHbaseInterface_JNI::alter(HbaseStr &tblName,
 				   NAText * hbaseCreateOptionsArray,
-                                   NABoolean noXn)
+                                   NABoolean useHbaseXn)
 {
   if (client_ == NULL)
   {
@@ -457,7 +457,7 @@ Lng32 ExpHbaseInterface_JNI::alter(HbaseStr &tblName,
   }
   
   Int64 transID = 0;
-  if (!noXn)
+  if (!useHbaseXn)
     transID = getTransactionIDFromContext();
  
   retCode_ = client_->alter(tblName.val, hbaseCreateOptionsArray, transID);
@@ -469,7 +469,7 @@ Lng32 ExpHbaseInterface_JNI::alter(HbaseStr &tblName,
 }
 
 //----------------------------------------------------------------------------
-Lng32 ExpHbaseInterface_JNI::registerTruncateOnAbort(HbaseStr &tblName, NABoolean noXn)
+Lng32 ExpHbaseInterface_JNI::registerTruncateOnAbort(HbaseStr &tblName, NABoolean useHbaseXn)
 {
   if (client_ == NULL)
   {
@@ -478,7 +478,7 @@ Lng32 ExpHbaseInterface_JNI::registerTruncateOnAbort(HbaseStr &tblName, NABoolea
   }
 
   Int64 transID;
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -493,7 +493,7 @@ Lng32 ExpHbaseInterface_JNI::registerTruncateOnAbort(HbaseStr &tblName, NABoolea
 
 
 //----------------------------------------------------------------------------
-Lng32 ExpHbaseInterface_JNI::drop(HbaseStr &tblName, NABoolean async, NABoolean noXn)
+Lng32 ExpHbaseInterface_JNI::drop(HbaseStr &tblName, NABoolean async, NABoolean useHbaseXn)
 {
   if (client_ == NULL)
   {
@@ -502,7 +502,7 @@ Lng32 ExpHbaseInterface_JNI::drop(HbaseStr &tblName, NABoolean async, NABoolean
   }
    
   Int64 transID;
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -518,7 +518,7 @@ Lng32 ExpHbaseInterface_JNI::drop(HbaseStr &tblName, NABoolean async, NABoolean
 
 //----------------------------------------------------------------------------
 Lng32 ExpHbaseInterface_JNI::dropAll(const char * pattern, NABoolean async, 
-                                     NABoolean noXn)
+                                     NABoolean useHbaseXn)
 {
   if (client_ == NULL)
   {
@@ -527,7 +527,7 @@ Lng32 ExpHbaseInterface_JNI::dropAll(const char * pattern, NABoolean async,
   }
 
   Int64 transID;
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -608,7 +608,7 @@ Lng32 ExpHbaseInterface_JNI::scanOpen(
 				      const Text& stopRow, 
 				      const LIST(HbaseStr) & columns,
 				      const int64_t timestamp,
-				      const NABoolean noXn,
+				      const NABoolean useHbaseXn,
 				      const NABoolean cacheBlocks,
 				      const NABoolean smallScanner,
 				      const Lng32 numCacheRows,
@@ -633,7 +633,7 @@ Lng32 ExpHbaseInterface_JNI::scanOpen(
   }
 
   // if this scan is running under a transaction, pass that
-  // transid even if noXn is set. This will ensure that selected
+  // transid even if useHbaseXn is set. This will ensure that selected
   // rows are returned from the transaction cache instead of underlying
   // storage engine.
   Int64 transID;
@@ -712,19 +712,21 @@ Lng32 ExpHbaseInterface_JNI::deleteRow(
 	  HbaseStr tblName,
 	  HbaseStr row, 
 	  const LIST(HbaseStr) *columns,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
+          NABoolean useRegionXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
-
 {
   HTableClient_JNI *htc;
   Int64 transID;
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
-  retCode_ = client_->deleteRow((NAHeap *)heap_, tblName.val, hbs_, useTRex_, transID, row, columns, timestamp, asyncOperation, &htc);
+  retCode_ = client_->deleteRow((NAHeap *)heap_, tblName.val, hbs_, useTRex_, 
+                                transID, row, columns, timestamp, 
+                                asyncOperation, useRegionXn, &htc);
   if (retCode_ != HBC_OK) {
     return -HBASE_ACCESS_ERROR;
   }
@@ -740,14 +742,14 @@ Lng32 ExpHbaseInterface_JNI::deleteRows(
 	  HbaseStr tblName,
           short rowIDLen,
 	  HbaseStr rowIDs,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
 {
   HTableClient_JNI *htc;
   Int64 transID;
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -768,19 +770,23 @@ Lng32 ExpHbaseInterface_JNI::checkAndDeleteRow(
 	  HbaseStr& rowID, 
 	  HbaseStr& columnToCheck,
 	  HbaseStr& columnValToCheck,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
+          NABoolean useRegionXn,
 	  const int64_t timestamp)
 
 {
   HTableClient_JNI *htc;
   bool asyncOperation = false;
   Int64 transID;
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
-  retCode_ = client_->checkAndDeleteRow((NAHeap *)heap_, tblName.val, hbs_, useTRex_, transID, rowID, columnToCheck, 
-                     columnValToCheck,timestamp, asyncOperation, &htc);
+  retCode_ = client_->checkAndDeleteRow((NAHeap *)heap_, tblName.val, hbs_, 
+                                        useTRex_, transID, rowID, 
+                                        columnToCheck, 
+                                        columnValToCheck, timestamp, 
+                                        asyncOperation, useRegionXn, &htc);
   if (retCode_ == HBC_ERROR_CHECKANDDELETEROW_NOTFOUND) {
     return HBASE_ROW_NOTFOUND_ERROR;
   } else
@@ -799,7 +805,8 @@ Lng32 ExpHbaseInterface_JNI::insertRow(
 	  HbaseStr tblName,
 	  HbaseStr rowID, 
           HbaseStr row,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
+          NABoolean useRegionXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
 {
@@ -807,12 +814,13 @@ Lng32 ExpHbaseInterface_JNI::insertRow(
   Int64 transID; 
   NABoolean checkAndPut = FALSE;
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
   retCode_ = client_->insertRow((NAHeap *)heap_, tblName.val, hbs_,
-                      useTRex_, transID, rowID, row, timestamp, checkAndPut, asyncOperation, &htc);
+                                useTRex_, transID, rowID, row, timestamp, 
+                                checkAndPut, asyncOperation, useRegionXn, &htc);
   if (retCode_ != HBC_OK) {
     return -HBASE_ACCESS_ERROR;
   }
@@ -829,14 +837,14 @@ Lng32 ExpHbaseInterface_JNI::insertRows(
           short rowIDLen,
           HbaseStr rowIDs,
           HbaseStr rows,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
 {
   HTableClient_JNI *htc;
   Int64 transID;
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0;
   else
     transID = getTransactionIDFromContext();
@@ -1161,7 +1169,8 @@ Lng32 ExpHbaseInterface_JNI::checkAndInsertRow(
 	  HbaseStr &tblName,
 	  HbaseStr &rowID, 
 	  HbaseStr &row,
-	  NABoolean noXn,
+	  NABoolean useHbaseXn,
+          NABoolean useRegionXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
 {
@@ -1169,12 +1178,14 @@ Lng32 ExpHbaseInterface_JNI::checkAndInsertRow(
   Int64 transID; 
   NABoolean checkAndPut = TRUE;
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0; 
   else 
     transID = getTransactionIDFromContext();
   retCode_ = client_->insertRow((NAHeap *)heap_, tblName.val, hbs_,
-                      useTRex_, transID, rowID, row, timestamp, checkAndPut, asyncOperation, &htc);
+                                useTRex_, transID, rowID, row, timestamp, 
+                                checkAndPut, asyncOperation, useRegionXn,
+                                &htc);
 
   if (retCode_ == HBC_ERROR_INSERTROW_DUP_ROWID) {
      return HBASE_DUP_ROW_ERROR;
@@ -1196,7 +1207,8 @@ Lng32 ExpHbaseInterface_JNI::checkAndUpdateRow(
 	  HbaseStr &row,
 	  HbaseStr& columnToCheck,
 	  HbaseStr& colValToCheck,
-          NABoolean noXn,
+          NABoolean useHbaseXn,
+          NABoolean useRegionXn,
 	  const int64_t timestamp,
           NABoolean asyncOperation)
 
@@ -1204,12 +1216,15 @@ Lng32 ExpHbaseInterface_JNI::checkAndUpdateRow(
   HTableClient_JNI *htc;
   Int64 transID; 
 
-  if (noXn)
+  if (useHbaseXn)
     transID = 0; 
   else 
     transID = getTransactionIDFromContext();
   retCode_ = client_->checkAndUpdateRow((NAHeap *)heap_, tblName.val, hbs_,
-                      useTRex_, transID, rowID, row, columnToCheck, colValToCheck, timestamp, asyncOperation, &htc);
+                                        useTRex_, transID, rowID, row, 
+                                        columnToCheck, colValToCheck, 
+                                        timestamp, asyncOperation, useRegionXn,
+                                        &htc);
 
   if (retCode_  == HBC_ERROR_CHECKANDUPDATEROW_NOTFOUND) {
      return HBASE_ROW_NOTFOUND_ERROR;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/exp/ExpHbaseInterface.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpHbaseInterface.h b/core/sql/exp/ExpHbaseInterface.h
index a8903fe..bf4a355 100644
--- a/core/sql/exp/ExpHbaseInterface.h
+++ b/core/sql/exp/ExpHbaseInterface.h
@@ -92,15 +92,16 @@ class ExpHbaseInterface : public NABasicObject
 		       NAText * hbaseCreateOptionsArray,
                        int numSplits, int keyLength,
                        const char ** splitValues,
-                       NABoolean noXn,
+                       NABoolean useHbaseXn,
                        NABoolean isMVCC) =0;
 
   virtual Lng32 alter(HbaseStr &tblName,
 		      NAText * hbaseCreateOptionsArray,
-                      NABoolean noXn) =0;
+                      NABoolean useHbaseXn) = 0;
 
   // During upsert using load, register truncate on abort will be used
-  virtual Lng32 registerTruncateOnAbort(HbaseStr &tblName, NABoolean noXn) = 0;
+  virtual Lng32 registerTruncateOnAbort(HbaseStr &tblName, 
+                                        NABoolean useHbaseXn) = 0;
 
   // During a drop of seabase table or index, the object is first removed from 
   // seabase metadata. If that succeeds, the corresponding hbase object is dropped.
@@ -109,10 +110,10 @@ class ExpHbaseInterface : public NABasicObject
   // If a create of the same table comes in later and an error is returned
   // during create, we delay and retry for a fixed number of times since that table
   // may still be dropped by the worked thread.
-  virtual Lng32 drop(HbaseStr &tblName, NABoolean async, NABoolean noXn) = 0;
+  virtual Lng32 drop(HbaseStr &tblName, NABoolean async, NABoolean useHbaseXn) = 0;
 
   // drops all objects from hbase that match the pattern
-  virtual Lng32 dropAll(const char * pattern, NABoolean async, NABoolean noXn) = 0;
+  virtual Lng32 dropAll(const char * pattern, NABoolean async, NABoolean useHbaseXn) = 0;
 
   // retrieve all objects from hbase that match the pattern
   virtual NAArray<HbaseStr> *listAll(const char * pattern) = 0;
@@ -206,7 +207,8 @@ class ExpHbaseInterface : public NABasicObject
 		  HbaseStr tblName,
 		  HbaseStr row, 
 		  const LIST(HbaseStr) *columns,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
+                  NABoolean useRegionXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation) = 0;
 
@@ -216,7 +218,7 @@ class ExpHbaseInterface : public NABasicObject
 		  HbaseStr tblName,
                   short rowIDLen,
 		  HbaseStr rowIDs,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation) = 0;
 
@@ -226,7 +228,8 @@ class ExpHbaseInterface : public NABasicObject
 				  HbaseStr& row, 
 				  HbaseStr& columnToCheck,
 				  HbaseStr& colValToCheck,
-                                  NABoolean noXn,
+                                  NABoolean useHbaseXn,
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp) = 0;
 
 
@@ -239,7 +242,8 @@ class ExpHbaseInterface : public NABasicObject
 		  HbaseStr tblName,
 		  HbaseStr rowID, 
 		  HbaseStr row,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
+                  NABoolean useRegionXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation) = 0;
 
@@ -254,7 +258,7 @@ class ExpHbaseInterface : public NABasicObject
                   short rowIDLen,
                   HbaseStr rowIDs,
                   HbaseStr rows,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation) = 0; 
  
@@ -303,7 +307,8 @@ class ExpHbaseInterface : public NABasicObject
 				  HbaseStr &tblName,
 				  HbaseStr& rowID, 
 				  HbaseStr& row,
-                                  NABoolean noXn,
+                                  NABoolean useHbaseXn,
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp,
                                   NABoolean asyncOperation) = 0;
 
@@ -314,7 +319,8 @@ class ExpHbaseInterface : public NABasicObject
 				  HbaseStr& row,
 				  HbaseStr& columnToCheck,
 				  HbaseStr& colValToCheck,
-                                  NABoolean noXn,				
+                                  NABoolean useHbaseXn,
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp,
                                   NABoolean asyncOperation) = 0;
 
@@ -415,17 +421,17 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
 	               NAText* hbaseCreateOptionsArray,
                        int numSplits, int keyLength,
                        const char ** splitValues,
-                       NABoolean noXn,
+                       NABoolean useHbaseXn,
                        NABoolean isMVCC);
 
   virtual Lng32 alter(HbaseStr &tblName,
 		      NAText * hbaseCreateOptionsArray,
-                      NABoolean noXn);
+                      NABoolean useHbaseXn);
 
-  virtual Lng32 registerTruncateOnAbort(HbaseStr &tblName, NABoolean noXn);
+  virtual Lng32 registerTruncateOnAbort(HbaseStr &tblName, NABoolean useHbaseXn);
 
-  virtual Lng32 drop(HbaseStr &tblName, NABoolean async, NABoolean noXn);
-  virtual Lng32 dropAll(const char * pattern, NABoolean async, NABoolean noXn);
+  virtual Lng32 drop(HbaseStr &tblName, NABoolean async, NABoolean useHbaseXn);
+  virtual Lng32 dropAll(const char * pattern, NABoolean async, NABoolean useHbaseXn);
 
   virtual NAArray<HbaseStr>* listAll(const char * pattern);
 
@@ -509,7 +515,8 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
 		  HbaseStr tblName,
 		  HbaseStr row, 
 		  const LIST(HbaseStr) *columns,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
+                  NABoolean useRegionXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation);
 
@@ -518,7 +525,7 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
 		  HbaseStr tblName,
                   short rowIDLen,
 		  HbaseStr rowIDs,
-		  NABoolean noXn,		 		  
+		  NABoolean useHbaseXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation);
 
@@ -528,7 +535,8 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
 				  HbaseStr& row, 
 				  HbaseStr& columnToCheck,
 				  HbaseStr& colValToCheck,
-                                  NABoolean noXn,     
+                                  NABoolean useHbaseXn,     
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp);
 
 
@@ -540,7 +548,8 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
 		  HbaseStr tblName,
 		  HbaseStr rowID, 
                   HbaseStr row,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
+                  NABoolean useRegionXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation);
 
@@ -555,7 +564,7 @@ class ExpHbaseInterface_JNI : public ExpHbaseInterface
                   short rowIDLen,
                   HbaseStr rowIDs,
                   HbaseStr rows,
-		  NABoolean noXn,
+		  NABoolean useHbaseXn,
 		  const int64_t timestamp,
                   NABoolean asyncOperation); 
   
@@ -603,7 +612,8 @@ virtual Lng32 initHFileParams(HbaseStr &tblName,
 				  HbaseStr &tblName,
 				  HbaseStr& rowID, 
 				  HbaseStr& row,
-                                  NABoolean noXn,
+                                  NABoolean useHbaseXn,
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp,
                   		  NABoolean asyncOperation);
 
@@ -615,7 +625,8 @@ virtual Lng32 initHFileParams(HbaseStr &tblName,
 				  HbaseStr& row,
 				  HbaseStr& columnToCheck,
 				  HbaseStr& colValToCheck,
-                                  NABoolean noXn,			
+                                  NABoolean useHbaseXn,			
+                                  NABoolean useRegionXn,
 				  const int64_t timestamp,
                                   NABoolean asyncOperation);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/generator/GenExplain.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenExplain.cpp b/core/sql/generator/GenExplain.cpp
index aca22da..b0ef8f9 100644
--- a/core/sql/generator/GenExplain.cpp
+++ b/core/sql/generator/GenExplain.cpp
@@ -2035,6 +2035,14 @@ GenericUpdate::addSpecificExplainInfo(ExplainTupleMaster *explainTuple,
     description += lbuf;
   }
 
+  if (natable->isSeabaseTable())
+    {
+      if (((ComTdbHbaseAccess *)tdb)->useRegionXn())
+        description += "region_transaction: enabled ";
+      else if (((ComTdbHbaseAccess *)tdb)->useHbaseXn())
+        description += "hbase_transaction: used ";
+    }
+
   return 0;
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/generator/GenPreCode.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenPreCode.cpp b/core/sql/generator/GenPreCode.cpp
index 5d36854..a5af7fe 100644
--- a/core/sql/generator/GenPreCode.cpp
+++ b/core/sql/generator/GenPreCode.cpp
@@ -5048,22 +5048,28 @@ RelExpr * HbaseDelete::preCodeGen(Generator * generator,
   generator->setUpdSavepointOnError(FALSE);
   generator->setUpdPartialOnError(FALSE);
   
-  if (CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON)
-    noDTMxn() = TRUE;
-  
   // if unique oper with no index maintanence and autocommit is on, then
-  // do not require a trnsaction. Hbase guarantees single row consistency.
+  // do not require a trnsaction. 
+  // Use hbase or region transactions. 
+  // Hbase guarantees single row consistency.
   Int64 transId = -1;
-  if (((uniqueHbaseOper()) &&
-       (NOT cursorHbaseOper()) &&
-       (NOT uniqueRowsetHbaseOper()) &&
-       (NOT inlinedActions) &&
-       (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
-       (! NAExecTrans(0, transId)) &&
-       (NOT generator->oltOptInfo()->multipleRowsReturned())) ||
-      (noDTMxn()))
+  if (CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON)
     {
       // no transaction needed
+      noDTMxn() = TRUE;
+    }
+  else if ((uniqueHbaseOper()) &&
+           (NOT cursorHbaseOper()) &&
+           (NOT uniqueRowsetHbaseOper()) &&
+           (NOT inlinedActions) &&
+           (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
+           (! NAExecTrans(0, transId)) &&
+           (NOT generator->oltOptInfo()->multipleRowsReturned()))
+    {
+      // no DTM transaction needed
+      useRegionXn() = FALSE;
+      if (CmpCommon::getDefault(TRAF_USE_REGION_XN) == DF_ON)
+        useRegionXn() = TRUE;
     }
   else
     {
@@ -5319,30 +5325,29 @@ RelExpr * HbaseUpdate::preCodeGen(Generator * generator,
   generator->setUpdSavepointOnError(FALSE);
   generator->setUpdPartialOnError(FALSE);
 
-  // if seq gen metadata is being updated through an internal query 
-  // and we are running under a user Xn,
-  // do not mark this stmt as a transactional stmt.
-  // This is done so those updates can run in its own transaction and not be
-  // part of the enclosing user Xn.
-  // When we have support for local transactions and repeatable read, we
-  // will then run this update in local transactional mode.
-  if (CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON)
-    noDTMxn() = TRUE;
-
   // if unique oper with no index maintanence and autocommit is on, then
-  // do not require a transaction. Hbase guarantees single row consistency.
+  // do not require a transaction. 
+  // Use hbase or region transactions. 
+  // Hbase guarantees single row consistency.
   Int64 transId = -1;
-  if (((uniqueHbaseOper()) &&
-       (NOT isMerge()) &&
-       (NOT cursorHbaseOper()) &&
-       (NOT uniqueRowsetHbaseOper()) &&
-       (NOT inlinedActions) &&
-       (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
-       (! NAExecTrans(0, transId)) &&
-       (NOT generator->oltOptInfo()->multipleRowsReturned())) ||
-      (noDTMxn()))
+  if (CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON)
     {
       // no transaction needed
+      noDTMxn() = TRUE;
+    }
+  else if ((uniqueHbaseOper()) &&
+           (NOT isMerge()) &&
+           (NOT cursorHbaseOper()) &&
+           (NOT uniqueRowsetHbaseOper()) &&
+           (NOT inlinedActions) &&
+           (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
+           (! NAExecTrans(0, transId)) &&
+           (NOT generator->oltOptInfo()->multipleRowsReturned()))
+    {
+      // no DTM transaction needed
+      useRegionXn() = FALSE;
+      if (CmpCommon::getDefault(TRAF_USE_REGION_XN) == DF_ON)
+        useRegionXn() = TRUE;
     }
   else
     {
@@ -5611,23 +5616,29 @@ RelExpr * HbaseInsert::preCodeGen(Generator * generator,
   generator->setUpdSavepointOnError(FALSE);
   generator->setUpdPartialOnError(FALSE);
 
-  if (CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON)
-    noDTMxn() = TRUE;
-  
   // if unique oper with no index maintanence and autocommit is on, then
-  // do not require a trnsaction. Hbase guarantees single row consistency.
+  // do not require a trnsaction. 
+  // Use hbase or region transactions. 
+  // Hbase guarantees single row consistency.
   Int64 transId = -1;
-  if (((uniqueHbaseOper()) &&
-       (NOT uniqueRowsetHbaseOper()) &&
-       (NOT inlinedActions) &&
-       (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
-       (! NAExecTrans(0, transId)) &&
-       (NOT generator->oltOptInfo()->multipleRowsReturned())) ||
+  if ((CmpCommon::getDefault(TRAF_NO_DTM_XN) == DF_ON) ||
       (isNoRollback()) ||
-      ((isUpsert()) && (insertType_ == UPSERT_LOAD)) ||
-      (noDTMxn()))
+      ((isUpsert()) && (insertType_ == UPSERT_LOAD)))
     {
       // no transaction needed
+      noDTMxn() = TRUE;
+    }
+  else if ((uniqueHbaseOper()) &&
+           (NOT uniqueRowsetHbaseOper()) &&
+           (NOT inlinedActions) &&
+           (generator->getTransMode()->getAutoCommit() == TransMode::ON_) &&
+           (! NAExecTrans(0, transId)) &&
+           (NOT generator->oltOptInfo()->multipleRowsReturned()))
+    {
+      // no DTM transaction needed
+      useRegionXn() = FALSE;
+      if (CmpCommon::getDefault(TRAF_USE_REGION_XN) == DF_ON)
+        useRegionXn() = TRUE;
     }
   else
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/generator/GenRelUpdate.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelUpdate.cpp b/core/sql/generator/GenRelUpdate.cpp
index e85f8b2..e5fac6c 100644
--- a/core/sql/generator/GenRelUpdate.cpp
+++ b/core/sql/generator/GenRelUpdate.cpp
@@ -1353,6 +1353,16 @@ short HbaseDelete::codeGen(Generator * generator)
   if (csl())
     hbasescan_tdb->setUpdelColnameIsStr(TRUE);
 
+  if (preCondExpr)
+    hbasescan_tdb->setInsDelPreCondExpr(preCondExpr);
+
+  if (generator->isTransactionNeeded())
+    setTransactionRequired(generator);
+  else if (noDTMxn())
+    hbasescan_tdb->setUseHbaseXn(TRUE);
+  else if (useRegionXn())
+    hbasescan_tdb->setUseRegionXn(TRUE);
+
   if(!generator->explainDisabled()) {
     generator->setExplainTuple(
        addExplainInfo(hbasescan_tdb, 0, 0, generator));
@@ -1366,14 +1376,6 @@ short HbaseDelete::codeGen(Generator * generator)
 					   getPertableStatsTdbId());
     }
 
-  if (preCondExpr)
-    hbasescan_tdb->setInsDelPreCondExpr(preCondExpr);
-
-  if (generator->isTransactionNeeded())
-    setTransactionRequired(generator);
-  else if (noDTMxn())
-    hbasescan_tdb->setUseHbaseXn(TRUE);
-
   generator->setFoundAnUpdate(TRUE);
 
   generator->setCriDesc(givenDesc, Generator::DOWN);
@@ -2224,6 +2226,13 @@ short HbaseUpdate::codeGen(Generator * generator)
   if (canDoCheckAndUpdel())
     hbasescan_tdb->setCanDoCheckAndUpdel(TRUE);
 
+  if (generator->isTransactionNeeded())
+    setTransactionRequired(generator);
+  else if (noDTMxn())
+    hbasescan_tdb->setUseHbaseXn(TRUE);
+  else if (useRegionXn())
+    hbasescan_tdb->setUseRegionXn(TRUE);
+
   if(!generator->explainDisabled()) {
     generator->setExplainTuple(
        addExplainInfo(hbasescan_tdb, 0, 0, generator));
@@ -2237,16 +2246,6 @@ short HbaseUpdate::codeGen(Generator * generator)
 					   getPertableStatsTdbId());
     }
 
-  if (generator->isTransactionNeeded())
-    {
-      setTransactionRequired(generator);
-    }
-  else
-    {
-      if (noDTMxn())
-        hbasescan_tdb->setUseHbaseXn(TRUE);
-    }
-
   generator->setFoundAnUpdate(TRUE);
 
   generator->setCriDesc(givenDesc, Generator::DOWN);
@@ -2991,6 +2990,13 @@ short HbaseInsert::codeGen(Generator *generator)
   if (stt == ComTdbDp2Oper::KEY_SEQ_WITH_SYSKEY_)
     hbasescan_tdb->setAddSyskeyTS(TRUE);
  
+  if (generator->isTransactionNeeded())
+    setTransactionRequired(generator);
+  else if (noDTMxn())
+    hbasescan_tdb->setUseHbaseXn(TRUE);
+  else if (useRegionXn())
+    hbasescan_tdb->setUseRegionXn(TRUE);
+
   if(!generator->explainDisabled()) {
     generator->setExplainTuple(
        addExplainInfo(hbasescan_tdb, 0, 0, generator));
@@ -3004,12 +3010,7 @@ short HbaseInsert::codeGen(Generator *generator)
 					   getPertableStatsTdbId());
     }
 
-  if (generator->isTransactionNeeded())
-    setTransactionRequired(generator);
-  else if (noDTMxn())
-    hbasescan_tdb->setUseHbaseXn(TRUE);
-
-   generator->setFoundAnUpdate(TRUE);
+  generator->setFoundAnUpdate(TRUE);
 
   generator->setCriDesc(givenDesc, Generator::DOWN);
   generator->setCriDesc(returnedDesc, Generator::UP);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/optimizer/BindRelExpr.cpp
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/BindRelExpr.cpp b/core/sql/optimizer/BindRelExpr.cpp
index 42d568d..ac7c162 100644
--- a/core/sql/optimizer/BindRelExpr.cpp
+++ b/core/sql/optimizer/BindRelExpr.cpp
@@ -13879,7 +13879,8 @@ RelExpr *Describe::bindNode(BindWA *bindWA)
                   (CmpCommon::diags()->mainSQLCODE() == -4193) ||
                   (CmpCommon::diags()->mainSQLCODE() == -4155) || // define not supported
                   (CmpCommon::diags()->mainSQLCODE() == -4086) || // catch Define Not Found error
-                  (CmpCommon::diags()->mainSQLCODE() == -30044))  // default schema access error
+                  (CmpCommon::diags()->mainSQLCODE() == -30044)|| // default schema access error
+                  (CmpCommon::diags()->mainSQLCODE() == -1398))   // uninit hbase
                     return this;
       
               CmpCommon::diags()->clear();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/optimizer/RelUpdate.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelUpdate.h b/core/sql/optimizer/RelUpdate.h
index 0a7a20e..c1f872b 100644
--- a/core/sql/optimizer/RelUpdate.h
+++ b/core/sql/optimizer/RelUpdate.h
@@ -139,6 +139,7 @@ GenericUpdate(const CorrName &name,
     uniqueRowsetHbaseOper_(FALSE),
     canDoCheckAndUpdel_(FALSE),
     noDTMxn_(FALSE),
+    useRegionXn_(FALSE),
     noCheck_(FALSE),
     noIMneeded_(FALSE),
     useMVCC_(FALSE),
@@ -520,6 +521,7 @@ GenericUpdate(const CorrName &name,
   NABoolean &canDoCheckAndUpdel() { return canDoCheckAndUpdel_; }
 
   NABoolean &noDTMxn() { return noDTMxn_; }
+  NABoolean &useRegionXn() { return useRegionXn_; }
 
   NABoolean noCheck() { return noCheck_; }
   void setNoCheck(NABoolean v) { noCheck_ = v; }
@@ -907,6 +909,10 @@ private:
   // It is executed using underlying hbase single row transaction consistency.
   NABoolean noDTMxn_;
 
+  // if set to ON, then query is run as part of localized region transaction.
+  // No external transaction is started to run it.
+  NABoolean useRegionXn_;
+
   // If set, then for seabase tables, no check of rows existence or non-existence
   // is done during an insert or delete operation. 
   // For insert, row overwrites an existing row, dup error is not returned. (upsert)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/regress/core/EXPECTED116
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/EXPECTED116 b/core/sql/regress/core/EXPECTED116
index 0441135..6b82161 100644
--- a/core/sql/regress/core/EXPECTED116
+++ b/core/sql/regress/core/EXPECTED116
@@ -341,7 +341,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:37 2016
+-- Definition current  Sat Sep 17 23:53:11 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -359,7 +359,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:37 2016
+-- Definition current  Sat Sep 17 23:53:11 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -374,7 +374,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:38 2016
+-- Definition current  Sat Sep 17 23:53:11 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -391,7 +391,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:42 2016
+-- Definition current  Sat Sep 17 23:53:19 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -406,7 +406,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:43 2016
+-- Definition current  Sat Sep 17 23:53:19 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -423,7 +423,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:46 2016
+-- Definition current  Sat Sep 17 23:53:22 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -438,7 +438,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:46 2016
+-- Definition current  Sat Sep 17 23:53:23 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -456,7 +456,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:46 2016
+-- Definition current  Sat Sep 17 23:53:23 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -471,7 +471,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:46 2016
+-- Definition current  Sat Sep 17 23:53:23 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -488,7 +488,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:53 2016
+-- Definition current  Sat Sep 17 23:53:32 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -503,7 +503,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:53 2016
+-- Definition current  Sat Sep 17 23:53:33 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -521,7 +521,7 @@ A1           C1           B1
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:53:58 2016
+-- Definition current  Sat Sep 17 23:53:37 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -536,7 +536,7 @@ A1           C1           B1
 >>invoke t116v1;
 
 -- Definition of Trafodion view TRAFODION.SCH.T116V1
--- Definition current  Tue Jun 21 06:53:58 2016
+-- Definition current  Sat Sep 17 23:53:37 2016
 
   (
     A                                INT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -595,7 +595,7 @@ End of MXCI Session
 >>invoke t116t1;
 
 -- Definition of Trafodion table TRAFODION.SCH.T116T1
--- Definition current  Tue Jun 21 06:54:14 2016
+-- Definition current  Sat Sep 17 23:53:58 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -692,6 +692,10 @@ T116T1
 
 --- SQL operation complete.
 >>
+>>set schema sch;
+
+--- SQL operation complete.
+>>
 >>-- ddl with autocommit off
 >>set transaction autocommit off;
 
@@ -704,7 +708,7 @@ T116T1
 --- SQL operation complete.
 >>invoke t116t2;
 
-*** ERROR[4082] Object TRAFODION.T116SCH1.T116T2 does not exist or is inaccessible.
+*** ERROR[4082] Object TRAFODION.SCH.T116T2 does not exist or is inaccessible.
 
 --- SQL operation failed with errors.
 >>create table t116t2 (a int);
@@ -712,8 +716,8 @@ T116T1
 --- SQL operation complete.
 >>invoke t116t2;
 
--- Definition of Trafodion table TRAFODION.T116SCH1.T116T2
--- Definition current  Tue Jun 21 06:55:12 2016
+-- Definition of Trafodion table TRAFODION.SCH.T116T2
+-- Definition current  Sat Sep 17 23:55:00 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -726,7 +730,7 @@ T116T1
 --- SQL operation complete.
 >>invoke t116t2;
 
-*** ERROR[4082] Object TRAFODION.T116SCH1.T116T2 does not exist or is inaccessible.
+*** ERROR[4082] Object TRAFODION.SCH.T116T2 does not exist or is inaccessible.
 
 --- SQL operation failed with errors.
 >>create table t116t2 (a int);
@@ -737,8 +741,8 @@ T116T1
 --- SQL operation complete.
 >>invoke t116t2;
 
--- Definition of Trafodion table TRAFODION.T116SCH1.T116T2
--- Definition current  Tue Jun 21 06:55:17 2016
+-- Definition of Trafodion table TRAFODION.SCH.T116T2
+-- Definition current  Sat Sep 17 23:55:13 2016
 
   (
     SYSKEY                           LARGEINT NO DEFAULT NOT NULL NOT DROPPABLE
@@ -784,7 +788,7 @@ T116T1
 --- SQL operation complete.
 >>create index t116t5_i1 on t116t5(c2);
 
-*** ERROR[1390] Object TRAFODION.T116SCH1.T116T5_I1 already exists in Trafodion.
+*** ERROR[1390] Object TRAFODION.SCH.T116T5_I1 already exists in Trafodion.
 
 --- SQL operation failed with errors.
 >>set parserflags 1;
@@ -803,14 +807,14 @@ T116T1
 
 *** ERROR[8110] Duplicate rows detected.
 
-*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
+*** ERROR[1053] Unique index TRAFODION.SCH.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
 
 --- SQL operation failed with errors.
 >>create unique index t116t5_i2 on t116t5(c3);
 
 *** ERROR[8110] Duplicate rows detected.
 
-*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
+*** ERROR[1053] Unique index TRAFODION.SCH.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
 
 --- SQL operation failed with errors.
 >>-- create unique index with no populate
@@ -822,36 +826,576 @@ T116T1
 
 *** ERROR[8110] Duplicate rows detected.
 
-*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
+*** ERROR[1053] Unique index TRAFODION.SCH.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
 
 --- SQL operation failed with errors.
 >>populate index t116t5_i2 on t116t5;
 
 *** ERROR[8110] Duplicate rows detected.
 
-*** ERROR[1053] Unique index TRAFODION.T116SCH1.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
+*** ERROR[1053] Unique index TRAFODION.SCH.T116T5_I2 could not be created because the specified column(s) contain duplicate data.
+
+--- SQL operation failed with errors.
+>>
+>>-- region transactions support
+>>create table t116t6 (a int not null primary key, b int);
+
+--- SQL operation complete.
+>>
+>>-- scenario 1, concurrent hbase transaction with insert(checkAndPut)
+>>begin work;
+
+--- SQL operation complete.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>
+>>-- insert a row using a concurrent hbase xn
+>>sh sqlci -iTEST116\(concurrent_hbase_xn_ins\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_hbase_xn_ins
+>>cqd traf_use_region_xn 'OFF';
+
+--- SQL operation complete.
+>>prepare s from insert into trafodion.sch.t116t6 values (1,2);
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_insert                T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) inserted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should not show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1            2
+
+--- 1 row(s) selected.
+>>
+>>-- scenario 2, concurrent region transaction with insert(checkAndPut)
+>>delete from t116t6;
+
+--- 1 row(s) deleted.
+>>begin work;
+
+--- SQL operation complete.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>
+>>-- insert a row using a concurrent region xn
+>>sh sqlci -iTEST116\(concurrent_region_xn_ins\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_region_xn_ins
+>>cqd traf_use_region_xn 'ON';
+
+--- SQL operation complete.
+>>prepare s from insert into trafodion.sch.t116t6 values (1,2);
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_insert      r         T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) inserted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should show conflict
+>>commit work;
+
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted.
+
+--- SQL operation failed with errors.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1            2
+
+--- 1 row(s) selected.
+>>
+>>-- scenario 3, concurrent hbase transaction with upsert(put)
+>>delete from t116t6;
+
+--- 1 row(s) deleted.
+>>begin work;
+
+--- SQL operation complete.
+>>upsert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>
+>>-- upsert a row using a concurrent hbase xn
+>>sh sqlci -iTEST116\(concurrent_hbase_xn_ups\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_hbase_xn_ups
+>>cqd traf_use_region_xn 'OFF';
+
+--- SQL operation complete.
+>>prepare s from upsert into trafodion.sch.t116t6 values (1,2);
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_upsert                T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) inserted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should not show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1            2
+
+--- 1 row(s) selected.
+>>
+>>-- scenario 4, concurrent region transaction with upsert(put)
+>>delete from t116t6;
+
+--- 1 row(s) deleted.
+>>begin work;
+
+--- SQL operation complete.
+>>upsert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>
+>>-- insert a row using a concurrent region xn
+>>sh sqlci -iTEST116\(concurrent_region_xn_ups\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_region_xn_ups
+>>cqd traf_use_region_xn 'ON';
+
+--- SQL operation complete.
+>>prepare s from upsert into trafodion.sch.t116t6 values (1,2);
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_upsert      r         T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) inserted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should show conflict
+>>commit work;
+
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted.
 
 --- SQL operation failed with errors.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1            2
+
+--- 1 row(s) selected.
+>>
+>>-- scenario 5, concurrent hbase transaction with delete
+>>delete from t116t6;
+
+--- 1 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>delete from t116t6 where a = 1 and b > 0;
+
+--- 1 row(s) deleted.
+>>
+>>-- delete a row using a concurrent hbase xn
+>>sh sqlci -iTEST116\(concurrent_hbase_xn_del\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_hbase_xn_del
+>>cqd traf_use_region_xn 'OFF';
+
+--- SQL operation complete.
+>>prepare s from delete from trafodion.sch.t116t6 where a = 1 and b > 0;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_delete                T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) deleted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should not show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+--- 0 row(s) selected.
+>>
+>>-- scenario 6, concurrent region transaction with delete
+>>delete from t116t6;
+
+--- 0 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>delete from t116t6 where a = 1 and b > 0;
+
+--- 1 row(s) deleted.
+>>
+>>-- delete a row using a concurrent region xn
+>>sh sqlci -iTEST116\(concurrent_region_xn_del\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_region_xn_del
+>>cqd traf_use_region_xn 'ON';
+
+--- SQL operation complete.
+>>prepare s from delete from trafodion.sch.t116t6 where a = 1 and b > 0;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_delete      r         T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) deleted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+--- 0 row(s) selected.
+>>
+>>-- scenario 7, concurrent hbase transaction with checkanddelete
+>>delete from t116t6;
+
+--- 0 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>delete from t116t6 where a = 1;
+
+--- 1 row(s) deleted.
+>>
+>>-- delete a row using a concurrent hbase xn
+>>sh sqlci -iTEST116\(concurrent_hbase_xn_checkanddel\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_hbase_xn_checkanddel
+>>cqd traf_use_region_xn 'OFF';
+
+--- SQL operation complete.
+>>prepare s from delete from trafodion.sch.t116t6 where a = 1;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_delete                T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) deleted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should not show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+--- 0 row(s) selected.
+>>
+>>-- scenario 8, concurrent region transaction with checkanddelete
+>>delete from t116t6;
+
+--- 0 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>delete from t116t6 where a = 1;
+
+--- 1 row(s) deleted.
+>>
+>>-- delete a row using a concurrent region xn
+>>sh sqlci -iTEST116\(concurrent_region_xn_checkanddel\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_region_xn_checkanddel
+>>cqd traf_use_region_xn 'ON';
+
+--- SQL operation complete.
+>>prepare s from delete from trafodion.sch.t116t6 where a = 1;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_delete      r         T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) deleted.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+--- 0 row(s) selected.
+>>
+>>-- scenario 9, concurrent hbase transaction with checkandupdate
+>>delete from t116t6;
+
+--- 0 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>update t116t6 set b = 333 where a = 1;
+
+--- 1 row(s) updated.
+>>
+>>-- update row using a concurrent hbase xn
+>>sh sqlci -iTEST116\(concurrent_hbase_xn_checkandupd\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_hbase_xn_checkandupd
+>>cqd traf_use_region_xn 'OFF';
+
+--- SQL operation complete.
+>>prepare s from update trafodion.sch.t116t6 set b = 111 where a = 1;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_update                T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) updated.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should not show conflict
+>>commit work;
+
+--- SQL operation complete.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1          111
+
+--- 1 row(s) selected.
+>>
+>>-- scenario 10, concurrent region transaction with checkandupdate
+>>delete from t116t6;
+
+--- 1 row(s) deleted.
+>>insert into t116t6 values (1,1);
+
+--- 1 row(s) inserted.
+>>begin work;
+
+--- SQL operation complete.
+>>update t116t6 set b = 333 where a = 1;
+
+--- 1 row(s) updated.
+>>
+>>-- update row using a concurrent region xn
+>>sh sqlci -iTEST116\(concurrent_region_xn_checkandupd\) >> LOG116;
+Apache Trafodion Conversational Interface 2.1.0
+Copyright (c) 2015-2016 Apache Software Foundation
+>>?section concurrent_region_xn_checkandupd
+>>cqd traf_use_region_xn 'ON';
+
+--- SQL operation complete.
+>>prepare s from update trafodion.sch.t116t6 set b = 111 where a = 1;
+
+--- SQL command prepared.
+>>explain options 'f' s;
+
+LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
+---- ---- ---- --------------------  --------  --------------------  ---------
+
+1    .    2    root                  o                               1.00E+000
+.    .    1    trafodion_update      r         T116T6                1.00E+000
+
+--- SQL operation complete.
+>>execute s;
+
+--- 1 row(s) updated.
+>>
+>>exit;
+
+End of MXCI Session
+
+>>
+>>-- should show conflict
+>>commit work;
+
+*** ERROR[8616] A conflict was detected during commit processing. Transaction has been aborted.
+
+--- SQL operation failed with errors.
+>>select * from t116t6;
+
+A            B          
+-----------  -----------
+
+          1          111
+
+--- 1 row(s) selected.
+>>
 >>
 >>obey TEST116(clean_up);
 >>drop table t116t1;
 
---- SQL operation complete.
+*** ERROR[1389] Object TRAFODION.SCH.T116T1 does not exist in Trafodion.
+
+--- SQL operation failed with errors.
 >>drop table t116t2;
 
 --- SQL operation complete.
 >>drop table t116t3;
 
-*** ERROR[1389] Object TRAFODION.T116SCH1.T116T3 does not exist in Trafodion.
-
---- SQL operation failed with errors.
+--- SQL operation complete.
 >>drop table t116t4;
 
-*** ERROR[1389] Object TRAFODION.T116SCH1.T116T4 does not exist in Trafodion.
+*** ERROR[1389] Object TRAFODION.SCH.T116T4 does not exist in Trafodion.
 
 --- SQL operation failed with errors.
 >>drop table t116t5;
 
 --- SQL operation complete.
+>>drop table t116t6;
+
+--- SQL operation complete.
 >>
 >>log;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/632f52fb/core/sql/regress/core/TEST116
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/TEST116 b/core/sql/regress/core/TEST116
index d326463..0cc0de4 100755
--- a/core/sql/regress/core/TEST116
+++ b/core/sql/regress/core/TEST116
@@ -193,6 +193,8 @@ select count(*) from "_MD_".objects where schema_name = 'T116SCH1'
 rollback work;
 get tables in schema t116sch1;
 
+set schema sch;
+
 -- ddl with autocommit off
 set transaction autocommit off;
 drop table if exists t116t2;
@@ -231,6 +233,135 @@ create unique index t116t5_i2 on t116t5(c3) no populate;
 populate index t116t5_i2 on t116t5;
 populate index t116t5_i2 on t116t5;
 
+-- region transactions support
+create table t116t6 (a int not null primary key, b int);
+
+-- scenario 1, concurrent hbase transaction with insert(checkAndPut)
+begin work;
+insert into t116t6 values (1,1);
+
+-- insert a row using a concurrent hbase xn
+sh sqlci -iTEST116\(concurrent_hbase_xn_ins\) >> LOG116;
+
+-- should not show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 2, concurrent region transaction with insert(checkAndPut)
+delete from t116t6;
+begin work;
+insert into t116t6 values (1,1);
+
+-- insert a row using a concurrent region xn
+sh sqlci -iTEST116\(concurrent_region_xn_ins\) >> LOG116;
+
+-- should show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 3, concurrent hbase transaction with upsert(put)
+delete from t116t6;
+begin work;
+upsert into t116t6 values (1,1);
+
+-- upsert a row using a concurrent hbase xn
+sh sqlci -iTEST116\(concurrent_hbase_xn_ups\) >> LOG116;
+
+-- should not show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 4, concurrent region transaction with upsert(put)
+delete from t116t6;
+begin work;
+upsert into t116t6 values (1,1);
+
+-- insert a row using a concurrent region xn
+sh sqlci -iTEST116\(concurrent_region_xn_ups\) >> LOG116;
+
+-- should show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 5, concurrent hbase transaction with delete
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+delete from t116t6 where a = 1 and b > 0;
+
+-- delete a row using a concurrent hbase xn
+sh sqlci -iTEST116\(concurrent_hbase_xn_del\) >> LOG116;
+
+-- should not show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 6, concurrent region transaction with delete
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+delete from t116t6 where a = 1 and b > 0;
+
+-- delete a row using a concurrent region xn
+sh sqlci -iTEST116\(concurrent_region_xn_del\) >> LOG116;
+
+-- should show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 7, concurrent hbase transaction with checkanddelete
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+delete from t116t6 where a = 1;
+
+-- delete a row using a concurrent hbase xn
+sh sqlci -iTEST116\(concurrent_hbase_xn_checkanddel\) >> LOG116;
+
+-- should not show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 8, concurrent region transaction with checkanddelete
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+delete from t116t6 where a = 1;
+
+-- delete a row using a concurrent region xn
+sh sqlci -iTEST116\(concurrent_region_xn_checkanddel\) >> LOG116;
+
+-- should show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 9, concurrent hbase transaction with checkandupdate
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+update t116t6 set b = 333 where a = 1;
+
+-- update row using a concurrent hbase xn
+sh sqlci -iTEST116\(concurrent_hbase_xn_checkandupd\) >> LOG116;
+
+-- should not show conflict
+commit work;
+select * from t116t6;
+
+-- scenario 10, concurrent region transaction with checkandupdate
+delete from t116t6;
+insert into t116t6 values (1,1);
+begin work;
+update t116t6 set b = 333 where a = 1;
+
+-- update row using a concurrent region xn
+sh sqlci -iTEST116\(concurrent_region_xn_checkandupd\) >> LOG116;
+
+-- should show conflict
+commit work;
+select * from t116t6;
+
+
 obey TEST116(clean_up);
 log;
 exit;
@@ -243,10 +374,71 @@ begin work;
 create table t116t1 (a int);
 commit work;
 
+?section concurrent_hbase_xn_ins
+cqd traf_use_region_xn 'OFF';
+prepare s from insert into trafodion.sch.t116t6 values (1,2);
+explain options 'f' s;
+execute s;
+
+?section concurrent_hbase_xn_ups
+cqd traf_use_region_xn 'OFF';
+prepare s from upsert into trafodion.sch.t116t6 values (1,2);
+explain options 'f' s;
+execute s;
+
+?section concurrent_region_xn_ins
+cqd traf_use_region_xn 'ON';
+prepare s from insert into trafodion.sch.t116t6 values (1,2);
+explain options 'f' s;
+execute s;
+
+?section concurrent_region_xn_ups
+cqd traf_use_region_xn 'ON';
+prepare s from upsert into trafodion.sch.t116t6 values (1,2);
+explain options 'f' s;
+execute s;
+
+?section concurrent_hbase_xn_del
+cqd traf_use_region_xn 'OFF';
+prepare s from delete from trafodion.sch.t116t6 where a = 1 and b > 0;
+explain options 'f' s;
+execute s;
+
+?section concurrent_region_xn_del
+cqd traf_use_region_xn 'ON';
+prepare s from delete from trafodion.sch.t116t6 where a = 1 and b > 0;
+explain options 'f' s;
+execute s;
+
+?section concurrent_hbase_xn_checkanddel
+cqd traf_use_region_xn 'OFF';
+prepare s from delete from trafodion.sch.t116t6 where a = 1;
+explain options 'f' s;
+execute s;
+
+?section concurrent_region_xn_checkanddel
+cqd traf_use_region_xn 'ON';
+prepare s from delete from trafodion.sch.t116t6 where a = 1;
+explain options 'f' s;
+execute s;
+
+?section concurrent_hbase_xn_checkandupd
+cqd traf_use_region_xn 'OFF';
+prepare s from update trafodion.sch.t116t6 set b = 111 where a = 1;
+explain options 'f' s;
+execute s;
+
+?section concurrent_region_xn_checkandupd
+cqd traf_use_region_xn 'ON';
+prepare s from update trafodion.sch.t116t6 set b = 111 where a = 1;
+explain options 'f' s;
+execute s;
+
 ?section clean_up
 drop table t116t1;
 drop table t116t2;
 drop table t116t3;
 drop table t116t4;
 drop table t116t5;
+drop table t116t6;
 


[3/3] incubator-trafodion git commit: Merge [TRAFODION-1435] PR-710 SQL support for region transactions

Posted by an...@apache.org.
Merge [TRAFODION-1435] PR-710 SQL support for region transactions 


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/552b9496
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/552b9496
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/552b9496

Branch: refs/heads/master
Commit: 552b9496f4fe7691be64071e5904659d44b02bff
Parents: 16ebe09 632f52f
Author: Anoop Sharma <an...@esgyn.com>
Authored: Tue Sep 20 23:44:02 2016 +0000
Committer: Anoop Sharma <an...@esgyn.com>
Committed: Tue Sep 20 23:44:02 2016 +0000

----------------------------------------------------------------------
 core/sql/comexe/ComTdbHbaseAccess.h             |   7 +-
 core/sql/executor/ExExeUtilExplain.cpp          |  19 +
 core/sql/executor/ExHbaseIUD.cpp                |  19 +-
 core/sql/executor/HBaseClient_JNI.cpp           |  68 ++-
 core/sql/executor/HBaseClient_JNI.h             |  32 +-
 core/sql/exp/ExpHbaseInterface.cpp              |  81 ++-
 core/sql/exp/ExpHbaseInterface.h                |  59 +-
 core/sql/generator/GenExplain.cpp               |   8 +
 core/sql/generator/GenPreCode.cpp               |  99 +--
 core/sql/generator/GenRelUpdate.cpp             |  49 +-
 core/sql/optimizer/BindRelExpr.cpp              |   3 +-
 core/sql/optimizer/RelUpdate.h                  |   6 +
 core/sql/regress/core/EXPECTED116               | 604 ++++++++++++++++++-
 core/sql/regress/core/TEST116                   | 192 ++++++
 core/sql/regress/seabase/EXPECTED011            |  20 +-
 core/sql/regress/seabase/EXPECTED025            |  10 +-
 core/sql/sqlcomp/DefaultConstants.h             |   4 +
 core/sql/sqlcomp/nadefaults.cpp                 |   2 +
 .../java/org/trafodion/sql/HBaseClient.java     |  42 +-
 .../java/org/trafodion/sql/HTableClient.java    | 300 ++++-----
 20 files changed, 1243 insertions(+), 381 deletions(-)
----------------------------------------------------------------------