GJL commented on a change in pull request #9904: [FLINK-14232][runtime] Support
global failure handling in NG scheduling
URL: https://github.com/apache/flink/pull/9904#discussion_r338024833
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/executiongraph/failover/flip1/ExecutionFailureHandlerTest.java
##########
@@ -167,23 +164,49 @@ public void testUnrecoverableErrorCheck() {
new Exception(new SuppressRestartsException(new
Exception()))));
}
+ @Test
+ public void testGlobalFailureHandling() {
+ final FailureHandlingResult result =
executionFailureHandler.getGlobalFailureHandlingResult(
+ new Exception("test failure"));
+
+ assertTrue(result.canRestart());
+ assertEquals(restartDelayMs, result.getRestartDelayMS());
+ assertEquals(
+
StreamSupport.stream(failoverTopology.getFailoverVertices().spliterator(),
false)
+ .map(FailoverVertex::getExecutionVertexID)
+ .collect(Collectors.toSet()),
+ result.getVerticesToRestart());
+ try {
+ result.getError();
+ fail("Cannot get error when the restarting is
accepted");
+ } catch (IllegalStateException ex) {
+ // expected
+ }
+ }
+
//
------------------------------------------------------------------------
// utilities
//
------------------------------------------------------------------------
/**
- * A FailoverStrategy implementation for tests. It always suggest
restarting the given task set on construction.
+ * A FailoverStrategy implementation for tests. It always suggests
restarting the given tasks to restart.
*/
private class TestFailoverStrategy implements FailoverStrategy {
- private final Set<ExecutionVertexID> tasksToRestart;
+ private Set<ExecutionVertexID> tasksToRestart;
- public TestFailoverStrategy(Set<ExecutionVertexID>
tasksToRestart) {
- this.tasksToRestart = checkNotNull(tasksToRestart);
+ public TestFailoverStrategy() {
+ }
+
+ public void setTasksToRestart(final Set<ExecutionVertexID>
tasksToRestart) {
+ this.tasksToRestart = tasksToRestart;
Review comment:
Consider making a defensive copy of the `Set` and returning an immutable Set
in the getter. However, I am also fine with the current state since this is a
test class.
----------------------------------------------------------------
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