-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-17463][Core]Make CollectionAccumulator and SetAccumulator's value can be read thread-safely #15063
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
|
Test build #65271 has finished for PR 15063 at commit
|
|
I think that we may also want to do this for |
| class SetAccumulator[T] extends AccumulatorV2[T, HashSet[T]] { | ||
| private val _set = new HashSet[T]() | ||
| class SetAccumulator[T] extends AccumulatorV2[T, java.util.Set[T]] { | ||
| private val _set = Collections.synchronizedSet(new java.util.HashSet[T]()) |
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.
If you use Collections.synchronized*, will serialization of those objects also be thread-safe (i.e. will writeObject synchronize properly)? What about if Kryo is used?
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.
For Java serialization, it's synchronized. See: http://www.grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/Collections.java#2080
Do we use Kryo to serialize Heartbeat?
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.
Nope, it looks like NettyRpcEnv.serialize is hardcoded to use a JavaSerializer instance.
|
Test build #65270 has finished for PR 15063 at commit
|
|
Test build #3255 has finished for PR 15063 at commit
|
|
Test build #65272 has finished for PR 15063 at commit
|
|
Jenkins, retest this please. (Retesting so MiMa can run again) |
|
Test build #65281 has finished for PR 15063 at commit
|
|
Test build #65287 has finished for PR 15063 at commit
|
|
LGTM, so I'm going to merge this into master and branch-2.0. |
…alue can be read thread-safely ## What changes were proposed in this pull request? Make CollectionAccumulator and SetAccumulator's value can be read thread-safely to fix the ConcurrentModificationException reported in [JIRA](https://issues.apache.org/jira/browse/SPARK-17463). ## How was this patch tested? Existing tests. Author: Shixiong Zhu <shixiong@databricks.com> Closes #15063 from zsxwing/SPARK-17463. (cherry picked from commit e33bfae) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
…alue can be read thread-safely ## What changes were proposed in this pull request? Make CollectionAccumulator and SetAccumulator's value can be read thread-safely to fix the ConcurrentModificationException reported in [JIRA](https://issues.apache.org/jira/browse/SPARK-17463). ## How was this patch tested? Existing tests. Author: Shixiong Zhu <shixiong@databricks.com> Closes apache#15063 from zsxwing/SPARK-17463.
What changes were proposed in this pull request?
Make CollectionAccumulator and SetAccumulator's value can be read thread-safely to fix the ConcurrentModificationException reported in JIRA.
How was this patch tested?
Existing tests.