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,