mirror of https://github.com/apache/druid.git
Fail compactionTask if it fails to run one of indexTaskSpecs (#6428)
* Fail compactionTask if it fails to run one of indexTaskSpecs * add log
This commit is contained in:
parent
88d23b77b7
commit
2b76d57347
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue