init(blockDataManager: BlockDataManager): Unit
BlockTransferService — Pluggable Block Transfers
BlockTransferService is a contract for ShuffleClients that can fetch and upload blocks synchronously or asynchronously.
|
Note
|
BlockTransferService is a private[spark] abstract class.
|
|
Note
|
NettyBlockTransferService is the only available implementation of BlockTransferService Contract. |
|
Note
|
BlockTransferService was introduced in SPARK-3019 Pluggable block transfer interface (BlockTransferService) and is available since Spark 1.2.0.
|
BlockTransferService Contract
Every BlockTransferService offers the following:
-
initthat accepts BlockDataManager for storing or fetching blocks. It is assumed that the method is called before aBlockTransferServiceservice is considered fully operational. -
portthe service listens to.port: Int -
hostNamethe service listens to.hostName: String
-
uploadBlockto upload a block (ofManagedBufferidentified byBlockId) to a remotehostnameandport.uploadBlock( hostname: String, port: Int, execId: String, blockId: BlockId, blockData: ManagedBuffer, level: StorageLevel, classTag: ClassTag[_]): Future[Unit]
-
Synchronous (and hence blocking)
fetchBlockSyncto fetch one blockblockId(that corresponds to the ShuffleClient parent’s asynchronous fetchBlocks).fetchBlockSync( host: String, port: Int, execId: String, blockId: String): ManagedBufferfetchBlockSyncis a mere wrapper around fetchBlocks to fetch oneblockIdblock that waits until the fetch finishes.
uploadBlockSync Method
uploadBlockSync(
hostname: String,
port: Int,
execId: String,
blockId: BlockId,
blockData: ManagedBuffer,
level: StorageLevel,
classTag: ClassTag[_]): Unit
uploadBlockSync is a mere blocking wrapper around uploadBlock that waits until the upload finishes.
|
Note
|
uploadBlockSync is only executed when BlockManager replicates a block to another node(s) (i.e. when a replication level is greater than 1).
|