GJL commented on a change in pull request #8972: [FLINK-13060][coordination]
Respect restart constraints in new RegionFailover strategy
URL: https://github.com/apache/flink/pull/8972#discussion_r300250505
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/AdaptedRestartPipelinedRegionStrategyNG.java
##########
@@ -107,11 +107,16 @@ protected void restartTasks(final Set<ExecutionVertexID>
verticesToRestart) {
FutureUtils.assertNoException(
cancelTasks(verticesToRestart)
-
.thenRunAsync(resetAndRescheduleTasks(globalModVersion, vertexVersions),
executionGraph.getJobMasterMainThreadExecutor())
+ .thenApply(ignored ->
createResetAndRescheduleTasksRunnable(globalModVersion, vertexVersions))
+ .thenAccept(restartAction ->
executionGraph.getRestartStrategy()
Review comment:
I don't think the `.thenApply` stage is needed. Also, the `.thenAccept`
stage breaks the level of abstraction. I'd extract the body into a new
function. Consider this structure:
```
FutureUtils.assertNoException(
cancelTasks(verticesToRestart)
.thenRun(scheduleRestart(globalModVersion,
vertexVersions)) // strictly speaking should be thenRunAsync?
.handle(failGlobalOnError()));
}
private Runnable scheduleRestart(final long globalModVersion, final
Set<ExecutionVertexVersion> vertexVersions) {
final RestartStrategy restartStrategy =
executionGraph.getRestartStrategy();
return () -> restartStrategy.restart(
resetAndRescheduleTasks(globalModVersion,
vertexVersions),
executionGraph.getJobMasterMainThreadExecutor()
);
}
private RestartCallback resetAndRescheduleTasks(final long
globalModVersion, final Set<ExecutionVertexVersion> vertexVersions) {
...
```
----------------------------------------------------------------
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]
With regards,
Apache Git Services