You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "beliefer (via GitHub)" <gi...@apache.org> on 2025/03/21 11:11:08 UTC
[PR] [FLINK-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
beliefer opened a new pull request, #26334:
URL: https://github.com/apache/flink/pull/26334
## What is the purpose of the change
This PR aims to respect the design of chain programming for `RpcServiceBuilder`.
## Brief change log
Respect the design of chain programming for `RpcServiceBuilder`.
## Verifying this change
This change is already covered by existing tests, such as *(please describe 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)
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2754588857
@beliefer - I agree with @xintongsong on this one, and am not keen to merge - with the potential risks that it could introduce for minimal gain. @zentol WDYT?
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2745302839
ping @zentol @xintongsong cc @1996fanrui @davidradl
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2014242913
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
@beliefer sorry if I am not being clear.
1) if bindAddress is never null coming into this method, then we do not need the if or the Preconditions.checkNotNull . In this case we can remove the if and the Preconditions.checkNotNull
2) if bindAddress can be null coming into this method then Preconditions.checkNotNull will throw a null pointer exception. So the current change changes behaviour as the null pointer will not be thrown.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007401000
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -78,13 +78,9 @@ static PekkoRpcService createRemoteRpcService(
throws Exception {
final PekkoRpcServiceBuilder rpcServiceBuilder =
PekkoRpcServiceUtils.remoteServiceBuilder(
- configuration, externalAddress, externalPortRange);
-
- if (bindAddress != null) {
- rpcServiceBuilder.withBindAddress(bindAddress);
- }
-
- bindPort.ifPresent(rpcServiceBuilder::withBindPort);
+ configuration, externalAddress, externalPortRange)
Review Comment:
this changes behaviour - prior to the fix if there was no bindPort we would build with the bind address if there was one.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2746715794
@xintongsong Thank you for your explanation. I will close this PR.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2747565239
Furthermore, I would like to say that this class does not encapsulate its own logic well.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007619154
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
Are you saying that the bindAddress is never null ? If so then Preconditions.checkNotNull never thows an error and `if (bindAddress != null) {` the fix adds is not needed?
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer closed pull request #26334: [FLINK-37531] Respect the design of chain programming for RpcServiceBuilder
URL: https://github.com/apache/flink/pull/26334
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007406798
##########
flink-rpc/flink-rpc-core/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java:
##########
@@ -147,15 +147,11 @@ public static RpcService createRemoteRpcService(
@Nullable String bindAddress,
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") Optional<Integer> bindPort)
throws Exception {
- RpcSystem.RpcServiceBuilder rpcServiceBuilder =
- rpcSystem.remoteServiceBuilder(configuration, externalAddress, externalPortRange);
- if (bindAddress != null) {
- rpcServiceBuilder = rpcServiceBuilder.withBindAddress(bindAddress);
Review Comment:
prior to this change a a null bindAddress does not result in an error, after the change it does.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer closed pull request #26334: [FLINK-37531] Respect the design of chain programming for RpcServiceBuilder
URL: https://github.com/apache/flink/pull/26334
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2743099208
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "e606b4fb8e2abd12085285f0a5f73eb15601118d",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "e606b4fb8e2abd12085285f0a5f73eb15601118d",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* e606b4fb8e2abd12085285f0a5f73eb15601118d 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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007397305
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
why change you changed this - prior to the change we would get a null pointer for null so we would end up in error processing
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007616829
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -78,13 +78,9 @@ static PekkoRpcService createRemoteRpcService(
throws Exception {
final PekkoRpcServiceBuilder rpcServiceBuilder =
PekkoRpcServiceUtils.remoteServiceBuilder(
- configuration, externalAddress, externalPortRange);
-
- if (bindAddress != null) {
- rpcServiceBuilder.withBindAddress(bindAddress);
- }
-
- bindPort.ifPresent(rpcServiceBuilder::withBindPort);
+ configuration, externalAddress, externalPortRange)
Review Comment:
In fact, create `ActorSystem` without `bindPort` is legal.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2007609847
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
In fact, we must ensure `bindAddress` is not null. All the code paths show that check the value like below.
```
if (bindAddress != null) {
rpcServiceBuilder.withBindAddress(bindAddress);
}
```
So the `Preconditions.checkNotNull` is meaningless.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2754630286
@davidradl Thank you.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "xintongsong (via GitHub)" <gi...@apache.org>.
xintongsong commented on PR #26334:
URL: https://github.com/apache/flink/pull/26334#issuecomment-2745321714
> According to the design of RpcServiceBuilder, the implementation should follow the style of chain programming.
I'm not sure about this. The builder style design makes `RpcServiceBuilder` *CAN* be used in a chaining style programing, but that doesn't mean we *SHOULD* follow the chaining style. In fact, one of the advantages of the builder style is that you don't need to set all the parameters at once. By strictly following the chaining style, we lose that flexibility, and having to changing the null-handling logics is a prove of that. So TBH, I don't think this PR makes any improvement to the code style.
Moreover, even if this does improve the code style, I don't think it makes sense to take the risk of breaking a fundamental component that has been stable and not touched for years (no matter how little the risk is), and pay the efforts to implement and review the change, just for a code style improvement that does not help users with any actual behavior changes.
So overall I'd be -1 for merging this PR.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2008783221
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
Yes. we must provide the bindAddress for `ActorSystem`.
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/pekko/PekkoRpcServiceUtils.java:
##########
@@ -294,15 +290,20 @@ public PekkoRpcServiceBuilder withCustomConfig(final Config customConfig) {
@Override
public PekkoRpcServiceBuilder withBindAddress(final String bindAddress) {
- this.bindAddress = Preconditions.checkNotNull(bindAddress);
+ if (bindAddress != null) {
Review Comment:
Yes. we must provide the `bindAddress` for `ActorSystem`.
--
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-37531] Respect the design of chain programming for RpcServiceBuilder [flink]
Posted by "beliefer (via GitHub)" <gi...@apache.org>.
beliefer commented on code in PR #26334:
URL: https://github.com/apache/flink/pull/26334#discussion_r2008784238
##########
flink-rpc/flink-rpc-core/src/main/java/org/apache/flink/runtime/rpc/RpcUtils.java:
##########
@@ -147,15 +147,11 @@ public static RpcService createRemoteRpcService(
@Nullable String bindAddress,
@SuppressWarnings("OptionalUsedAsFieldOrParameterType") Optional<Integer> bindPort)
throws Exception {
- RpcSystem.RpcServiceBuilder rpcServiceBuilder =
- rpcSystem.remoteServiceBuilder(configuration, externalAddress, externalPortRange);
- if (bindAddress != null) {
- rpcServiceBuilder = rpcServiceBuilder.withBindAddress(bindAddress);
Review Comment:
Before the change, `rpcServiceBuilder` do not set the `bindAddress`. After the change, it is the same as.
`if (bindAddress != null) {` is moved from caller side to the inner of `withBindAddress`.
--
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