-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-3116] Remove the excessive lockings in TorrentBroadcast #2028
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
QA tests have started for PR 2028 at commit
|
Can you clarify what is the guarantee that we are trying to maintain in this class ? Is it that if two executor threads try to read the same broadcast variable we want it to be safe ? |
Yes. |
LGTM.Alright I looked through the code and tried to verify this change was safe. Just summarizing what I saw while walking through the code (in case it helps in the future)
|
QA tests have finished for PR 2028 at commit
|
Ok I'm merging this in master & branch-1.1. |
Author: Reynold Xin <rxin@apache.org> Closes #2028 from rxin/torrentBroadcast and squashes the following commits: 92c62a5 [Reynold Xin] Revert the MEMORY_AND_DISK_SER changes. 03a5221 [Reynold Xin] [SPARK-3116] Remove the excessive lockings in TorrentBroadcast (cherry picked from commit 8257733) Signed-off-by: Reynold Xin <rxin@apache.org>
Actually, I think two threads could get into the constructor simultaneously, but it wouldn't be a problem because the calls would be for different broadcast ids. ( |
Hmm -- according to JLS [1], objects are only made available to other threads after the constructor finishes. So technically only one thread can call an object's constructor. However constructors are not thread safe if we expose a reference to In this case I didn't see the reference leaking, but I guess it doesn't hurt to track down the callers to verify things. [1] http://docs.oracle.com/javase/specs/jls/se5.0/html/classes.html#8.8.3 |
Regarding the first synchronized in that constructor, my understanding is that the original My point was that multiple TorrentBroadcast objects can be simultaneously under construction, but that it's safe because they'll have distinct ids; I think preventing leakage of a partially-constructed object is a separate issue that doesn't come into play here. |
Author: Reynold Xin <rxin@apache.org> Closes apache#2028 from rxin/torrentBroadcast and squashes the following commits: 92c62a5 [Reynold Xin] Revert the MEMORY_AND_DISK_SER changes. 03a5221 [Reynold Xin] [SPARK-3116] Remove the excessive lockings in TorrentBroadcast
No description provided.