hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject [29/50] [abbrv] hive git commit: HIVE-11897 : JDO rollback can throw pointless exceptions (Sergey Shelukhin, reviewed by Ashutosh Chauhan)
Date Fri, 25 Sep 2015 01:40:07 GMT
HIVE-11897 : JDO rollback can throw pointless exceptions (Sergey Shelukhin, reviewed by Ashutosh
Chauhan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/44741dab
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/44741dab
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/44741dab

Branch: refs/heads/beeline-cli
Commit: 44741dabf0a4e7a9bf21fb2ee1a0b00d9d8eeddb
Parents: 451381c
Author: Sergey Shelukhin <sershe@apache.org>
Authored: Tue Sep 22 15:39:47 2015 -0700
Committer: Sergey Shelukhin <sershe@apache.org>
Committed: Tue Sep 22 15:39:47 2015 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hive/metastore/ObjectStore.java   | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/44741dab/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index 5d2dc29..d9ed883 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -43,6 +43,7 @@ import java.util.concurrent.locks.ReentrantLock;
 import java.util.regex.Pattern;
 
 import javax.jdo.JDODataStoreException;
+import javax.jdo.JDOException;
 import javax.jdo.JDOHelper;
 import javax.jdo.JDOObjectNotFoundException;
 import javax.jdo.PersistenceManager;
@@ -2431,7 +2432,20 @@ public class ObjectStore implements RawStore, Configurable {
         throw new MetaException(ex.getMessage());
       }
       if (!isInTxn) {
-        rollbackTransaction();
+        JDOException rollbackEx = null;
+        try {
+          rollbackTransaction();
+        } catch (JDOException jex) {
+          rollbackEx = jex;
+        }
+        if (rollbackEx != null) {
+          // Datanucleus propagates some pointless exceptions and rolls back in the finally.
+          if (currentTransaction != null && currentTransaction.isActive()) {
+            throw rollbackEx; // Throw if the tx wasn't rolled back.
+          }
+          LOG.info("Ignoring exception, rollback succeeded: " + rollbackEx.getMessage());
+        }
+
         start = doTrace ? System.nanoTime() : 0;
         openTransaction();
         if (table != null) {


Mime
View raw message