squito commented on a change in pull request #23688: [SPARK-25035][Core]
Avoiding memory mapping at disk-stored blocks replication
URL: https://github.com/apache/spark/pull/23688#discussion_r254073272
##########
File path: core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala
##########
@@ -906,6 +910,55 @@ class BlockManagerSuite extends SparkFunSuite with
Matchers with BeforeAndAfterE
}
}
+ def testPutBlockDataAsStream(
+ name: String,
+ blockManager: BlockManager,
+ storageLevel: StorageLevel): Unit = {
+ val message = "message"
+ val ser = serializer.newInstance().serialize(message).array()
+ val blockId = new ShuffleDataBlockId(0, 0, 0)
+ val streamCallbackWithId =
+ blockManager.putBlockDataAsStream(blockId, storageLevel,
ClassTag(message.getClass))
+ streamCallbackWithId.onData("0", ByteBuffer.wrap(ser))
+ streamCallbackWithId.onComplete("0")
+ val blockStatusOption = blockManager.getStatus(blockId)
+ assert(!blockStatusOption.isEmpty)
+ val blockStatus = blockStatusOption.get
+ assert((blockStatus.diskSize > 0) === !storageLevel.useMemory)
+ assert((blockStatus.memSize > 0) === storageLevel.useMemory)
+ assert(blockManager.getBlockData(blockId).nioByteBuffer().array() === ser)
+ }
+
+ Seq(
+ "caching" -> StorageLevel.MEMORY_ONLY,
+ "caching on disk" -> StorageLevel.DISK_ONLY,
+ "caching in memory, replicated" -> StorageLevel.MEMORY_ONLY_2,
+ "caching in memory, serialized, replicated" ->
StorageLevel.MEMORY_ONLY_SER_2,
+ "caching on disk, replicated" -> StorageLevel.DISK_ONLY_2,
+ "caching in memory and disk, replicated" -> StorageLevel.MEMORY_AND_DISK_2,
+ "caching in memory and disk, serialized, replicated" ->
StorageLevel.MEMORY_AND_DISK_SER_2
Review comment:
you've only setup one BlockManager here, so is there any point in running
the tests w/ replication? Replication will be covered by the tests in
DistributedSuite.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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]