SourabhBadhya commented on code in PR #4313:
URL: https://github.com/apache/hive/pull/4313#discussion_r1196641073


##########
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java:
##########
@@ -1562,16 +1620,46 @@ public void markRefused(CompactionInfo info) throws 
MetaException {
 
   @Override
   @RetrySemantics.CannotRetry
-  public void setCleanerRetryRetentionTimeOnError(CompactionInfo info) throws 
MetaException {
+  public void setCleanerRetryRetentionTimeOnError(CompactionInfo info, boolean 
isAbort) throws MetaException {
     try {
       try (Connection dbConn = 
getDbConn(Connection.TRANSACTION_READ_COMMITTED, connPoolCompaction)) {
-        try (PreparedStatement stmt = dbConn.prepareStatement("UPDATE 
\"COMPACTION_QUEUE\" " +
-                "SET \"CQ_RETRY_RETENTION\" = ?, \"CQ_ERROR_MESSAGE\"= ? WHERE 
\"CQ_ID\" = ?")) {
+        String query;
+        if (isAbort) {
+          // Check whether we need to do an insert to the TXN_CLEANUP_QUEUE or 
an update to TXN_CLEANUP_QUEUE.
+          if (!info.hasOldAbort) {
+            if (info.partName != null) {
+              query = "INSERT INTO \"TXN_CLEANUP_QUEUE\" 
(\"TCQ_RETRY_RETENTION\", \"TCQ_ERROR_MESSAGE\", " +
+                      "\"TCQ_DATABASE\", \"TCQ_TABLE\", \"TCQ_PARTITION\", 
\"TCQ_RETRY_TIME\") VALUES (?, ?, ?, ?, ?, " + getEpochFn(dbProduct) + ")";
+            } else {
+              query = "INSERT INTO \"TXN_CLEANUP_QUEUE\" 
(\"TCQ_RETRY_RETENTION\", \"TCQ_ERROR_MESSAGE\", " +
+                      "\"TCQ_DATABASE\", \"TCQ_TABLE\", \"TCQ_RETRY_TIME\") 
VALUES (?, ?, ?, ?, " + getEpochFn(dbProduct) + ")";

Review Comment:
   Nice idea. Implemented. Done.



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