XComp commented on a change in pull request #18637:
URL: https://github.com/apache/flink/pull/18637#discussion_r800966184
##########
File path:
flink-runtime/src/test/java/org/apache/flink/runtime/dispatcher/cleanup/DefaultResourceCleanerTest.java
##########
@@ -181,33 +212,97 @@ public void
testMediumPriorityCleanupBlocksAllLowerPrioritizedCleanups() {
assertThat(noPriorityCleanup1.isDone()).isTrue();
}
+ @Test
+ public void testCleanupWithRetries() {
+ final Collection<JobID> actualJobIds = new ArrayList<>();
+ final CleanupCallback cleanupWithRetries =
cleanupWithRetry(actualJobIds, 2);
+ final SingleCallCleanup oneRunCleanup =
SingleCallCleanup.withCompletionOnCleanup();
+
+ final CompletableFuture<Void> compositeCleanupResult =
+ createTestInstanceBuilder(new FixedRetryStrategy(2,
Duration.ZERO))
+ .withRegularCleanup(cleanupWithRetries)
+ .withRegularCleanup(oneRunCleanup)
+ .build()
+ .cleanupAsync(JOB_ID);
+
+
assertThat(compositeCleanupResult).succeedsWithin(Duration.ofMillis(100));
+
+ assertThat(oneRunCleanup.getProcessedJobId()).isEqualTo(JOB_ID);
+ assertThat(oneRunCleanup.isDone()).isTrue();
+ assertThat(actualJobIds).containsExactly(JOB_ID, JOB_ID, JOB_ID);
+ }
+
+ @Test
+ public void testCleanupWithSingleRetryInHighPriorityTask() {
+ final Collection<JobID> actualJobIds = new ArrayList<>();
+ final CleanupCallback cleanupWithRetry =
cleanupWithRetry(actualJobIds, 1);
+ final SingleCallCleanup oneRunCleanup =
SingleCallCleanup.withCompletionOnCleanup();
+
+ final CompletableFuture<Void> compositeCleanupResult =
+ createTestInstanceBuilder(new FixedRetryStrategy(1,
Duration.ZERO))
+ .withPrioritizedCleanup(cleanupWithRetry)
Review comment:
Yes, the prioritized cleanup is necessary for the global cleanup. We
have to clean the `JobManagerRunnerRegistry` before cleaning the
`HighAvailabilityServices`. There is a watcher implementation in the k8s leader
election that complains/throws an Exception if we clean ConfigMaps while not
being the leader. That could happen if we run the `HighAvailabilityServices`
cleanup before stopping the leader election of the `JobMaster` (which happens
in the JobMaster close business logic).
--
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]