Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/11886#discussion_r60841016
--- Diff: core/src/main/scala/org/apache/spark/MapOutputTracker.scala ---
@@ -431,6 +431,7 @@ private[spark] class MapOutputTrackerMaster(conf:
SparkConf)
def getSerializedMapOutputStatuses(shuffleId: Int): Array[Byte] = {
var statuses: Array[MapStatus] = null
var epochGotten: Long = -1
+ var byteArr: Array[Byte] = null
--- End diff --
I think this is OK, but this can still go in the synchronized block and a
few lines down, to keep the scope narrower. I think it's fairly OK as it though.
This certainly solves the problem you identified. It does mean more work is
done while holding the lock, so that no other threads can retrieve cached
statuses while this is happening. I assume that's why it was written that way
to begin with, even if it causes the problem you identify.
I wonder if there is any decent way to rewrite this to manage that better?
it would require some object to synchronize on per serialized status so that
only one thread can retrieve it. Easily solved with a bit of redirection, like
holding a simple AtomicReference to the byte array and locking on the former.
Worth it or over-thinking it? I wouldn't mind hearing a though from
@andrewor14 or @vanzin if they have instincts on this one.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]