[ 
https://issues.apache.org/jira/browse/HIVE-25115?focusedWorklogId=600541&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-600541
 ]

ASF GitHub Bot logged work on HIVE-25115:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/May/21 17:45
            Start Date: 21/May/21 17:45
    Worklog Time Spent: 10m 
      Work Description: belugabehr commented on a change in pull request #2274:
URL: https://github.com/apache/hive/pull/2274#discussion_r637097800



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java
##########
@@ -305,16 +302,19 @@ public void markCompacted(CompactionInfo info) throws 
MetaException {
          * By filtering on minOpenTxnWaterMark, we will only cleanup after 
every transaction is committed, that could see
          * the uncompacted deltas. This way the cleaner can clean up 
everything that was made obsolete by this compaction.
          */
-        String s = "SELECT \"CQ_ID\", \"CQ_DATABASE\", \"CQ_TABLE\", 
\"CQ_PARTITION\", "
-                + "\"CQ_TYPE\", \"CQ_RUN_AS\", \"CQ_HIGHEST_WRITE_ID\" FROM 
\"COMPACTION_QUEUE\" WHERE \"CQ_STATE\" = '"
-                + READY_FOR_CLEANING + "'";
-        if (minOpenTxnWaterMark > 0) {
-          s = s + " AND (\"CQ_NEXT_TXN_ID\" <= " + minOpenTxnWaterMark + " OR 
\"CQ_NEXT_TXN_ID\" IS NULL)";
-        }
+        String s = "SELECT \"CQ_ID\", \"CQ_DATABASE\", \"CQ_TABLE\", 
\"CQ_PARTITION\", \"CQ_TYPE\", \"CQ_RUN_AS\"," +
+                " \"CQ_HIGHEST_WRITE_ID\", \"CQ_NEXT_TXN_ID\" FROM 
\"COMPACTION_QUEUE\" WHERE \"CQ_ID\" IN (" +
+                " SELECT DISTINCT \"CQ_ID\" FROM (" +
+                "   SELECT MAX(\"CQ_NEXT_TXN_ID\") \"CQ_NEXT_TXN_ID\", 
MAX(\"CQ_ID\") \"CQ_ID\" " +
+                "     FROM \"COMPACTION_QUEUE\" WHERE \"CQ_STATE\" = '" + 
READY_FOR_CLEANING + "'" +
+                "     AND (\"CQ_NEXT_TXN_ID\" <= "+ minOpenTxnWaterMark + " OR 
\"CQ_NEXT_TXN_ID\" IS NULL)";
         if (retentionTime > 0) {
-          s = s + " AND \"CQ_COMMIT_TIME\" < (" + getEpochFn(dbProduct) + " - 
" + retentionTime + ")";
+          s += "      AND \"CQ_COMMIT_TIME\" < (" + getEpochFn(dbProduct) + " 
- " + retentionTime + ")";
+        }
+        s += "        GROUP BY \"CQ_DATABASE\", \"CQ_TABLE\", \"CQ_PARTITION\" 
) \"X\" )";
+        if (LOG.isDebugEnabled()) {
+          LOG.debug("Going to execute query <" + s + ">");

Review comment:
       `LOG.debug("Going to... <{}>", s);`




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

For queries about this service, please contact Infrastructure at:
[email protected]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 600541)
    Time Spent: 40m  (was: 0.5h)

> Compaction queue entries may accumulate in "ready for cleaning" state
> ---------------------------------------------------------------------
>
>                 Key: HIVE-25115
>                 URL: https://issues.apache.org/jira/browse/HIVE-25115
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Karen Coppage
>            Assignee: Karen Coppage
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> If the Cleaner does not delete any files, the compaction queue entry is 
> thrown back to the queue and remains in "ready for cleaning" state.
> Problem: If 2 compactions run on the same table and enter "ready for 
> cleaning" state at the same time, only one "cleaning" will remove obsolete 
> files, the other entry will remain in the queue in "ready for cleaning" state.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to