deniskuzZ commented on code in PR #4384:
URL: https://github.com/apache/hive/pull/4384#discussion_r1309101975
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -882,24 +926,15 @@ public void setOpenTxnTimeOutMillis(long
openTxnTimeOutMillis) {
TxnHandler.openTxnTimeOutMillis = openTxnTimeOutMillis;
}
- protected long getOpenTxnTimeoutLowBoundaryTxnId(Connection dbConn) throws
MetaException, SQLException {
- long maxTxnId;
- String s =
- "SELECT MAX(\"TXN_ID\") FROM \"TXNS\" WHERE \"TXN_STARTED\" < (" +
getEpochFn(dbProduct) + " - "
- + openTxnTimeOutMillis + ")";
- try (Statement stmt = dbConn.createStatement()) {
- LOG.debug("Going to execute query <{}>", s);
- try (ResultSet maxTxnIdRs = stmt.executeQuery(s)) {
- maxTxnIdRs.next();
- maxTxnId = maxTxnIdRs.getLong(1);
- if (maxTxnIdRs.wasNull()) {
- /*
- * TXNS always contains at least one transaction,
- * the row where txnid = (select max(txnid) where txn_started <
epoch - TXN_OPENTXN_TIMEOUT) is never deleted
- */
- throw new MetaException("Transaction tables not properly " +
"initialized, null record found in MAX(TXN_ID)");
- }
- }
+ protected long getOpenTxnTimeoutLowBoundaryTxnId() throws MetaException {
+ Long maxTxnId = jdbcTemplate.getJdbcTemplate().queryForObject("SELECT
MAX(\"TXN_ID\") FROM \"TXNS\" WHERE \"TXN_STARTED\" < (" +
getEpochFn(dbProduct) + " - "
Review Comment:
would it open a new connection? The idea here was to reuse the existing
connection
--
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]