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


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -615,57 +190,19 @@ public void markCleanerStart(CompactionInfo info) throws 
MetaException {
   @RetrySemantics.ReadOnly
   public void clearCleanerStart(CompactionInfo info) throws MetaException {
     LOG.debug("Running clearCleanerStart with CompactionInfo: {}", info);
-
-    try {
-      Connection dbConn = null;
-      try {
-        dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED, 
connPoolCompaction);
-        setCleanerStart(dbConn, info, -1L);
-      } catch (SQLException e) {
-        LOG.error("Unable to clear the cleaner start time for compaction 
record  " + e.getMessage());
-        LOG.debug("Going to rollback");
-        rollbackDBConn(dbConn);
-        checkRetryable(e, "clearCleanerStart(" + info + ")");
-        throw new MetaException(DB_FAILED_TO_CONNECT + e.getMessage());
-      } finally {
-        closeDbConn(dbConn);
-      }
-    } catch (RetryException e) {
-      clearCleanerStart(info);
-    }
+    setCleanerStart(info, -1L);
   }
 
-  private void setCleanerStart(Connection dbConn, CompactionInfo info, Long 
timestamp)
-      throws RetryException, SQLException {
-    long id = info.id;
-    PreparedStatement pStmt = null;
-    ResultSet rs = null;
-    try {
-      String query = "" +
-          " UPDATE " +
-          "  \"COMPACTION_QUEUE\" " +
-          " SET " +
-          "  \"CQ_CLEANER_START\" = " + timestamp +
-          " WHERE " +
-          "  \"CQ_ID\" = " + id +
-          " AND " +
-          "  \"CQ_STATE\"='" + READY_FOR_CLEANING + "'";
-
-      pStmt = dbConn.prepareStatement(query);
-      LOG.debug("Going to execute update <{}> for CQ_ID={}", query, id);
-      int updCount = pStmt.executeUpdate();
-      if (updCount != 1) {
-        LOG.error("Unable to update compaction record: {}.  Update count={}", 
info, updCount);
-        LOG.debug("Going to rollback");
-        dbConn.rollback();
-      } else {
-        LOG.debug("Going to commit");
-        dbConn.commit();
-      }
-    } finally {
-      close(rs);
-      closeStmt(pStmt);
-    }
+  private void setCleanerStart(CompactionInfo info, Long timestamp) throws 
MetaException {
+    jdbcTemplate.execute(
+        " UPDATE \"COMPACTION_QUEUE\" " +

Review Comment:
   no, that's fine



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