pvary commented on a change in pull request #2547:
URL: https://github.com/apache/hive/pull/2547#discussion_r707080469



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java
##########
@@ -531,7 +531,7 @@ public void cleanTxnToWriteIdTable() throws MetaException {
         String s = "SELECT MIN(\"RES\".\"ID\") AS \"ID\" FROM (" +
             "SELECT MAX(\"TXN_ID\") + 1 AS \"ID\" FROM \"TXNS\" " +
             "UNION " +
-            "SELECT MIN(\"WS_COMMIT_ID\") AS \"ID\" FROM \"WRITE_SET\" " +
+            "SELECT MIN(\"WS_TXNID\") AS \"ID\" FROM \"WRITE_SET\" " +

Review comment:
       This was the original code, so we might want to check 
`findMinOpenTxnGLB`:
   ```
           // First need to find the min_uncommitted_txnid which is currently 
seen by any open transactions.
           // If there are no txns which are currently open or aborted in the 
system, then current value of
           // NEXT_TXN_ID.ntxn_next could be min_uncommitted_txnid.
           long minUncommittedTxnId = findMinOpenTxnGLB(stmt);
   
           // If there are aborted txns, then the minimum aborted txnid could 
be the min_uncommitted_txnid
           // if lesser than both NEXT_TXN_ID.ntxn_next and 
min(MIN_HISTORY_LEVEL .mhl_min_open_txnid).
           String s = "SELECT MIN(\"TXN_ID\") FROM \"TXNS\" WHERE \"TXN_STATE\" 
= " + TxnStatus.ABORTED;
           LOG.debug("Going to execute query <" + s + ">");
           rs = stmt.executeQuery(s);
           if (rs.next()) {
             long minAbortedTxnId = rs.getLong(1);
             if (minAbortedTxnId > 0) {
               minUncommittedTxnId = Math.min(minAbortedTxnId, 
minUncommittedTxnId);
             }
           }
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to