org.apache.hadoop.hdfs.server.blockmanagement
Class BlockInfoUnderConstruction

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

public class BlockInfoUnderConstruction
extends org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo

Represents a block that is currently being constructed.
This is usually the last block of a file opened for write or append.


Field Summary
 
Fields inherited from class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
EMPTY_ARRAY
 
Fields inherited from class org.apache.hadoop.hdfs.protocol.Block
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern
 
Constructor Summary
BlockInfoUnderConstruction(org.apache.hadoop.hdfs.protocol.Block blk, int replication)
          Create block and set its state to HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION.
BlockInfoUnderConstruction(org.apache.hadoop.hdfs.protocol.Block blk, int replication, HdfsServerConstants.BlockUCState state, org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] targets)
          Create a block that is currently being constructed.
 
Method Summary
 void appendStringTo(StringBuilder sb)
           
 boolean equals(Object obj)
           
 long getBlockRecoveryId()
          Get block recovery ID
 HdfsServerConstants.BlockUCState getBlockUCState()
          Return the state of the block under construction.
 org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] getExpectedLocations()
          Create array of expected replica locations (as has been assigned by chooseTargets()).
 int getNumExpectedLocations()
          Get the number of expected locations
 int hashCode()
           
 void initializeBlockRecovery(long recoveryId)
          Initialize lease recovery for this block.
 void setExpectedLocations(org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] targets)
          Set expected locations
 String toString()
           
 
Methods inherited from class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
addNode, convertToBlockUnderConstruction, getBlockCollection, getNext, isComplete, listInsert, listRemove, moveBlockToHead, numNodes, removeNode, setBlockCollection, setNext
 
Methods inherited from class org.apache.hadoop.hdfs.protocol.Block
compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, write, writeId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlockInfoUnderConstruction

public BlockInfoUnderConstruction(org.apache.hadoop.hdfs.protocol.Block blk,
                                  int replication)
Create block and set its state to HdfsServerConstants.BlockUCState.UNDER_CONSTRUCTION.


BlockInfoUnderConstruction

public BlockInfoUnderConstruction(org.apache.hadoop.hdfs.protocol.Block blk,
                                  int replication,
                                  HdfsServerConstants.BlockUCState state,
                                  org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] targets)
Create a block that is currently being constructed.

Method Detail

setExpectedLocations

public void setExpectedLocations(org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] targets)
Set expected locations


getExpectedLocations

public org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor[] getExpectedLocations()
Create array of expected replica locations (as has been assigned by chooseTargets()).


getNumExpectedLocations

public int getNumExpectedLocations()
Get the number of expected locations


getBlockUCState

public HdfsServerConstants.BlockUCState getBlockUCState()
Return the state of the block under construction.

Overrides:
getBlockUCState in class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo
Returns:
HdfsServerConstants.BlockUCState.COMPLETE
See Also:
HdfsServerConstants.BlockUCState

getBlockRecoveryId

public long getBlockRecoveryId()
Get block recovery ID


initializeBlockRecovery

public void initializeBlockRecovery(long recoveryId)
Initialize lease recovery for this block. Find the first alive data-node starting from the previous primary and make it primary.


hashCode

public int hashCode()
Overrides:
hashCode in class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo

equals

public boolean equals(Object obj)
Overrides:
equals in class org.apache.hadoop.hdfs.server.blockmanagement.BlockInfo

toString

public String toString()
Overrides:
toString in class org.apache.hadoop.hdfs.protocol.Block

appendStringTo

public void appendStringTo(StringBuilder sb)
Overrides:
appendStringTo in class org.apache.hadoop.hdfs.protocol.Block


Copyright © 2013 Apache Software Foundation. All Rights Reserved.