WencongLiu commented on code in PR #23564:
URL: https://github.com/apache/flink/pull/23564#discussion_r1369895717


##########
flink-table/flink-sql-gateway/src/test/java/org/apache/flink/table/gateway/rest/OperationRelatedITCase.java:
##########
@@ -119,18 +119,25 @@ List<String> submitOperation() throws Exception {
         SessionHandle sessionHandle = new 
SessionHandle(UUID.fromString(sessionHandleId));
         
assertThat(SQL_GATEWAY_SERVICE_EXTENSION.getSessionManager().getSession(sessionHandle))
                 .isNotNull();
+
+        OneShotLatch startLatch = new OneShotLatch();
+        Thread main = Thread.currentThread();
         OperationHandle operationHandle =
                 SQL_GATEWAY_SERVICE_EXTENSION
                         .getService()
                         .submitOperation(
                                 sessionHandle,
                                 () -> {
                                     try {
-                                        TimeUnit.SECONDS.sleep(10);
+                                        startLatch.trigger();
+                                        // keep operation in RUNNING state in 
response to cancel
+                                        // or close operations.
+                                        main.join();
                                     } catch (InterruptedException ignored) {
                                     }
                                     return NotReadyResult.INSTANCE;
                                 });
+        startLatch.await();

Review Comment:
   Why we need `startLatch` here? Consider this extreme case, the main thread 
execute `startLatch.await();` after `startLatch.trigger();` is executed. Then 
the main thread will get stuck 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-unsubscr...@flink.apache.org

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

Reply via email to