deniskuzZ commented on code in PR #4384:
URL: https://github.com/apache/hive/pull/4384#discussion_r1309018298
##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -1804,263 +572,56 @@ protected void
updateWSCommitIdAndCleanUpMetadata(Statement stmt, long txnid, Tx
}
}
- private Optional<CompactionInfo> getCompactionByTxnId(Connection dbConn,
long txnid) throws SQLException, MetaException {
- CompactionInfo info = null;
- try (PreparedStatement pStmt =
dbConn.prepareStatement(SELECT_COMPACTION_QUEUE_BY_TXN_ID)) {
- pStmt.setLong(1, txnid);
- try (ResultSet rs = pStmt.executeQuery()) {
- if (rs.next()) {
- info = CompactionInfo.loadFullFromCompactionQueue(rs);
- }
- }
- }
- return Optional.ofNullable(info);
- }
-
@Override
public Optional<CompactionInfo> getCompactionByTxnId(long txnId) throws
MetaException {
- Connection dbConn = null;
- try {
- try {
- dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED,
connPoolCompaction);
- return getCompactionByTxnId(dbConn, txnId);
- } catch (SQLException e) {
- LOG.error("Unable to getCompactionByTxnId", e);
- rollbackDBConn(dbConn);
- checkRetryable(e, "getCompactionByTxnId");
- throw new MetaException("Unable to execute getCompactionByTxnId() " +
e.getMessage());
- } finally {
- closeDbConn(dbConn);
- }
- } catch (RetryException e) {
- return getCompactionByTxnId(txnId);
- }
+ return Optional.ofNullable(getCompactionByTxnId(jdbcTemplate, txnId));
+ }
+
+ private CompactionInfo getCompactionByTxnId(DataSourceWrapper
dataSourceWrapper, long txnId) throws MetaException {
Review Comment:
why do we need extra private method?
````
return Optional.ofNullable(rez);
````
--
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]