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
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class contains datanode storage information and block index in the block group. -
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
EMPTY_ARRAY, tripletsFields inherited from class org.apache.hadoop.hdfs.protocol.Block
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern, metaOrBlockFilePattern -
Constructor Summary
ConstructorsConstructorDescriptionBlockInfoStriped(org.apache.hadoop.hdfs.protocol.Block blk, org.apache.hadoop.hdfs.protocol.ErasureCodingPolicy ecPolicy) -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.hdfs.protocol.BlockTypeintshortorg.apache.hadoop.hdfs.protocol.ErasureCodingPolicyshortshortIf the block is committed/completed and its length is less than a full stripe, it returns the the number of actual data blocks.shortbytegetStorageBlockIndex(DatanodeStorageInfo storage) shortfinal booleanintnumNodes()Count the number of data-nodes the block currently belongs to (i.e., NN has received block reports from the DN).longMethods inherited from class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
convertToBlockUnderConstruction, delete, equals, getBlockCollectionId, getBlockUCState, getCapacity, getDatanode, getNext, getReplication, getStorageInfos, getUnderConstructionFeature, hashCode, isComplete, isCompleteOrCommitted, isDeleted, isUnderRecovery, moveBlockToHead, setBlockCollectionId, setGenerationStampAndVerifyReplicas, setNext, setReplicationMethods inherited from class org.apache.hadoop.hdfs.protocol.Block
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, metaToBlockFile, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, toString, toString, write, writeId
-
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
-
spaceConsumed
public long spaceConsumed() -
isStriped
public final boolean isStriped() -
getBlockType
public org.apache.hadoop.hdfs.protocol.BlockType getBlockType()- Specified by:
getBlockTypein classBlockInfo
-
numNodes
public int numNodes()Description copied from class:BlockInfoCount the number of data-nodes the block currently belongs to (i.e., NN has received block reports from the DN). -
getStorageAndIndexInfos
-