-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-41460][CORE] Introduce IsolatedThreadSafeRpcEndpoint to extend IsolatedRpcEndpoint
#38995
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about renaming IsolatedRpcEndpoint to IsolatedThreadSafeRpcEndpoint simply? It's hard for me to imagine IsolatedButNotThreadSafeRpcEndpoint.
I think this would breach the original design by the author argued at #26059 (comment). I don't want to break it, though I also don't have a use case of |
| /** | ||
| * Limit the threadCount to 1 so that messages are ensured to be handled in a thread-safe way. | ||
| */ | ||
| final def threadCount(): Int = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the PR description, this final def is the main contribution, @Ngone51 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, and also the naming of IsolatedThreadSafeRpcEndpoint.
dongjoon-hyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, LGTM.
IsolatedThreadSafeRpcEndpoint to extend IsolatedRpcEndpoint
mridulm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
With this change, IsolatedRpcEndpoint is essentially a noop - other than as a marker interface, right ? Wondering if we want to remove it entirely
|
Thanks @dongjoon-hyun @mridulm |
…nd `IsolatedRpcEndpoint` ### What changes were proposed in this pull request? This PR introduces a new layer `IsolatedThreadSafeRpcEndpoint` to extend `IsolatedRpcEndpoint` and changes all the endpoints which currently extend `IsolatedRpcEndpoint` to extend `IsolatedThreadSafeRpcEndpoint` instead. Besides, `IsolatedThreadSafeRpcEndpoint` has overridden `def threadCount(): Int = 1` with `final` to avoid mistakenly having thread count > 1 for the thread-safe endpoint. ### Why are the changes needed? Busy endpoints like `DriverEndpoint`, `BlockManagerMasterEndpoint` were known to be thread-safe when they extended `ThreadSafeRpcEndpoint`. After we introduce `IsolatedRpcEndpoint` in [SPARK-29398](https://issues.apache.org/jira/browse/SPARK-29398), all these busy endpoints have been changed to extend `IsolatedRpcEndpoint`. These busy endpoints are still thread-safe since `IsolatedRpcEndpoint` by default only uses 1 thread. But that's not explicit to developers now compared to `ThreadSafeRpcEndpoint` (I actually find some people became to be confused about whether the endpoint is thread-safe or not). From time to time, `IsolatedRpcEndpoint#threadCount` might be mistakenly overridden with threadCount > 1 leading to thread-safety being broken. So this PR refactor here a bit to avoid the potential issue. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? N/A Closes apache#38995 from Ngone51/isolated. Authored-by: Yi Wu <yi.wu@databricks.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
What changes were proposed in this pull request?
This PR introduces a new layer
IsolatedThreadSafeRpcEndpointto extendIsolatedRpcEndpointand changes all the endpoints which currently extendIsolatedRpcEndpointto extendIsolatedThreadSafeRpcEndpointinstead. Besides,IsolatedThreadSafeRpcEndpointhas overriddendef threadCount(): Int = 1withfinalto avoid mistakenly having thread count > 1 for the thread-safe endpoint.Why are the changes needed?
Busy endpoints like
DriverEndpoint,BlockManagerMasterEndpointwere known to be thread-safe when they extendedThreadSafeRpcEndpoint. After we introduceIsolatedRpcEndpointin SPARK-29398, all these busy endpoints have been changed to extendIsolatedRpcEndpoint. These busy endpoints are still thread-safe sinceIsolatedRpcEndpointby default only uses 1 thread. But that's not explicit to developers now compared toThreadSafeRpcEndpoint(I actually find some people became to be confused about whether the endpoint is thread-safe or not). From time to time,IsolatedRpcEndpoint#threadCountmight be mistakenly overridden with threadCount > 1 leading to thread-safety being broken. So this PR refactor here a bit to avoid the potential issue.Does this PR introduce any user-facing change?
No.
How was this patch tested?
N/A