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/04/14 03:09:15 UTC

[GitHub] [flink] pltbkd opened a new pull request, #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

pltbkd opened a new pull request, #19464:
URL: https://github.com/apache/flink/pull/19464

   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   The PR is fixing an issue that the operator coordinator may trigger a checkpoint without canceling/completing the previous one, because the canceling request is processed before the triggering of the previous checkpoint.
   
   ## Brief change log
   
   *(for example:)*
     - Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
     - Run the newly added test case.
     - To reproduce the issue, revert the code and run the newly added test. The test should fail with a java.lang.IllegalStateException: Cannot mark for checkpoint 2, already marked for checkpoint 1.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: yes
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


-- 
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


[GitHub] [flink] gaoyunhaii closed pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii closed pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.
URL: https://github.com/apache/flink/pull/19464


-- 
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


[GitHub] [flink] pltbkd commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
pltbkd commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851911039


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3693,92 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing1() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        ManuallyTriggeredScheduledExecutor manuallyTriggeredOperatorCoordinatorExecutor =
+                new ManuallyTriggeredScheduledExecutor();
+        final OperatorID operatorID = new OperatorID();
+        OperatorCoordinatorHolder context =
+                OperatorCoordinatorHolder.create(
+                        new SerializedValue<>(new TestingOperatorCoordinator.Provider(operatorID)),
+                        graph.getJobVertex(jobVertexID),
+                        getClass().getClassLoader(),
+                        new CoordinatorStoreImpl());
+        context.lazyInitialize(
+                ExceptionUtils::rethrow,
+                new ComponentMainThreadExecutorServiceAdapter(
+                        manuallyTriggeredOperatorCoordinatorExecutor, Thread.currentThread()));
+
+        ManuallyTriggeredScheduledExecutorService manuallyTriggeredIOExecutor =
+                new ManuallyTriggeredScheduledExecutorService();
+        CheckpointCoordinator checkpointCoordinator =
+                new CheckpointCoordinatorBuilder()
+                        .setCheckpointCoordinatorConfiguration(
+                                CheckpointCoordinatorConfiguration.builder()
+                                        .setCheckpointTimeout(10)
+                                        .build())
+                        .setIoExecutor(manuallyTriggeredIOExecutor)
+                        .setTimer(manuallyTriggeredScheduledExecutor)
+                        .setCoordinatorsToCheckpoint(Collections.singleton(context))
+                        .build(graph);
+        try {
+            checkpointCoordinator.triggerCheckpoint(false);
+            // create checkpoint plan

Review Comment:
   Yes you are right. I'll fix.



-- 
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


[GitHub] [flink] gaoyunhaii commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851886455


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3693,92 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing1() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        ManuallyTriggeredScheduledExecutor manuallyTriggeredOperatorCoordinatorExecutor =
+                new ManuallyTriggeredScheduledExecutor();
+        final OperatorID operatorID = new OperatorID();
+        OperatorCoordinatorHolder context =
+                OperatorCoordinatorHolder.create(
+                        new SerializedValue<>(new TestingOperatorCoordinator.Provider(operatorID)),
+                        graph.getJobVertex(jobVertexID),
+                        getClass().getClassLoader(),
+                        new CoordinatorStoreImpl());
+        context.lazyInitialize(
+                ExceptionUtils::rethrow,
+                new ComponentMainThreadExecutorServiceAdapter(
+                        manuallyTriggeredOperatorCoordinatorExecutor, Thread.currentThread()));
+
+        ManuallyTriggeredScheduledExecutorService manuallyTriggeredIOExecutor =
+                new ManuallyTriggeredScheduledExecutorService();
+        CheckpointCoordinator checkpointCoordinator =
+                new CheckpointCoordinatorBuilder()
+                        .setCheckpointCoordinatorConfiguration(
+                                CheckpointCoordinatorConfiguration.builder()
+                                        .setCheckpointTimeout(10)
+                                        .build())
+                        .setIoExecutor(manuallyTriggeredIOExecutor)
+                        .setTimer(manuallyTriggeredScheduledExecutor)
+                        .setCoordinatorsToCheckpoint(Collections.singleton(context))
+                        .build(graph);
+        try {
+            checkpointCoordinator.triggerCheckpoint(false);
+            // create checkpoint plan

Review Comment:
   I think here should be `get checkpoint id`. 



-- 
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


[GitHub] [flink] gaoyunhaii commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851958729


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3688,66 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testAbortingBeforeTriggeringCheckpointOperatorCoordinator() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        String trigger = "Trigger";
+        String abort = "Abort";
+        final List<String> notificationSequence = new ArrayList<>();
+        CheckpointCoordinatorTestingUtils.MockOperatorCoordinatorCheckpointContext context =
+                new CheckpointCoordinatorTestingUtils
+                                .MockOperatorCheckpointCoordinatorContextBuilder()
+                        .setOperatorID(new OperatorID())
+                        .setOnCallingCheckpointCoordinator(
+                                (id, future) -> notificationSequence.add(trigger + id))

Review Comment:
   Perhaps we also complete the future here so that it could go through the remaining codes after trigger operator coordinators.  



-- 
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


[GitHub] [flink] gaoyunhaii commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851861664


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3693,92 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing1() throws Exception {

Review Comment:
   Rename to `testAbortingBeforeTriggeringCheckpointOperatorCoordinator` ?



-- 
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


[GitHub] [flink] pltbkd commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
pltbkd commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r850050705


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3693,92 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing1() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to

Review Comment:
   I was struggling with the executing order to reproduce the issue, and am looking forward to some suggestions to consolidate the case.



-- 
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


[GitHub] [flink] pltbkd commented on pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
pltbkd commented on PR #19464:
URL: https://github.com/apache/flink/pull/19464#issuecomment-1101145312

   > 1. hen we could remove actions related to `manuallyTriggeredScheduledExecutor`. For mock `OperatorCoordinatorContext`, I think we could simply add a callback to `abortTriggering` in `MockOperatorCheckpointCoordinatorContextBuilder`.
   
   Thanks for the suggestion! Although the behavior is still strictly bound to the current implementation, the code is much clearer. And an UT of the checkpoint coordinator is not responsible to validate the behavior of the operator coordinator, so a mock of the operator coordinator can be useful. I'll follow the suggestion and modify the PR soon.


-- 
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


[GitHub] [flink] gaoyunhaii commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851969315


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3688,66 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testAbortingBeforeTriggeringCheckpointOperatorCoordinator() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        String trigger = "Trigger";
+        String abort = "Abort";
+        final List<String> notificationSequence = new ArrayList<>();
+        CheckpointCoordinatorTestingUtils.MockOperatorCoordinatorCheckpointContext context =
+                new CheckpointCoordinatorTestingUtils
+                                .MockOperatorCheckpointCoordinatorContextBuilder()
+                        .setOperatorID(new OperatorID())
+                        .setOnCallingCheckpointCoordinator(
+                                (id, future) -> notificationSequence.add(trigger + id))
+                        .setOnCallingAbortCurrentTriggering(() -> notificationSequence.add(abort))
+                        .build();
+
+        CheckpointCoordinator checkpointCoordinator =
+                new CheckpointCoordinatorBuilder()
+                        .setCheckpointCoordinatorConfiguration(
+                                CheckpointCoordinatorConfiguration.builder()
+                                        .setCheckpointTimeout(10)
+                                        .build())
+                        .setIoExecutor(manuallyTriggeredScheduledExecutor)
+                        .setTimer(manuallyTriggeredScheduledExecutor)
+                        .setCoordinatorsToCheckpoint(Collections.singleton(context))
+                        .build(graph);
+        try {
+            checkpointCoordinator.triggerCheckpoint(false);
+            // trigger twice to get checkpoint id and create pending checkpoint
+            manuallyTriggeredScheduledExecutor.trigger();
+            manuallyTriggeredScheduledExecutor.trigger();
+
+            // declineCheckpoint should be called after pending checkpoint is created but before the
+            // following steps
+            declineCheckpoint(1L, checkpointCoordinator, jobVertexID, graph);
+            // then trigger all tasks. the order is 1.initialize checkpoint location, 2.handle
+            // checkpoint abortion, 3.trigger coordinator checkpointing for the aborted checkpoint.
+            // The disordering of abortion and triggering was causing an error
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            // trigger the next checkpoint
+            checkState(!checkpointCoordinator.isTriggering());
+            checkpointCoordinator.triggerCheckpoint(false);
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            Assert.assertTrue(
+                    !notificationSequence.contains(trigger + "1")
+                            || notificationSequence.indexOf(trigger + "1")

Review Comment:
   Got that~ 



-- 
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


[GitHub] [flink] pltbkd commented on pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
pltbkd commented on PR #19464:
URL: https://github.com/apache/flink/pull/19464#issuecomment-1101908514

   @flinkbot run azure


-- 
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


[GitHub] [flink] gaoyunhaii commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851959033


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3688,66 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testAbortingBeforeTriggeringCheckpointOperatorCoordinator() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        String trigger = "Trigger";
+        String abort = "Abort";
+        final List<String> notificationSequence = new ArrayList<>();
+        CheckpointCoordinatorTestingUtils.MockOperatorCoordinatorCheckpointContext context =
+                new CheckpointCoordinatorTestingUtils
+                                .MockOperatorCheckpointCoordinatorContextBuilder()
+                        .setOperatorID(new OperatorID())
+                        .setOnCallingCheckpointCoordinator(
+                                (id, future) -> notificationSequence.add(trigger + id))
+                        .setOnCallingAbortCurrentTriggering(() -> notificationSequence.add(abort))
+                        .build();
+
+        CheckpointCoordinator checkpointCoordinator =
+                new CheckpointCoordinatorBuilder()
+                        .setCheckpointCoordinatorConfiguration(
+                                CheckpointCoordinatorConfiguration.builder()
+                                        .setCheckpointTimeout(10)
+                                        .build())
+                        .setIoExecutor(manuallyTriggeredScheduledExecutor)
+                        .setTimer(manuallyTriggeredScheduledExecutor)
+                        .setCoordinatorsToCheckpoint(Collections.singleton(context))
+                        .build(graph);
+        try {
+            checkpointCoordinator.triggerCheckpoint(false);
+            // trigger twice to get checkpoint id and create pending checkpoint
+            manuallyTriggeredScheduledExecutor.trigger();
+            manuallyTriggeredScheduledExecutor.trigger();
+
+            // declineCheckpoint should be called after pending checkpoint is created but before the
+            // following steps
+            declineCheckpoint(1L, checkpointCoordinator, jobVertexID, graph);
+            // then trigger all tasks. the order is 1.initialize checkpoint location, 2.handle
+            // checkpoint abortion, 3.trigger coordinator checkpointing for the aborted checkpoint.
+            // The disordering of abortion and triggering was causing an error
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            // trigger the next checkpoint
+            checkState(!checkpointCoordinator.isTriggering());
+            checkpointCoordinator.triggerCheckpoint(false);
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            Assert.assertTrue(
+                    !notificationSequence.contains(trigger + "1")
+                            || notificationSequence.indexOf(trigger + "1")

Review Comment:
   I think in this case there should be no situation like `notificationSequence.indexOf(trigger + "1") < notificationSequence.indexOf(abort)` since `!notificationSequence.contains(trigger + "1")` should always be ture?



-- 
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


[GitHub] [flink] gaoyunhaii commented on pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
gaoyunhaii commented on PR #19464:
URL: https://github.com/apache/flink/pull/19464#issuecomment-1101106904

   Very thanks @pltbkd for the PR! For the test, I think we might be able to simplify it a bit by
   
   1. In this test, we should not need an actual `OperatorCoordinator`. We could have a mock one and check the order of triggering / abort. In this case, the expected sequence will be " abort / triggering checkpoint 2", and the bad sequence before the fixing is "abort / triggering checkpoint 1 / triggering checkpoint 2". We could detect if the error occurs by checking the received sequences. Then we could remove actions related to `manuallyTriggeredScheduledExecutor`. For mock `OperatorCoordinatorContext`, I think we could simply add a callback to `abortTriggering` in `MockOperatorCheckpointCoordinatorContextBuilder`. 
   2. We could also use manuallyTriggeredScheduledExecutor for `setIoExecutor`. Then the actions could be simplified to 
   
   ```java
   checkpointCoordinator.triggerCheckpoint(false);
   // create checkpoint plan
   manuallyTriggeredScheduledExecutor.trigger();
   // create pending checkpoint
   manuallyTriggeredScheduledExecutor.trigger();
   
   declineCheckpoint(1L, checkpointCoordinator, jobVertexID, graph);
   
   // Here there the actions get queued included the action to acquire checkpoint
   // location followed by the actions related to aborting. Then we'll first
   // execute the getLocation, which adds more actions after the aborting
   // related actions. 
   manuallyTriggeredScheduledExecutor.triggerAll();
   
   checkState(!checkpointCoordinator.isTriggering());
   
   // The second checkpoint
   checkpointCoordinator.triggerCheckpoint(false);
   manuallyTriggeredScheduledExecutor.triggerAll();
   
   // Finally we could verify there is no triggering checkpoint 1 here. 
   ```
   
   


-- 
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


[GitHub] [flink] flinkbot commented on pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
flinkbot commented on PR #19464:
URL: https://github.com/apache/flink/pull/19464#issuecomment-1098666230

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "c76ce7592cea572fc27d11a8e82911efc088ec92",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "c76ce7592cea572fc27d11a8e82911efc088ec92",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * c76ce7592cea572fc27d11a8e82911efc088ec92 UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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


[GitHub] [flink] pltbkd commented on a diff in pull request #19464: [FLINK-27148][checkpoint] Skip snapshotting the coordinators state or the master state if the pending checkpoint has been disposed.

Posted by GitBox <gi...@apache.org>.
pltbkd commented on code in PR #19464:
URL: https://github.com/apache/flink/pull/19464#discussion_r851967292


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java:
##########
@@ -3688,6 +3688,66 @@ public void testTimeoutWhileCheckpointOperatorCoordinatorNotFinishing() throws E
         }
     }
 
+    @Test
+    public void testAbortingBeforeTriggeringCheckpointOperatorCoordinator() throws Exception {
+        // Warn: The case is fragile since a specific order of executing the tasks is required to
+        // reproduce the issue.
+        JobVertexID jobVertexID = new JobVertexID();
+        ExecutionGraph graph =
+                new CheckpointCoordinatorTestingUtils.CheckpointExecutionGraphBuilder()
+                        .addJobVertex(jobVertexID)
+                        .build(EXECUTOR_RESOURCE.getExecutor());
+
+        String trigger = "Trigger";
+        String abort = "Abort";
+        final List<String> notificationSequence = new ArrayList<>();
+        CheckpointCoordinatorTestingUtils.MockOperatorCoordinatorCheckpointContext context =
+                new CheckpointCoordinatorTestingUtils
+                                .MockOperatorCheckpointCoordinatorContextBuilder()
+                        .setOperatorID(new OperatorID())
+                        .setOnCallingCheckpointCoordinator(
+                                (id, future) -> notificationSequence.add(trigger + id))
+                        .setOnCallingAbortCurrentTriggering(() -> notificationSequence.add(abort))
+                        .build();
+
+        CheckpointCoordinator checkpointCoordinator =
+                new CheckpointCoordinatorBuilder()
+                        .setCheckpointCoordinatorConfiguration(
+                                CheckpointCoordinatorConfiguration.builder()
+                                        .setCheckpointTimeout(10)
+                                        .build())
+                        .setIoExecutor(manuallyTriggeredScheduledExecutor)
+                        .setTimer(manuallyTriggeredScheduledExecutor)
+                        .setCoordinatorsToCheckpoint(Collections.singleton(context))
+                        .build(graph);
+        try {
+            checkpointCoordinator.triggerCheckpoint(false);
+            // trigger twice to get checkpoint id and create pending checkpoint
+            manuallyTriggeredScheduledExecutor.trigger();
+            manuallyTriggeredScheduledExecutor.trigger();
+
+            // declineCheckpoint should be called after pending checkpoint is created but before the
+            // following steps
+            declineCheckpoint(1L, checkpointCoordinator, jobVertexID, graph);
+            // then trigger all tasks. the order is 1.initialize checkpoint location, 2.handle
+            // checkpoint abortion, 3.trigger coordinator checkpointing for the aborted checkpoint.
+            // The disordering of abortion and triggering was causing an error
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            // trigger the next checkpoint
+            checkState(!checkpointCoordinator.isTriggering());
+            checkpointCoordinator.triggerCheckpoint(false);
+            manuallyTriggeredScheduledExecutor.triggerAll();
+
+            Assert.assertTrue(
+                    !notificationSequence.contains(trigger + "1")
+                            || notificationSequence.indexOf(trigger + "1")

Review Comment:
   It's always true with the fixed code but false when we try to reproduce the issue by reverting the patch, though there's also an AssertionError if we remove the latter condition. The latter one is here because it's theoretical a correct situation.



-- 
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