Class ReplicaWaitingToBeRecovered

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

public class ReplicaWaitingToBeRecovered extends LocalReplica
This class represents a replica that is waiting to be recovered. After a datanode restart, any replica in "rbw" directory is loaded as a replica waiting to be recovered. A replica waiting to be recovered does not provision read nor participates in any pipeline recovery. It will become outdated if its client continues to write or be recovered as a result of lease recovery.
  • Constructor Details

    • ReplicaWaitingToBeRecovered

      public ReplicaWaitingToBeRecovered(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir)
      Constructor
      Parameters:
      blockId - block id
      len - replica length
      genStamp - replica generation stamp
      vol - volume where replica is located
      dir - directory path where block and meta files are located
    • ReplicaWaitingToBeRecovered

      public ReplicaWaitingToBeRecovered(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir)
      Constructor
      Parameters:
      block - a block
      vol - volume where replica is located
      dir - directory path where block and meta files are located
    • ReplicaWaitingToBeRecovered

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

    • 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
    • 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
    • getOriginalReplica

      public ReplicaInfo getOriginalReplica()
      Specified by:
      getOriginalReplica in class ReplicaInfo
    • 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
    • createInfo

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