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

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

                Author: ASF GitHub Bot
            Created on: 24/Mar/22 11:32
            Start Date: 24/Mar/22 11:32
    Worklog Time Spent: 10m 
      Work Description: deniskuzZ commented on a change in pull request #3126:
URL: https://github.com/apache/hive/pull/3126#discussion_r834207004



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/Worker.java
##########
@@ -627,18 +617,52 @@ public CompactorMR getMrCompactor() {
     return new CompactorMR();
   }
 
-  private void markFailed(CompactionInfo ci, String errorMessage) {
-    if (ci != null && StringUtils.isNotBlank(errorMessage)) {
-      ci.errorMessage = errorMessage;
+  private void markWithState(CompactionInfo ci, Object error, CompactionState 
state) {
+    if (ci == null) {
+      LOG.warn("Could not set compaction info state because it is null!");
+      throw new RuntimeException("Could not set compaction info state because 
it is null!");
     }
+    String defaultMessage = "Error during compaction. Compaction info: " + ci;
+    if (error != null) {
+      if (error instanceof Throwable) {
+        ci.errorMessage = ((Throwable)error).getMessage();
+      } else {
+        ci.errorMessage = error.toString();
+      }
+    }
+
     if (msc == null) {
-      LOG.warn("Metastore client was null. Could not mark failed: {}", ci);
-      return;
+      LOG.warn("Metastore client was null. Could not set compaction info 
state: {}", ci);
+      throw new RuntimeException("Metastore client was null. Could not set 
compaction info state: " + ci);
     }
+
     try {
-      msc.markFailed(CompactionInfo.compactionInfoToStruct(ci));
+      switch (state) {
+        case Failed: {
+          if (error instanceof Throwable) {
+            LOG.error(defaultMessage, (Throwable)error);
+          } else {
+            LOG.error(defaultMessage);
+          }
+          msc.markFailed(CompactionInfo.compactionInfoToStruct(ci));
+          break;
+        }
+        case Refused: {
+          if (error instanceof Throwable) {
+            LOG.error(defaultMessage, (Throwable)error);
+          } else {
+            LOG.warn(defaultMessage);
+          }
+          msc.markRefused(CompactionInfo.compactionInfoToStruct(ci));
+          break;
+        }
+        case Compacted: {
+          msc.markCompacted(CompactionInfo.compactionInfoToStruct(ci));
+          break;
+        }
+      }
     } catch (Throwable t) {
-      LOG.error("Caught an exception while trying to mark compaction {} as 
failed: {}", ci, t);
+      LOG.error("Caught an exception while trying to set compaction {} state 
{}", ci, t);

Review comment:
       Why aren't you propagating the exception back?




-- 
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: gitbox-unsubscr...@hive.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

    Worklog Id:     (was: 747134)
    Time Spent: 3h 10m  (was: 3h)

> Use the new "REFUSED" compaction state where it makes sense
> -----------------------------------------------------------
>
>                 Key: HIVE-26026
>                 URL: https://issues.apache.org/jira/browse/HIVE-26026
>             Project: Hive
>          Issue Type: Improvement
>          Components: Hive
>            Reporter: László Végh
>            Assignee: László Végh
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> The 
> org.apache.hadoop.hive.ql.txn.compactor.Worker#findNextCompactionAndExecute 
> method does several checks (The table/partition exists, is not sorted, there 
> are enough files to compact, etc.) before it actually executes the compaction 
> request. If the compaction request fails on any of these checks, it is put to 
> "SUCCEEDED" state which is often misleading for users. SHOW COMPACTIONS will 
> show these requests as succeeded without an error, while the table is not 
> compacted at all.
> For these cases, the state should be "REFUSED" instead of "SUCCEEDED" among 
> with the appropriate error message.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to