Class Sender
java.lang.Object
org.apache.hadoop.hdfs.protocol.datatransfer.Sender
- All Implemented Interfaces:
DataTransferProtocol
Sender
-
Field Summary
Fields inherited from interface org.apache.hadoop.hdfs.protocol.datatransfer.DataTransferProtocol
DATA_TRANSFER_VERSION -
Constructor Summary
ConstructorsConstructorDescriptionSender(DataOutputStream out) Create a sender for DataTransferProtocol with a output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidblockChecksum(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, BlockChecksumOptions blockChecksumOptions) Get block checksum (MD5 of CRC32).voidblockGroupChecksum(StripedBlockInfo stripedBlockInfo, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, long requestedNumBytes, BlockChecksumOptions blockChecksumOptions) Get striped block group checksum (MD5 of CRC32).voidcopyBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken) Copy a block.voidreadBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String clientName, long blockOffset, long length, boolean sendChecksum, CachingStrategy cachingStrategy) Read a block.voidRelease a pair of short-circuit FDs requested earlier.voidreplaceBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String delHint, DatanodeInfo source, String storageId) Receive a block from a source datanode and then notifies the namenode to remove the copy from the original datanode.voidrequestShortCircuitFds(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.voidrequestShortCircuitShm(String clientName) Request a short circuit shared memory area from a DataNode.voidtransferBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String clientName, DatanodeInfo[] targets, org.apache.hadoop.fs.StorageType[] targetStorageTypes, String[] targetStorageIds) Transfer a block to another datanode.voidwriteBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, 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, String storageId, String[] targetStorageIds) Write a block to a datanode pipeline.
-
Constructor Details
-
Sender
Create a sender for DataTransferProtocol with a output stream.
-
-
Method Details
-
readBlock
public void readBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String clientName, long blockOffset, long length, boolean sendChecksum, CachingStrategy cachingStrategy) throws IOException Description copied from interface:DataTransferProtocolRead a block.- Specified by:
readBlockin interfaceDataTransferProtocol- Parameters:
blk- 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.- Throws:
IOException
-
writeBlock
public void writeBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, 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, String storageId, String[] targetStorageIds) throws IOException Description copied from interface:DataTransferProtocolWrite a block to a datanode pipeline. The receiver datanode of this call is the next datanode in the pipeline. The other downstream datanodes are specified by the targets parameter. Note that the receiverDatanodeInfois not required in the parameter list since the receiver datanode knows its info. However, theStorageTypefor storing the replica in the receiver datanode is a parameter since the receiver datanode may support multiple storage types.- Specified by:
writeBlockin interfaceDataTransferProtocol- Parameters:
blk- 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- targetStorageTypes 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.- Throws:
IOException
-
transferBlock
public void transferBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String clientName, DatanodeInfo[] targets, org.apache.hadoop.fs.StorageType[] targetStorageTypes, String[] targetStorageIds) throws IOException Description copied from interface:DataTransferProtocolTransfer a block to another datanode. The block stage must be eitherBlockConstructionStage.TRANSFER_RBWorBlockConstructionStage.TRANSFER_FINALIZED.- Specified by:
transferBlockin interfaceDataTransferProtocol- Parameters:
blk- 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.- Throws:
IOException
-
requestShortCircuitFds
public void requestShortCircuitFds(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, ShortCircuitShm.SlotId slotId, int maxVersion, boolean supportsReceiptVerification) throws IOException Description copied from interface:DataTransferProtocolRequest short circuit access file descriptors from a DataNode.- Specified by:
requestShortCircuitFdsin interfaceDataTransferProtocol- Parameters:
blk- 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.- Throws:
IOException
-
releaseShortCircuitFds
Description copied from interface:DataTransferProtocolRelease a pair of short-circuit FDs requested earlier.- Specified by:
releaseShortCircuitFdsin interfaceDataTransferProtocol- Parameters:
slotId- SlotID used by the earlier file descriptors.- Throws:
IOException
-
requestShortCircuitShm
Description copied from interface:DataTransferProtocolRequest a short circuit shared memory area from a DataNode.- Specified by:
requestShortCircuitShmin interfaceDataTransferProtocol- Parameters:
clientName- The name of the client.- Throws:
IOException
-
replaceBlock
public void replaceBlock(ExtendedBlock blk, org.apache.hadoop.fs.StorageType storageType, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, String delHint, DatanodeInfo source, String storageId) throws IOException Description copied from interface:DataTransferProtocolReceive a block from a source datanode and then notifies the namenode to remove the copy from the original datanode. Note that the source datanode and the original datanode can be different. It is used for balancing purpose.- Specified by:
replaceBlockin interfaceDataTransferProtocol- Parameters:
blk- the block being replaced.storageType- theStorageTypefor 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.- Throws:
IOException
-
copyBlock
public void copyBlock(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken) throws IOException Description copied from interface:DataTransferProtocolCopy a block. It is used for balancing purpose.- Specified by:
copyBlockin interfaceDataTransferProtocol- Parameters:
blk- the block being copied.blockToken- security token for accessing the block.- Throws:
IOException
-
blockChecksum
public void blockChecksum(ExtendedBlock blk, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, BlockChecksumOptions blockChecksumOptions) throws IOException Description copied from interface:DataTransferProtocolGet block checksum (MD5 of CRC32).- Specified by:
blockChecksumin interfaceDataTransferProtocol- Parameters:
blk- a block.blockToken- security token for accessing the block.blockChecksumOptions- determines how the block-level checksum is computed from underlying block metadata.- Throws:
IOException
-
blockGroupChecksum
public void blockGroupChecksum(StripedBlockInfo stripedBlockInfo, org.apache.hadoop.security.token.Token<BlockTokenIdentifier> blockToken, long requestedNumBytes, BlockChecksumOptions blockChecksumOptions) throws IOException Description copied from interface:DataTransferProtocolGet striped block group checksum (MD5 of CRC32).- Specified by:
blockGroupChecksumin interfaceDataTransferProtocol- Parameters:
stripedBlockInfo- 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.- Throws:
IOException
-