Index: metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java =================================================================== --- metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java (revision 1451267) +++ metastore/src/java/org/apache/hadoop/hive/metastore/ObjectStore.java (working copy) @@ -2043,16 +2043,23 @@ public void alterPartition(String dbname, String name, List part_vals, Partition newPart) throws InvalidObjectException, MetaException { boolean success = false; + Exception e = null; try { openTransaction(); alterPartitionNoTxn(dbname, name, part_vals, newPart); // commit the changes success = commitTransaction(); + } catch (Exception exception) { + e = exception; } finally { if (!success) { rollbackTransaction(); - throw new MetaException( + MetaException metaException = new MetaException( "The transaction for alter partition did not commit successfully."); + if (e != null) { + metaException.initCause(e); + } + throw metaException; } } } @@ -2060,6 +2067,7 @@ public void alterPartitions(String dbname, String name, List> part_vals, List newParts) throws InvalidObjectException, MetaException { boolean success = false; + Exception e = null; try { openTransaction(); Iterator> part_val_itr = part_vals.iterator(); @@ -2069,11 +2077,17 @@ } // commit the changes success = commitTransaction(); + } catch (Exception exception) { + e = exception; } finally { if (!success) { rollbackTransaction(); - throw new MetaException( + MetaException metaException = new MetaException( "The transaction for alter partition did not commit successfully."); + if (e != null) { + metaException.initCause(e); + } + throw metaException; } } }