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

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

                Author: ASF GitHub Bot
            Created on: 07/Jan/21 21:31
            Start Date: 07/Jan/21 21:31
    Worklog Time Spent: 10m 
      Work Description: pvargacl commented on a change in pull request #1839:
URL: https://github.com/apache/hive/pull/1839#discussion_r553600334



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java
##########
@@ -1006,16 +1007,23 @@ public boolean checkFailedCompactions(CompactionInfo 
ci) throws MetaException {
         rs = pStmt.executeQuery();
         int numFailed = 0;
         int numTotal = 0;
+        long lastEnqueueTime = -1;
         int failedThreshold = MetastoreConf.getIntVar(conf, 
ConfVars.COMPACTOR_INITIATOR_FAILED_THRESHOLD);
         while(rs.next() && ++numTotal <= failedThreshold) {
+          long enqueueTime = rs.getLong(2);
+          if (enqueueTime > lastEnqueueTime) {
+            lastEnqueueTime = enqueueTime;
+          }
           if(rs.getString(1).charAt(0) == FAILED_STATE) {
             numFailed++;
           }
           else {
             numFailed--;
           }
         }
-        return numFailed == failedThreshold;
+        // If the last attempt was too long ago, ignore the failed treshold 
and try compaction again
+        long retryTime = MetastoreConf.getTimeVar(conf, 
ConfVars.COMPACTOR_INITIATOR_FAILED_RETRY_TIME, TimeUnit.MILLISECONDS);

Review comment:
       I don't really want to do that. The same is true for 
COMPACTOR_INITIATOR_FAILED_THRESHOLD a few lines up, but I think this makes 
this code more readable and more testable by its own. Besides this part is not 
that time critical, since it is a background process.




----------------------------------------------------------------
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: 532728)
    Time Spent: 1h 10m  (was: 1h)

> Retry compaction after configured time
> --------------------------------------
>
>                 Key: HIVE-24602
>                 URL: https://issues.apache.org/jira/browse/HIVE-24602
>             Project: Hive
>          Issue Type: Improvement
>            Reporter: Peter Varga
>            Assignee: Peter Varga
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> Currently if compaction fails two consecutive times it will stop compaction 
> forever for the given partition / table unless someone manually intervenes. 
> See COMPACTOR_INITIATOR_FAILED_THRESHOLD.
> The Initiator should retry again after a configurable amount of time.



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

Reply via email to