pvary commented on a change in pull request #2547:
URL: https://github.com/apache/hive/pull/2547#discussion_r707081936
##########
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 `findMinOpenTxnGLB`
```
/**
* See doc at {@link TxnStore#findMinOpenTxnId()}
* Note that {@link #openTxns(OpenTxnRequest)} makes update of NEXT_TXN
and MIN_HISTORY_LEVEL
* a single atomic operation (and no one else should update these tables
except the cleaner
* which deletes rows from MIN_HISTORY_LEVEL which can only allow
minOpenTxn to move higher)
*/
private long findMinOpenTxnGLB(Statement stmt) throws MetaException,
SQLException {
String s = "SELECT \"NTXN_NEXT\" FROM \"NEXT_TXN_ID\"";
LOG.debug("Going to execute query <" + s + ">");
ResultSet rs = stmt.executeQuery(s);
if (!rs.next()) {
throw new MetaException("Transaction tables not properly " +
"initialized, no record found in next_txn_id");
}
long hwm = rs.getLong(1);
s = "SELECT MIN(\"MHL_MIN_OPEN_TXNID\") FROM \"MIN_HISTORY_LEVEL\"";
LOG.debug("Going to execute query <" + s + ">");
rs = stmt.executeQuery(s);
rs.next();
long minOpenTxnId = rs.getLong(1);
if(rs.wasNull()) {
return hwm;
}
//since generating new txnid uses select for update on single row in
NEXT_TXN_ID
assert hwm >= minOpenTxnId : "(hwm, minOpenTxnId)=(" + hwm + "," +
minOpenTxnId + ")";
return minOpenTxnId;
}
```
--
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]