1996fanrui commented on code in PR #19993:
URL: https://github.com/apache/flink/pull/19993#discussion_r901630411


##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateWriteRequestExecutorImplTest.java:
##########
@@ -128,12 +131,33 @@ public void testIgnoresInterruptsWhileRunning() throws 
Exception {
         }
     }
 
-    @Test
-    public void testCanBeClosed() throws IOException {
-        TestRequestDispatcher requestProcessor = new TestRequestDispatcher();
+    @Test(timeout = 10000)
+    public void testCanBeClosed() throws Exception {
+        long checkpointId = 1L;
+        ChannelStateWriteRequestDispatcher processor =

Review Comment:
   Because the TestRequestDispatcher don't call the action and discardAction. 
It can't reproduce this bug.



##########
flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/channel/ChannelStateWriteRequestExecutorImplTest.java:
##########
@@ -128,12 +131,33 @@ public void testIgnoresInterruptsWhileRunning() throws 
Exception {
         }
     }
 
-    @Test
-    public void testCanBeClosed() throws IOException {
-        TestRequestDispatcher requestProcessor = new TestRequestDispatcher();
+    @Test(timeout = 10000)
+    public void testCanBeClosed() throws Exception {
+        long checkpointId = 1L;
+        ChannelStateWriteRequestDispatcher processor =
+                new ChannelStateWriteRequestDispatcherImpl(
+                        "dummy task",
+                        0,
+                        getStreamFactoryFactory(),
+                        new ChannelStateSerializerImpl());
         try (ChannelStateWriteRequestExecutorImpl worker =
-                new ChannelStateWriteRequestExecutorImpl(TASK_NAME, 
requestProcessor)) {
+                new ChannelStateWriteRequestExecutorImpl(TASK_NAME, 
processor)) {
             worker.start();
+            worker.submit(
+                    new CheckpointStartRequest(
+                            checkpointId,
+                            new ChannelStateWriter.ChannelStateWriteResult(),
+                            CheckpointStorageLocationReference.getDefault()));
+            worker.submit(
+                    ChannelStateWriteRequest.write(
+                            checkpointId,
+                            new ResultSubpartitionInfo(0, 0),
+                            new CompletableFuture<>()));
+            worker.submit(
+                    ChannelStateWriteRequest.write(
+                            checkpointId,
+                            new ResultSubpartitionInfo(0, 0),
+                            new CompletableFuture<>()));

Review Comment:
   It's required, I have analyzed 
[here](https://github.com/apache/flink/pull/19993#discussion_r901261999). 
   
   > For old code, the unit-test gets stuck in the second dataFuture.get(). 
After the change, the unit-test worked fine.



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

Reply via email to