Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9241#discussion_r42953350
--- Diff:
core/src/main/scala/org/apache/spark/shuffle/ShuffleMemoryManager.scala ---
@@ -128,17 +161,31 @@ class ShuffleMemoryManager protected (
metrics.updatedBlocks = Some(lastUpdatedBlocks ++
evictedBlocks.toSeq)
}
taskMemory(taskAttemptId) += acquired
+ val consumers = taskConsumers.getOrElseUpdate(taskAttemptId, new
mutable.HashMap())
+ consumers += consumer -> (consumers.getOrElse(consumer, 0L) + acquired)
acquired
}
+ def release(numBytes: Long): Unit = release(numBytes, null)
+
/** Release numBytes bytes for the current task. */
- def release(numBytes: Long): Unit = memoryManager.synchronized {
+ def release(numBytes: Long, consumer: MemoryConsumer): Unit =
memoryManager.synchronized {
val taskAttemptId = currentTaskAttemptId()
val curMem = taskMemory.getOrElse(taskAttemptId, 0L)
if (curMem < numBytes) {
throw new SparkException(
s"Internal error: release called on $numBytes bytes but task only
has $curMem")
}
+ taskConsumers.get(taskAttemptId).map { consumers =>
+ if (consumers.contains(consumer)) {
+ consumers(consumer) -= numBytes
+ if (consumers(consumer) <= 0) {
+ consumers.remove(consumer)
+ }
+ } else {
+ logError(s"BUG: release $numBytes from $consumer in task
$taskAttemptId")
--- End diff --
If the `spark.testing` system property is set, then I think this warning
should become an exception, since that will let us detect problems in unit
tests.
---
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]