Class BlockCommand


@Private @Evolving public class BlockCommand extends DatanodeCommand
A BlockCommand is an instruction to a datanode regarding some blocks under its control. It tells the DataNode to either invalidate a set of indicated blocks, or to copy a set of indicated blocks to another DataNode.
  • Field Details

    • NO_ACK

      public static final long NO_ACK
      This constant is used to indicate that the block deletion does not need explicit ACK from the datanode. When a block is put into the list of blocks to be deleted, it's size is set to this constant. We assume that no block would actually have this size. Otherwise, we would miss ACKs for blocks with such size. Positive number is used for compatibility reasons.
      See Also:
  • Constructor Details

    • BlockCommand

      public BlockCommand(int action, String poolId, List<DatanodeDescriptor.BlockTargetPair> blocktargetlist)
      Create BlockCommand for transferring blocks to another datanode
      Parameters:
      blocktargetlist - blocks to be transferred
    • BlockCommand

      public BlockCommand(int action, String poolId, org.apache.hadoop.hdfs.protocol.Block[] blocks)
      Create BlockCommand for the given action
      Parameters:
      blocks - blocks related to the action
    • BlockCommand

      public BlockCommand(int action, String poolId, org.apache.hadoop.hdfs.protocol.Block[] blocks, org.apache.hadoop.hdfs.protocol.DatanodeInfo[][] targets, org.apache.hadoop.fs.StorageType[][] targetStorageTypes, String[][] targetStorageIDs)
      Create BlockCommand for the given action
      Parameters:
      blocks - blocks related to the action
  • Method Details

    • getBlockPoolId

      public String getBlockPoolId()
    • getBlocks

      public org.apache.hadoop.hdfs.protocol.Block[] getBlocks()
    • getTargets

      public org.apache.hadoop.hdfs.protocol.DatanodeInfo[][] getTargets()
    • getTargetStorageTypes

      public org.apache.hadoop.fs.StorageType[][] getTargetStorageTypes()
    • getTargetStorageIDs

      public String[][] getTargetStorageIDs()