Skip to content

Commit eec4f6c

Browse files
committed
Collapse ensureFreeSpace overloads
1 parent 13ba7ad commit eec4f6c

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

core/src/main/scala/org/apache/spark/storage/MemoryStore.scala

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -429,29 +429,10 @@ private[spark] class MemoryStore(blockManager: BlockManager, memoryManager: Memo
429429
blockId: BlockId,
430430
space: Long,
431431
droppedBlocks: mutable.Buffer[(BlockId, BlockStatus)]): Boolean = {
432-
ensureFreeSpace(Some(blockId), space, droppedBlocks)
433-
}
434-
435-
/**
436-
* Try to free up a given amount of space to store a particular block, but can fail if
437-
* either the block is bigger than our memory or it would require replacing another block
438-
* from the same RDD (which leads to a wasteful cyclic replacement pattern for RDDs that
439-
* don't fit into memory that we want to avoid).
440-
*
441-
* @param blockId the ID of the block we are freeing space for, if any
442-
* @param space the size of this block
443-
* @param droppedBlocks a holder for blocks evicted in the process
444-
* @return whether the requested free space is freed.
445-
*/
446-
private def ensureFreeSpace(
447-
blockId: Option[BlockId],
448-
space: Long,
449-
droppedBlocks: mutable.Buffer[(BlockId, BlockStatus)]): Boolean = {
450432
memoryManager.synchronized {
451433
val freeMemory = maxMemory - memoryUsed
452434

453-
logInfo(s"Ensuring $space bytes of free space " +
454-
blockId.map { id => s"for block $id" }.getOrElse("") +
435+
logInfo(s"Ensuring $space bytes of free space for block $blockId" +
455436
s"(free: $freeMemory, max: $maxMemory)")
456437

457438
assert(space <= maxMemory)
@@ -461,7 +442,7 @@ private[spark] class MemoryStore(blockManager: BlockManager, memoryManager: Memo
461442
true
462443
} else {
463444
// Evict blocks as necessary
464-
evictBlocksToFreeSpace(blockId, freeMemory - space, droppedBlocks)
445+
evictBlocksToFreeSpace(Some(blockId), freeMemory - space, droppedBlocks)
465446
}
466447
}
467448
}

0 commit comments

Comments
 (0)