Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/3629#discussion_r25490289
--- Diff: core/src/main/scala/org/apache/spark/storage/MemoryStore.scala ---
@@ -469,10 +485,32 @@ private[spark] class MemoryStore(blockManager:
BlockManager, maxMemory: Long)
}
/**
+ * Reserve the unroll memory of current unroll successful block used by
this thread
+ * until actually put the block into memory entry.
+ */
+ def reservePendingUnrollMemoryForThisThread(memory: Long): Unit = {
+ val threadId = Thread.currentThread().getId
+ accountingLock.synchronized {
+ pendingUnrollMemoryMap(threadId) =
pendingUnrollMemoryMap.getOrElse(threadId, 0L) + memory
+ }
+ }
+
+ /**
+ * Release pending unroll memory of current unroll successful block used
by this thread
+ */
+ def releasePendingUnrollMemoryForThisThread(): Unit = {
+ val threadId = Thread.currentThread().getId
+ accountingLock.synchronized {
+ pendingUnrollMemoryMap.remove(threadId)
+ }
+ }
+
+ /**
* Return the amount of memory currently occupied for unrolling blocks
across all threads.
*/
def currentUnrollMemory: Long = accountingLock.synchronized {
- unrollMemoryMap.values.sum
+ unrollMemoryMap.values.sum + pendingUnrollMemoryMap.
+ filter(_._1 != Thread.currentThread().getId).values.sum
--- End diff --
Why does this factor out the current thread's pending unroll memory? This
is not consistent with the javadocs. If we want to minus the current thread's
pending unroll memory we should do it outside of this method.
---
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]