【HDFS】DataTransferProtocol#transferBlock

DataTransferProtocol协议里定义的transferBlock方法主要作用就是用来传入一个block到另一个datanode上。
其使用场景基本上就是客户端写pipeline时,如果遇到datanode失败,做pipeline恢复,如果满足向pipeline里补充新datanode的条件,
则要把数据传输到这个新datanode上。

  /**
   * Transfer a block to another datanode.
   * The block stage must be
   * either {@link BlockConstructionStage#TRANSFER_RBW}
   * or {@link BlockConstructionStage#TRANSFER_FINALIZED}.
   *
   * @param blk the block being transferred.
   * @param blockToken security token for accessing the block.
   * @param clientName client's name.
   * @param targets target datanodes.
   * @param targetStorageIDs StorageID designating where to write the
   *                     block.
   */
  void transferBlock(final 

你可能感兴趣的:(HDFS全方位实战,hdfs,hadoop,大数据)