Class BlockInfoStriped

java.lang.Object
org.apache.hadoop.hdfs.protocol.Block
org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
org.apache.hadoop.hdfs.server.blockmanagement.BlockInfoStriped
All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>, org.apache.hadoop.io.Writable, org.apache.hadoop.util.LightWeightGSet.LinkedElement

@Private public class BlockInfoStriped extends BlockInfo
Subclass of BlockInfo, presenting a block group in erasure coding. We still use triplets to store DatanodeStorageInfo for each block in the block group, as well as the previous/next block in the corresponding DatanodeStorageInfo. For a (m+k) block group, the first (m+k) triplet units are sorted and strictly mapped to the corresponding block. Normally each block belonging to group is stored in only one DataNode. However, it is possible that some block is over-replicated. Thus the triplet array's size can be larger than (m+k). Thus currently we use an extra byte array to record the block index for each triplet.
  • Constructor Details

    • BlockInfoStriped

      public BlockInfoStriped(org.apache.hadoop.hdfs.protocol.Block blk, org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy ecPolicy)
  • Method Details

    • getTotalBlockNum

      public short getTotalBlockNum()
    • getDataBlockNum

      public short getDataBlockNum()
    • getParityBlockNum

      public short getParityBlockNum()
    • getCellSize

      public int getCellSize()
    • getRealDataBlockNum

      public short getRealDataBlockNum()
      If the block is committed/completed and its length is less than a full stripe, it returns the the number of actual data blocks. Otherwise it returns the number of data units specified by erasure coding policy.
    • getRealTotalBlockNum

      public short getRealTotalBlockNum()
    • getErasureCodingPolicy

      public org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy getErasureCodingPolicy()
    • getStorageBlockIndex

      @VisibleForTesting public byte getStorageBlockIndex(DatanodeStorageInfo storage)
    • spaceConsumed

      public long spaceConsumed()
    • isStriped

      public final boolean isStriped()
      Specified by:
      isStriped in class BlockInfo
    • getBlockType

      public org.apache.hadoop.hdfs.protocol.BlockType getBlockType()
      Specified by:
      getBlockType in class BlockInfo
    • numNodes

      public int numNodes()
      Description copied from class: BlockInfo
      Count the number of data-nodes the block currently belongs to (i.e., NN has received block reports from the DN).
      Specified by:
      numNodes in class BlockInfo
    • getStorageAndIndexInfos

      public Iterable<BlockInfoStriped.StorageAndBlockIndex> getStorageAndIndexInfos()