diff --git metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java index 382df1f..5e0f300 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java @@ -3223,6 +3223,11 @@ public LockHandle acquireLock(String key) throws MetaException { if (!isDuplicateKeyError(ex)) { throw new RuntimeException("Unable to lock " + quoteString(key) + " due to: " + getMessage(ex), ex); } + //if here, it means a concrurrent acquireLock() inserted the 'key' + + //rollback is done for the benefit of Postgres which throws (SQLState=25P02, ErrorCode=0) if + //you attempt any stmt in a txn which had an error. + dbConn.rollback(); } rs = stmt.executeQuery(sqlStmt); if (!rs.next()) {