Skip to content

Commit 80d375a

Browse files
committed
Remove one of the tryToPut() overloads.
1 parent 5accde7 commit 80d375a

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ private[spark] class MemoryStore(blockManager: BlockManager, memoryManager: Memo
9696
putIterator(blockId, values, level, returnValues = true)
9797
} else {
9898
val droppedBlocks = new ArrayBuffer[(BlockId, BlockStatus)]
99-
tryToPut(blockId, bytes, bytes.limit, deserialized = false, droppedBlocks)
99+
tryToPut(blockId, () => bytes, bytes.limit, deserialized = false, droppedBlocks)
100100
PutResult(bytes.limit(), Right(bytes.duplicate()), droppedBlocks)
101101
}
102102
}
@@ -155,11 +155,11 @@ private[spark] class MemoryStore(blockManager: BlockManager, memoryManager: Memo
155155
// Values are fully unrolled in memory, so store them as an array
156156
if (level.deserialized) {
157157
val sizeEstimate = SizeEstimator.estimate(arrayValues.asInstanceOf[AnyRef])
158-
tryToPut(blockId, arrayValues, sizeEstimate, deserialized = true, droppedBlocks)
158+
tryToPut(blockId, () => arrayValues, sizeEstimate, deserialized = true, droppedBlocks)
159159
PutResult(sizeEstimate, Left(arrayValues.iterator), droppedBlocks)
160160
} else {
161161
val bytes = blockManager.dataSerialize(blockId, arrayValues.iterator)
162-
tryToPut(blockId, bytes, bytes.limit, deserialized = false, droppedBlocks)
162+
tryToPut(blockId, () => bytes, bytes.limit, deserialized = false, droppedBlocks)
163163
PutResult(bytes.limit(), Right(bytes.duplicate()), droppedBlocks)
164164
}
165165
case Right(iteratorValues) =>
@@ -322,15 +322,6 @@ private[spark] class MemoryStore(blockManager: BlockManager, memoryManager: Memo
322322
blockId.asRDDId.map(_.rddId)
323323
}
324324

325-
private def tryToPut(
326-
blockId: BlockId,
327-
value: Any,
328-
size: Long,
329-
deserialized: Boolean,
330-
droppedBlocks: mutable.Buffer[(BlockId, BlockStatus)]): Boolean = {
331-
tryToPut(blockId, () => value, size, deserialized, droppedBlocks)
332-
}
333-
334325
/**
335326
* Try to put in a set of values, if we can free up enough space. The value should either be
336327
* an Array if deserialized is true or a ByteBuffer otherwise. Its (possibly estimated) size

0 commit comments

Comments
 (0)