You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by fj...@apache.org on 2018/10/08 15:53:41 UTC

[incubator-druid] branch master updated: Fail compactionTask if it fails to run one of indexTaskSpecs (#6428)

This is an automated email from the ASF dual-hosted git repository.

fjy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 2b76d57  Fail compactionTask if it fails to run one of indexTaskSpecs (#6428)
2b76d57 is described below

commit 2b76d573471261bc2f4bee658bef9cc1709dde90
Author: Jihoon Son <ji...@apache.org>
AuthorDate: Mon Oct 8 08:53:32 2018 -0700

    Fail compactionTask if it fails to run one of indexTaskSpecs (#6428)
    
    * Fail compactionTask if it fails to run one of indexTaskSpecs
    
    * add log
---
 .../org/apache/druid/indexing/common/task/CompactionTask.java    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java
index 27df0e7..4b0da2a 100644
--- a/indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java
+++ b/indexing-service/src/main/java/org/apache/druid/indexing/common/task/CompactionTask.java
@@ -261,8 +261,10 @@ public class CompactionTask extends AbstractTask
       log.warn("Interval[%s] has no segments, nothing to do.", interval);
       return TaskStatus.failure(getId());
     } else {
-      log.info("Generated [%d] compaction task specs", indexTaskSpecs.size());
+      final int totalNumSpecs = indexTaskSpecs.size();
+      log.info("Generated [%d] compaction task specs", totalNumSpecs);
 
+      int failCnt = 0;
       for (IndexTask eachSpec : indexTaskSpecs) {
         final String json = jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(eachSpec);
         log.info("Running indexSpec: " + json);
@@ -270,15 +272,18 @@ public class CompactionTask extends AbstractTask
         try {
           final TaskStatus eachResult = eachSpec.run(toolbox);
           if (!eachResult.isSuccess()) {
+            failCnt++;
             log.warn("Failed to run indexSpec: [%s].\nTrying the next indexSpec.", json);
           }
         }
         catch (Exception e) {
+          failCnt++;
           log.warn(e, "Failed to run indexSpec: [%s].\nTrying the next indexSpec.", json);
         }
       }
 
-      return TaskStatus.success(getId());
+      log.info("Run [%d] specs, [%d] succeeded, [%d] failed", totalNumSpecs, totalNumSpecs - failCnt, failCnt);
+      return failCnt == 0 ? TaskStatus.success(getId()) : TaskStatus.failure(getId());
     }
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org