squito commented on a change in pull request #25620: [SPARK-25341][Core]
Support rolling back a shuffle map stage and re-generate the shuffle files
URL: https://github.com/apache/spark/pull/25620#discussion_r319635175
##########
File path:
core/src/main/scala/org/apache/spark/shuffle/sort/SortShuffleManager.scala
##########
@@ -130,11 +131,12 @@ private[spark] class SortShuffleManager(conf: SparkConf)
extends ShuffleManager
/** Get a writer for a given partition. Called on executors by map tasks. */
override def getWriter[K, V](
handle: ShuffleHandle,
- mapId: Int,
context: TaskContext,
metrics: ShuffleWriteMetricsReporter): ShuffleWriter[K, V] = {
- numMapsForShuffle.putIfAbsent(
- handle.shuffleId, handle.asInstanceOf[BaseShuffleHandle[_, _,
_]].numMaps)
+ taskIdMapsForShuffle.synchronized {
+ taskIdMapsForShuffle.putIfAbsent(handle.shuffleId,
ArrayBuffer.empty[Long])
+
taskIdMapsForShuffle.get(handle.shuffleId).append(context.taskAttemptId())
Review comment:
you're trying to protect concurrent access to the `ArrayBuffer[Long]` with
that synchronized block, right? minor, but you could avoid locking the entire
map, and instead do
```scala
val mapTaskIds = taskIdMapsForShuffle.putIfAbsent(handle.shuffleId,
ArrayBuffer.empty[Long])
mapTaskIds.synchronized { mapTaskIds.append(context.taskAttemptId()) }
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]