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

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

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



##########
File path: 
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java
##########
@@ -993,7 +994,7 @@ public boolean checkFailedCompactions(CompactionInfo ci) 
throws MetaException {
     try {
       try {
         dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
-        pStmt = dbConn.prepareStatement("SELECT \"CC_STATE\" FROM 
\"COMPLETED_COMPACTIONS\" WHERE " +
+        pStmt = dbConn.prepareStatement("SELECT \"CC_STATE\", 
\"CC_ENQUEUE_TIME\" FROM \"COMPLETED_COMPACTIONS\" WHERE " +

Review comment:
       enqueue time is guaranteed to be filled out for every compaction, the 
others might be null for a failed one.

##########
File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/conf/MetastoreConf.java
##########
@@ -415,6 +415,10 @@ public static ConfVars getMetaConf(String name) {
         new RangeValidator(1, 20), "Number of consecutive compaction failures 
(per table/partition) " +
         "after which automatic compactions will not be scheduled any more.  
Note that this must be less " +
         "than hive.compactor.history.retention.failed."),
+    
COMPACTOR_INITIATOR_FAILED_RETRY_TIME("metastore.compactor.initiator.failed.retry.time",
+        "hive.compactor.initiator.failed.retry.time", 7, TimeUnit.DAYS,
+        "Time after Initiator will ignore 
metastore.compactor.initiator.failed.compacts.threshold and retry with 
compaction again. \n"

Review comment:
       fixed

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

Review comment:
       fixed




----------------------------------------------------------------
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: 532722)
    Time Spent: 50m  (was: 40m)

> 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: 50m
>  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