Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-36876] Support external eventLoopGroup for RestClient #25788

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chenyuzhi459
Copy link
Contributor

@chenyuzhi459 chenyuzhi459 commented Dec 11, 2024

What is the purpose of the change

Support external eventLoopGroup for RestClient

Brief change log

  • Support pass an external eventLoopGroup in the constructor of RestClient
  • Close only for internal eventLoopGroup, not for external

Verifying this change

The change is tested by RestClientTest.testExternalEventGroup

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

@flinkbot
Copy link
Collaborator

flinkbot commented Dec 11, 2024

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@@ -143,30 +144,42 @@ public class RestClient implements AutoCloseableAsync {
ConcurrentHashMap.newKeySet();

private final List<OutboundChannelHandlerFactory> outboundChannelHandlerFactories;
private final Boolean useInternalEventLoopGroup;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: why not boolean, I assume we do not want this ever to be null

}

private RestClusterClient(
Configuration configuration,
@Nullable RestClient restClient,
T clusterId,
WaitStrategy waitStrategy,
ClientHighAvailabilityServicesFactory clientHAServicesFactory)
ClientHighAvailabilityServicesFactory clientHAServicesFactory,
EventLoopGroup group)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we tag with @nullable?

selectStrategyFactory);
useInternalEventLoopGroup = true;
} else {
useInternalEventLoopGroup = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we check that the supplied group is not shutting down or shutdown

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the channel is NioSocketChannel.class is this always the case for external groups?

Copy link
Contributor Author

@chenyuzhi459 chenyuzhi459 Dec 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the extenal service doesn't care the type of SocketChannel. As the jira says, it just pass a shared event group to avoid heap memory leak.

Maybe it's a better choice to specify the contruct param group as NioEventLoopGroup, which could avoid the type error building Bootstrap instance ?

@davidradl
Copy link
Contributor

Reviewed by Chi on 12/12/24. Asked submitter questions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants