You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/01/31 13:56:50 UTC

[GitHub] [flink] XComp commented on a change in pull request #18569: [FLINK-25847] Fix deadlock in DefaultMultipleComponentLeaderElectionService

XComp commented on a change in pull request #18569:
URL: https://github.com/apache/flink/pull/18569#discussion_r795688448



##########
File path: flink-kubernetes/src/test/java/org/apache/flink/kubernetes/highavailability/KubernetesHighAvailabilityRecoverFromSavepointITCase.java
##########
@@ -101,12 +102,14 @@ public void setup() throws Exception {
     @Test
     public void testRecoverFromSavepoint() throws Exception {
         final JobGraph jobGraph = createJobGraph();
-        clusterClient.submitJob(jobGraph).get(TIMEOUT, TimeUnit.MILLISECONDS);
+        clusterClient
+                .submitJob(jobGraph)
+                .get(TestingUtils.infiniteTime().toMilliseconds(), TimeUnit.MILLISECONDS);

Review comment:
       just to be clear: That's just added to comply to with our guidelines for tests to not use timeouts, isn't it? It's not related to the change itself...

##########
File path: flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/DefaultMultipleComponentLeaderElectionServiceTest.java
##########
@@ -203,6 +206,68 @@ public void allKnownLeaderInformationCallsEventHandlers() throws Exception {
         }
     }
 
+    @Test
+    public void allKnownLeaderInformationDoesNotBlock() throws Exception {
+        final TestingMultipleComponentLeaderElectionDriver leaderElectionDriver =
+                TestingMultipleComponentLeaderElectionDriver.newBuilder().build();
+        final DefaultMultipleComponentLeaderElectionService leaderElectionService =
+                new DefaultMultipleComponentLeaderElectionService(
+                        fatalErrorHandlerExtension.getTestingFatalErrorHandler(),
+                        new TestingMultipleComponentLeaderElectionDriverFactory(
+                                leaderElectionDriver),
+                        java.util.concurrent.Executors.newSingleThreadScheduledExecutor());

Review comment:
       static import?

##########
File path: flink-core/src/test/java/org/apache/flink/testutils/TestingUtils.java
##########
@@ -56,4 +56,9 @@ public static ScheduledExecutor defaultScheduledExecutor() {
     public static UUID zeroUUID() {
         return ZERO_UUID;
     }
+
+    public static Duration infiniteDuration() {
+        // a year should be more than enough for simulating an infinite duration
+        return Duration.ofDays(365L);

Review comment:
       nit: I'd still prefer `Long.MAX_VALUE` here. That would make it obvious through the code and we could remove the comment. Additionally, we could move the method up next to `infiniteTime()` since they are closely related and refactor `infiniteTime()` in the following way:
   ```
   public static Time infiniteTime() {
       return Time.fromDuration(infiniteDuration());
   }
   ```




-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org