deniskuzZ commented on code in PR #4384:
URL: https://github.com/apache/hive/pull/4384#discussion_r1309117627


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java:
##########
@@ -5695,24 +5759,18 @@ private List<LockInfo> getLocksFromLockId(Connection 
dbConn, long extLockId) thr
   // for read-only autoCommit=true statements.  This does a commit,
   // and thus should be done before any calls to heartbeat that will leave
   // open transactions.
-  private void timeOutLocks(Connection dbConn) {
-    Set<Long> timedOutLockIds = new TreeSet<>();
+  private void timeOutLocks() {
     //doing a SELECT first is less efficient but makes it easier to debug 
things
     //when txnid is <> 0, the lock is associated with a txn and is handled by 
performTimeOuts()
     //want to avoid expiring locks for a txn w/o expiring the txn itself
-    try (PreparedStatement pstmt = dbConn.prepareStatement(
-            String.format(SELECT_TIMED_OUT_LOCKS_QUERY, 
getEpochFn(dbProduct)))) {
-      pstmt.setLong(1, timeout);
-      LOG.debug("Going to execute query: <{}>", SELECT_TIMED_OUT_LOCKS_QUERY);
-      try (ResultSet rs = pstmt.executeQuery()) {
-        while (rs.next()) {
-          timedOutLockIds.add(rs.getLong(1));
-        }
-        dbConn.commit();
-        if (timedOutLockIds.isEmpty()) {
-          LOG.debug("Did not find any timed-out locks, therefore retuning.");
-          return;
-        }
+    try {
+      Set<Long> timedOutLockIds = new TreeSet<>(
+          
jdbcTemplate.getJdbcTemplate().query(String.format(SELECT_TIMED_OUT_LOCKS_QUERY,
 getEpochFn(dbProduct)),

Review Comment:
   same question on txn propagation
   would we open a new connection here?



-- 
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