You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jiabao-Sun (via GitHub)" <gi...@apache.org> on 2023/10/23 03:54:29 UTC
[PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Jiabao-Sun opened a new pull request, #23564:
URL: https://github.com/apache/flink/pull/23564
<!--
*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
[FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis
## Brief change log
The operation execution is asynchronous and the status will only be updated from Pending to Running after calling from the runBefore method.
```
Jul 20 04:23:49 org.opentest4j.AssertionFailedError:
Jul 20 04:23:49
Jul 20 04:23:49 Expecting actual's toString() to return:
Jul 20 04:23:49 "PENDING"
Jul 20 04:23:49 but was:
Jul 20 04:23:49 "RUNNING"
Jul 20 04:23:49 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Jul 20 04:23:49 at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Jul 20 04:23:49 at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Jul 20 04:23:49 at org.apache.flink.table.gateway.rest.OperationRelatedITCase.testOperationRelatedApis(OperationRelatedITCase.java:91)
Jul 20 04:23:49 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Jul 20 04:23:49 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
Jul 20 04:23:49 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
Jul 20 04:23:49 at java.lang.reflect.Method.invoke(Method.java:498)
Jul 20 04:23:49 at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
Jul 20 04:23:49 at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
Jul 20 04:23:49 at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
Jul 20 04:23:49 at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
Jul 20 04:23:49 at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
Jul 20 04:23:49 at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:21
```
## Verifying this change
This change is already covered by existing tests.
## 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: (no)
- The S3 file system connector: (no)
## Documentation
- Does this pull request introduce a new feature? (no)
- If yes, how is the feature documented? (not documented)
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on code in PR #23564:
URL: https://github.com/apache/flink/pull/23564#discussion_r1369952969
##########
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:
Good point. I overlooked the fact that `OneShotLatch#await()` will not get stuck if `trigger()` is already called.
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1775527798
Hi @XComp, could you help with it as well?
Thanks :)
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1776862435
Sorry for the late reply. I'll take a look 😊. @Jiabao-Sun
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1780717657
Hi @fsk119, could you help review it when you have time?
Thanks a lot.
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
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-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "leonardBang (via GitHub)" <gi...@apache.org>.
leonardBang merged PR #23564:
URL: https://github.com/apache/flink/pull/23564
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1781504928
Hi @leonardBang, do you have time to help review it?
Thanks.
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on code in PR #23564:
URL: https://github.com/apache/flink/pull/23564#discussion_r1369909942
##########
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:
Thanks @WencongLiu.
The Runnable work above is asynchronous, and the status will be turned to RUNNING only when runBefore method
is executed. So we need a latch to prevent the state has not been turned from PENDING into RUNNING yet.
https://github.com/apache/flink/blob/22c1eb44df7226c8e9045789e45c71c93668c644/flink-table/flink-sql-gateway/src/main/java/org/apache/flink/table/gateway/service/operation/OperationManager.java#L247-L269
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1774393422
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "bff9234113ad13e9d535bef3761b0a61a168f956",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "bff9234113ad13e9d535bef3761b0a61a168f956",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* bff9234113ad13e9d535bef3761b0a61a168f956 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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1774391325
Hi @WencongLiu, @fsk119.
Could you help review it when you have time?
Thanks.
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "Jiabao-Sun (via GitHub)" <gi...@apache.org>.
Jiabao-Sun commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1776841973
Hi @xuyangzhong, could you help review this when you have time?
--
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
Re: [PR] [FLINK-32661][sql-gateway] Fix unstable OperationRelatedITCase.testOperationRelatedApis [flink]
Posted by "WencongLiu (via GitHub)" <gi...@apache.org>.
WencongLiu commented on PR #23564:
URL: https://github.com/apache/flink/pull/23564#issuecomment-1776956979
cc @fsk119
--
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