kfaraz commented on code in PR #13354:
URL: https://github.com/apache/druid/pull/13354#discussion_r1028054803
##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/SeekableStreamSupervisor.java:
##########
@@ -1948,24 +1942,58 @@ public Boolean
apply(SeekableStreamIndexTaskRunner.Status status)
}
}
- List<Boolean> results =
Futures.successfulAsList(futures).get(futureTimeoutInSeconds, TimeUnit.SECONDS);
+ List<Either<Throwable, Boolean>> results = coalesceAndAwait(futures);
+
+ final List<ListenableFuture<Void>> stopFutures = new ArrayList<>();
for (int i = 0; i < results.size(); i++) {
- if (results.get(i) == null) {
- String taskId = futureTaskIds.get(i);
+ String taskId = futureTaskIds.get(i);
+ if (results.get(i).isError() || results.get(i).valueOrThrow() == null) {
killTask(taskId, "Task [%s] failed to return status, killing task",
taskId);
+ } else if (Boolean.valueOf(false).equals(results.get(i).valueOrThrow()))
{
+ // "return false" above means that we want to stop the task.
+ stopFutures.add(stopTask(taskId, false));
}
}
log.debug("Found [%d] seekablestream indexing tasks for dataSource [%s]",
taskCount, dataSource);
- // make sure the checkpoints are consistent with each other and with the
metadata store
+ if (!stopFutures.isEmpty()) {
+ coalesceAndAwait(stopFutures);
+ }
+ // make sure the checkpoints are consistent with each other and with the
metadata store
verifyAndMergeCheckpoints(taskGroupsToVerify.values());
// A pause from the previous Overlord's supervisor, immediately before
leader change,
// can lead to tasks being in a state where they are active but do not
read.
resumeAllActivelyReadingTasks();
}
+ private ListenableFuture<Pair<SeekableStreamIndexTaskRunner.Status,
Map<PartitionIdType, SequenceOffsetType>>> getStatusAndPossiblyEndOffsets(
+ final String taskId
+ )
+ {
+ return Futures.transform(
+ taskClient.getStatusAsync(taskId),
+ new AsyncFunction<SeekableStreamIndexTaskRunner.Status,
Pair<SeekableStreamIndexTaskRunner.Status, Map<PartitionIdType,
SequenceOffsetType>>>()
Review Comment:
Makes sense, thanks.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]