Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/3794#discussion_r23507001
--- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala
---
@@ -483,6 +483,20 @@ class DAGScheduler(
assert(partitions.size > 0)
val func2 = func.asInstanceOf[(TaskContext, Iterator[_]) => _]
val waiter = new JobWaiter(this, jobId, partitions.size, resultHandler)
+
+ // The reason for performing this call here is that computing the
partitions
+ // may be very expensive for certain types of RDDs (e.g. HadoopRDDs),
so therefore
+ // we'd like that computation to take place outside of the
DAGScheduler to avoid
+ // blocking its event processing loop. See SPARK-4961 for details.
+ try {
+ getParentStages(rdd, jobId).foreach(_.rdd.partitions)
--- End diff --
I just realized that this could be a thread-safety issue: `getParentStages`
could call `getShuffleMapStage`, which mutates a non-thread-safe
`shuffleToMapStage` map. Even if that map was synchronized, we could still
have race-conditions between calls from the event processing loop and external
calls.
Do you think we could just call `rdd.partitions` on the final RDD (e.g. the
`rdd` local variable here) instead of calling `getParentStages`?
---
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]