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


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -1295,25 +1288,33 @@ private static boolean timedOut(CompactionInfo ci, 
RetentionCounters rc, long pa
             && (rc.hasSucceededMajorCompaction || 
(rc.hasSucceededMinorCompaction && ci.type == CompactionType.MINOR));
   }
 
-  private void removeAbortRetryEntries(Connection dbConn, CompactionInfo info) 
throws MetaException, RetryException {
-    LOG.debug("Going to execute update <{}>", 
DELETE_ABORT_RETRY_ENTRIES_FROM_COMPACTION_QUEUE);
-    try (PreparedStatement pStmt = 
dbConn.prepareStatement(DELETE_ABORT_RETRY_ENTRIES_FROM_COMPACTION_QUEUE)) {
+  private void removeCompactionAndAbortRetryEntries(Connection dbConn, 
CompactionInfo info) throws MetaException, RetryException {
+    String query = 
String.format(DELETE_COMPACTION_AND_ABORT_RETRY_ENTRIES_FROM_COMPACTION_QUEUE,
+            info.partName != null ? " = ? " : " IS NULL ", info.id > 0 ? " OR 
\"CQ_ID\" = ?" : "");

Review Comment:
   why do we need that complex query with OR in case CQ_ID is provided? should 
we just execute:
   ````
   "DELETE FROM \"COMPACTION_QUEUE\" WHERE \"CQ_ID\" = ?"
   ````



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