DataTransferProtocol@Private @Evolving public class Sender extends java.lang.Object implements DataTransferProtocol
DATA_TRANSFER_VERSION, LOG| Constructor | Description |
|---|---|
Sender(java.io.DataOutputStream out) |
Create a sender for DataTransferProtocol with a output stream.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
blockChecksum(ExtendedBlock blk,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
BlockChecksumOptions blockChecksumOptions) |
Get block checksum (MD5 of CRC32).
|
void |
blockGroupChecksum(StripedBlockInfo stripedBlockInfo,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
long requestedNumBytes,
BlockChecksumOptions blockChecksumOptions) |
Get striped block group checksum (MD5 of CRC32).
|
void |
copyBlock(ExtendedBlock blk,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken) |
Copy a block.
|
void |
readBlock(ExtendedBlock blk,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
java.lang.String clientName,
long blockOffset,
long length,
boolean sendChecksum,
CachingStrategy cachingStrategy) |
Read a block.
|
void |
releaseShortCircuitFds(ShortCircuitShm.SlotId slotId) |
Release a pair of short-circuit FDs requested earlier.
|
void |
replaceBlock(ExtendedBlock blk,
org.apache.hadoop.fs.StorageType storageType,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
java.lang.String delHint,
DatanodeInfo source,
java.lang.String storageId) |
Receive a block from a source datanode
and then notifies the namenode
to remove the copy from the original datanode.
|
void |
requestShortCircuitFds(ExtendedBlock blk,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
ShortCircuitShm.SlotId slotId,
int maxVersion,
boolean supportsReceiptVerification) |
Request short circuit access file descriptors from a DataNode.
|
void |
requestShortCircuitShm(java.lang.String clientName) |
Request a short circuit shared memory area from a DataNode.
|
void |
transferBlock(ExtendedBlock blk,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
java.lang.String clientName,
DatanodeInfo[] targets,
org.apache.hadoop.fs.StorageType[] targetStorageTypes,
java.lang.String[] targetStorageIds) |
Transfer a block to another datanode.
|
void |
writeBlock(ExtendedBlock blk,
org.apache.hadoop.fs.StorageType storageType,
org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken,
java.lang.String clientName,
DatanodeInfo[] targets,
org.apache.hadoop.fs.StorageType[] targetStorageTypes,
DatanodeInfo source,
BlockConstructionStage stage,
int pipelineSize,
long minBytesRcvd,
long maxBytesRcvd,
long latestGenerationStamp,
org.apache.hadoop.util.DataChecksum requestedChecksum,
CachingStrategy cachingStrategy,
boolean allowLazyPersist,
boolean pinning,
boolean[] targetPinnings,
java.lang.String storageId,
java.lang.String[] targetStorageIds) |
Write a block to a datanode pipeline.
|
public Sender(java.io.DataOutputStream out)
public void readBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, java.lang.String clientName, long blockOffset, long length, boolean sendChecksum, CachingStrategy cachingStrategy) throws java.io.IOException
DataTransferProtocolreadBlock in interface DataTransferProtocolblk - the block being read.blockToken - security token for accessing the block.clientName - client's name.blockOffset - offset of the block.length - maximum number of bytes for this read.sendChecksum - if false, the DN should skip reading and sending
checksumscachingStrategy - The caching strategy to use.java.io.IOExceptionpublic void writeBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, java.lang.String clientName, DatanodeInfo[] targets, org.apache.hadoop.fs.StorageType[] targetStorageTypes, DatanodeInfo source, BlockConstructionStage stage, int pipelineSize, long minBytesRcvd, long maxBytesRcvd, long latestGenerationStamp, org.apache.hadoop.util.DataChecksum requestedChecksum, CachingStrategy cachingStrategy, boolean allowLazyPersist, boolean pinning, boolean[] targetPinnings, java.lang.String storageId, java.lang.String[] targetStorageIds) throws java.io.IOException
DataTransferProtocolDatanodeInfo is not required in the
parameter list since the receiver datanode knows its info. However, the
StorageType for storing the replica in the receiver datanode is a
parameter since the receiver datanode may support multiple storage types.writeBlock in interface DataTransferProtocolblk - the block being written.storageType - for storing the replica in the receiver datanode.blockToken - security token for accessing the block.clientName - client's name.targets - other downstream datanodes in the pipeline.targetStorageTypes - target StorageTypes corresponding
to the target datanodes.source - source datanode.stage - pipeline stage.pipelineSize - the size of the pipeline.minBytesRcvd - minimum number of bytes received.maxBytesRcvd - maximum number of bytes received.latestGenerationStamp - the latest generation stamp of the block.requestedChecksum - the requested checksum mechanismcachingStrategy - the caching strategyallowLazyPersist - hint to the DataNode that the block can be
allocated on transient storage i.e. memory and
written to disk lazilypinning - whether to pin the block, so Balancer won't move it.targetPinnings - whether to pin the block on target datanodestorageId - optional StorageIDs designating where to write the
block. An empty String or null indicates that this
has not been provided.targetStorageIds - target StorageIDs corresponding to the target
datanodes.java.io.IOExceptionpublic void transferBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, java.lang.String clientName, DatanodeInfo[] targets, org.apache.hadoop.fs.StorageType[] targetStorageTypes, java.lang.String[] targetStorageIds) throws java.io.IOException
DataTransferProtocolBlockConstructionStage.TRANSFER_RBW
or BlockConstructionStage.TRANSFER_FINALIZED.transferBlock in interface DataTransferProtocolblk - the block being transferred.blockToken - security token for accessing the block.clientName - client's name.targets - target datanodes.targetStorageIds - StorageID designating where to write the
block.java.io.IOExceptionpublic void requestShortCircuitFds(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, ShortCircuitShm.SlotId slotId, int maxVersion, boolean supportsReceiptVerification) throws java.io.IOException
DataTransferProtocolrequestShortCircuitFds in interface DataTransferProtocolblk - The block to get file descriptors for.blockToken - Security token for accessing the block.slotId - The shared memory slot id to use, or null
to use no slot id.maxVersion - Maximum version of the block data the client
can understand.supportsReceiptVerification - True if the client supports
receipt verification.java.io.IOExceptionpublic void releaseShortCircuitFds(ShortCircuitShm.SlotId slotId) throws java.io.IOException
DataTransferProtocolreleaseShortCircuitFds in interface DataTransferProtocolslotId - SlotID used by the earlier file descriptors.java.io.IOExceptionpublic void requestShortCircuitShm(java.lang.String clientName)
throws java.io.IOException
DataTransferProtocolrequestShortCircuitShm in interface DataTransferProtocolclientName - The name of the client.java.io.IOExceptionpublic void replaceBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, java.lang.String delHint, DatanodeInfo source, java.lang.String storageId) throws java.io.IOException
DataTransferProtocolreplaceBlock in interface DataTransferProtocolblk - the block being replaced.storageType - the StorageType for storing the block.blockToken - security token for accessing the block.delHint - the hint for deleting the block in the original datanode.source - the source datanode for receiving the block.storageId - an optional storage ID to designate where the block is
replaced to.java.io.IOExceptionpublic void copyBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken) throws java.io.IOException
DataTransferProtocolcopyBlock in interface DataTransferProtocolblk - the block being copied.blockToken - security token for accessing the block.java.io.IOExceptionpublic void blockChecksum(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, BlockChecksumOptions blockChecksumOptions) throws java.io.IOException
DataTransferProtocolblockChecksum in interface DataTransferProtocolblk - a block.blockToken - security token for accessing the block.blockChecksumOptions - determines how the block-level checksum is
computed from underlying block metadata.java.io.IOExceptionpublic void blockGroupChecksum(StripedBlockInfo stripedBlockInfo, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, long requestedNumBytes, BlockChecksumOptions blockChecksumOptions) throws java.io.IOException
DataTransferProtocolblockGroupChecksum in interface DataTransferProtocolstripedBlockInfo - a striped block info.blockToken - security token for accessing the block.requestedNumBytes - requested number of bytes in the block group
to compute the checksum.blockChecksumOptions - determines how the block-level checksum is
computed from underlying block metadata.java.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.