Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 0d028886a -> e34b144f7


Fix for JIRA [TRAFODION-1935]
TransactionManager needlessly retries in doPrepareX when an
UnknownTransactionException is caught


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

Branch: refs/heads/master
Commit: 32916f91f5a89019465438648fb708925995dd58
Parents: 9ba333a
Author: Sean Broeder <sbroeder@edev03.esgyn.local>
Authored: Fri Apr 15 18:13:24 2016 +0000
Committer: Sean Broeder <sbroeder@edev03.esgyn.local>
Committed: Fri Apr 15 18:13:24 2016 +0000

----------------------------------------------------------------------
 .../transactional/TransactionManager.java       | 73 ++++++++++++--------
 1 file changed, 43 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/32916f91/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
----------------------------------------------------------------------
diff --git 
a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
 
b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
index 7eb03e7..5d11497 100644
--- 
a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
+++ 
b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/TransactionManager.java
@@ -549,13 +549,15 @@ public class TransactionManager {
                retry = false;
              }
           }
-          catch (UnknownTransactionException ute) {
-              LOG.error("Got unknown exception in doCommitX by participant " + 
participantNum
-                         + " for transaction: " + transactionId + " " + ute);
-              transactionState.requestPendingCountDec(true);
-              throw new UnknownTransactionException();
-          }
           catch (Exception e) {
+             if(e.toString().contains("UnknownTransactionException")) {
+                String errMsg = new String("Got unknown exception in doCommitX 
by participant " + participantNum
+                         + " for transaction: " + transactionId + " " + e);
+                LOG.error(errMsg);
+                transactionState.requestPendingCountDec(true);
+                throw new UnknownTransactionException(errMsg);
+             }
+
              LOG.error("doCommitX participant " + participantNum + " retrying 
transaction "
                       + transactionId + " due to Exception: " + e);
              refresh = true;
@@ -743,12 +745,15 @@ public class TransactionManager {
                retry = false;
              }
           }
-          catch(UnknownTransactionException ute) {
-             LOG.warn("doPrepareX participant " + participantNum + " 
transaction "
-                     + transactionId + " unknown transaction : " + ute);
-             throw new UnknownTransactionException();
-          }
           catch(Exception e) {
+             String exceptionString = e.toString();
+             if(exceptionString.contains("UnknownTransactionException")) {
+               String errMsg = new String("doPrepareX participant " + 
participantNum + " transaction "
+                        + transactionId + " unknown transaction : " + e);
+                LOG.warn(errMsg);
+                transactionState.requestPendingCountDec(true);
+                throw new UnknownTransactionException(errMsg);
+             }
              LOG.error("doPrepareX participant " + participantNum + " retrying 
transaction "
                           + transactionId + " due to Exception: " + e);
              refresh = true;
@@ -844,12 +849,15 @@ public class TransactionManager {
                 retry = false;
              }
           }
-          catch(UnknownTransactionException ute) {
-             LOG.warn("doPrepareX participant " + participantNum + " 
transaction "
-                      + transactionId + " unknown transaction: " + ute);
-             throw new UnknownTransactionException();
-          }
           catch(Exception e) {
+             String exceptionString = e.toString();
+             if(exceptionString.contains("UnknownTransactionException")) {
+               String errMsg = new String("doPrepareX participant " + 
participantNum + " transaction "
+                         + transactionId + " unknown transaction : " + e);
+                LOG.warn(errMsg);
+                transactionState.requestPendingCountDec(true);
+                throw new UnknownTransactionException(errMsg);
+             }
              LOG.error("doPrepareX participant " + participantNum + " retrying 
transaction "
                       + transactionId + " due to Exception: " + e);
              refresh = true;
@@ -1217,14 +1225,17 @@ public class TransactionManager {
               }
            }
         }
-        catch (UnknownTransactionException ute) {
-            String errMsg = "Got unknown exception in doCommitX for 
transaction: " + transactionId + " " + ute;
-            LOG.error(errMsg);
-            transactionState.requestPendingCountDec(true);
-            throw new UnknownTransactionException(errMsg);
-        }
         catch (Exception e) {
-           LOG.error("doCommitX retrying transaction " + transactionId + " due 
to Exception: " + e);
+           String exceptionString = e.toString();
+           if(exceptionString.contains("UnknownTransactionException")) {
+              String errMsg = new String("Got unknown exception in doCommitX 
for transaction: " + transactionId
+                       + " participant " + participantNum + " " + e);
+              LOG.error(errMsg);
+              transactionState.requestPendingCountDec(true);
+              throw new UnknownTransactionException(errMsg);
+           }
+           LOG.error("doCommitX retrying transaction " + transactionId
+                          + " participant " + participantNum + " due to 
Exception: " + e);
            refresh = true;
            retry = true;
         }
@@ -1300,13 +1311,15 @@ public class TransactionManager {
 
           }
        }
-       catch(UnknownTransactionException ute) {
-          String warnMsg = new String("UnknownTransaction in doPrepareX - 
Batch - by participant "
-                    + participantNum + " for transaction " + transactionId + " 
" + ute);
-          LOG.warn(warnMsg);
-          throw new UnknownTransactionException(warnMsg);
-       }
        catch(Exception e) {
+          String exceptionString = e.toString();
+          if(exceptionString.contains("UnknownTransactionException")) {
+             String errMsg = new String("UnknownTransaction in doPrepareX - 
Batch - by participant "
+                     + participantNum + " for transaction " + transactionId + 
" " + e);
+             LOG.error(errMsg);
+             transactionState.requestPendingCountDec(true);
+             throw new UnknownTransactionException(errMsg);
+          }
           LOG.error("doPrepareX - Batch - retrying for participant "
                    + participantNum + " transaction " + transactionId + " due 
to Exception: " + e);
           refresh = true;
@@ -2663,7 +2676,7 @@ public class TransactionManager {
             else {
             hbadmin.createTable(desc);
             }
-            hbadmin.close();
+            // hbadmin.close();
 
             // Set transaction state object as participating in ddl transaction
             transactionState.setDDLTx(true);

Reply via email to