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 2a42a1718a8886db0d44267412bf3cf5ca402ab6..1b14fb113e612c210297f516b18af6553a7016f4 100644 --- a/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java +++ b/metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java @@ -466,12 +466,15 @@ public void rollbackTransaction() { if (currentTransaction.isActive() && transactionStatus != TXN_STATUS.ROLLBACK) { transactionStatus = TXN_STATUS.ROLLBACK; - // could already be rolled back - currentTransaction.rollback(); - // remove all detached objects from the cache, since the transaction is - // being rolled back they are no longer relevant, and this prevents them - // from reattaching in future transactions - pm.evictAll(); + try { + // could already be rolled back + currentTransaction.rollback(); + } finally { + // remove all detached objects from the cache, since the transaction is + // being rolled back they are no longer relevant, and this prevents them + // from reattaching in future transactions + pm.evictAll(); + } } }