Class ReplicaUnderRecovery

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

public class ReplicaUnderRecovery extends LocalReplica
This class represents replicas that are under block recovery It has a recovery id that is equal to the generation stamp that the replica will be bumped to after recovery The recovery id is used to handle multiple concurrent block recoveries. A recovery with higher recovery id preempts recoveries with a lower id.
  • Constructor Details

    • ReplicaUnderRecovery

      public ReplicaUnderRecovery(ReplicaInfo replica, long recoveryId)
    • ReplicaUnderRecovery

      public ReplicaUnderRecovery(ReplicaUnderRecovery from)
      Copy constructor.
      Parameters:
      from - where to copy from
  • Method Details

    • getRecoveryID

      public long getRecoveryID()
      Description copied from class: ReplicaInfo
      Get the recovery id.
      Specified by:
      getRecoveryID in class ReplicaInfo
      Returns:
      the generation stamp that the replica will be bumped to
    • setRecoveryID

      public void setRecoveryID(long recoveryId)
      Description copied from class: ReplicaInfo
      Set the recovery id.
      Specified by:
      setRecoveryID in class ReplicaInfo
      Parameters:
      recoveryId - the new recoveryId
    • getOriginalReplica

      public ReplicaInfo getOriginalReplica()
      Get the original replica that's under recovery
      Specified by:
      getOriginalReplica in class ReplicaInfo
      Returns:
      the original replica under recovery
    • getState

      Description copied from interface: Replica
      Get the replica state
      Returns:
      the replica state
    • getVisibleLength

      public long getVisibleLength()
      Description copied from interface: Replica
      Get the number of bytes that are visible to readers
      Returns:
      the number of bytes that are visible to readers
    • getBytesOnDisk

      public long getBytesOnDisk()
      Description copied from interface: Replica
      Get the number of bytes that have written to disk
      Returns:
      the number of bytes that have written to disk
    • setBlockId

      public void setBlockId(long blockId)
      Overrides:
      setBlockId in class org.apache.hadoop.hdfs.protocol.Block
    • setGenerationStamp

      public void setGenerationStamp(long gs)
      Overrides:
      setGenerationStamp in class org.apache.hadoop.hdfs.protocol.Block
    • setNumBytes

      public void setNumBytes(long numBytes)
      Overrides:
      setNumBytes in class org.apache.hadoop.hdfs.protocol.Block
    • updateWithReplica

      public void updateWithReplica(StorageLocation replicaLocation)
      Description copied from class: ReplicaInfo
      Update this replica with the StorageLocation found.
      Overrides:
      updateWithReplica in class LocalReplica
      Parameters:
      replicaLocation - the StorageLocation found for this replica.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class org.apache.hadoop.hdfs.protocol.Block
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.apache.hadoop.hdfs.protocol.Block
    • toString

      public String toString()
      Overrides:
      toString in class ReplicaInfo
    • createInfo

      public ReplicaRecoveryInfo createInfo()
      Specified by:
      createInfo in class ReplicaInfo