Class BlockUnderConstructionFeature

java.lang.Object
org.apache.hadoop.hdfs.server.blockmanagement.BlockUnderConstructionFeature

public class BlockUnderConstructionFeature extends Object
Represents the under construction feature of a Block. This is usually the last block of a file opened for write or append.
  • Constructor Details

  • Method Details

    • setExpectedLocations

      public void setExpectedLocations(org.apache.hadoop.hdfs.protocol.Block block, DatanodeStorageInfo[] targets, org.apache.hadoop.hdfs.protocol.BlockType blockType)
      Set expected locations
    • getExpectedStorageLocations

      public DatanodeStorageInfo[] getExpectedStorageLocations()
      Create array of expected replica locations (as has been assigned by chooseTargets()).
    • getExpectedStorageLocationsIterator

      public Iterator<DatanodeStorageInfo> getExpectedStorageLocationsIterator()
      Note that this iterator doesn't guarantee thread-safe. It depends on external mechanisms such as the FSNamesystem lock for protection.
    • getBlockIndices

      public byte[] getBlockIndices()
      Returns:
      the index array indicating the block index in each storage. Used only by striped blocks.
    • getBlockIndicesForSpecifiedStorages

      public byte[] getBlockIndicesForSpecifiedStorages(List<Integer> storageIdx)
    • getNumExpectedLocations

      public int getNumExpectedLocations()
    • getBlockUCState

      public HdfsServerConstants.BlockUCState getBlockUCState()
      Return the state of the block under construction.
      See Also:
    • getBlockRecoveryId

      public long getBlockRecoveryId()
    • getTruncateBlock

      public BlockInfo getTruncateBlock()
      Get recover block
    • setTruncateBlock

      public void setTruncateBlock(BlockInfo recoveryBlock)
    • initializeBlockRecovery

      public void initializeBlockRecovery(BlockInfo blockInfo, long recoveryId, boolean startRecovery)
      Initialize lease recovery for this block. Find the first alive data-node starting from the previous primary and make it primary.
      Parameters:
      blockInfo - Block to be recovered
      recoveryId - Recovery ID (new gen stamp)
      startRecovery - Issue recovery command to datanode if true.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appendUCPartsConcise

      public void appendUCPartsConcise(StringBuilder sb)