org.apache.hadoop.hdfs.server.datanode
Class ReplicaUnderRecovery

java.lang.Object
  extended by org.apache.hadoop.hdfs.protocol.Block
      extended by org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
          extended by org.apache.hadoop.hdfs.server.datanode.ReplicaUnderRecovery
All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>, org.apache.hadoop.hdfs.server.datanode.Replica, org.apache.hadoop.io.Writable

public class ReplicaUnderRecovery
extends org.apache.hadoop.hdfs.server.datanode.ReplicaInfo

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.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
ReplicaInfo.ReplicaDirInfo
 
Field Summary
 
Fields inherited from class org.apache.hadoop.hdfs.protocol.Block
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern
 
Constructor Summary
ReplicaUnderRecovery(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo replica, long recoveryId)
           
ReplicaUnderRecovery(ReplicaUnderRecovery from)
          Copy constructor.
 
Method Summary
 org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo createInfo()
           
 boolean equals(Object o)
           
 long getBytesOnDisk()
          Get the number of bytes that have written to disk
 org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getOriginalReplica()
          Get the original replica that's under recovery
 long getRecoveryID()
          Get the recovery id
 HdfsServerConstants.ReplicaState getState()
          Get the replica state
 long getVisibleLength()
          Get the number of bytes that are visible to readers
 int hashCode()
           
 boolean isUnlinked()
          check if this replica has already been unlinked.
 void setBlockId(long blockId)
           
 void setDir(File dir)
          Set the parent directory where this replica is located
 void setGenerationStamp(long gs)
           
 void setNumBytes(long numBytes)
           
 void setRecoveryID(long recoveryId)
          Set the recovery id
 void setUnlinked()
          set that this replica is unlinked
 String toString()
           
 
Methods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getBlockFile, getMetaFile, getVolume, parseSubDirs, unlinkBlock
 
Methods inherited from class org.apache.hadoop.hdfs.protocol.Block
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, readFields, readId, set, write, writeId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.hdfs.server.datanode.Replica
getBlockId, getGenerationStamp, getNumBytes
 

Constructor Detail

ReplicaUnderRecovery

public ReplicaUnderRecovery(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo replica,
                            long recoveryId)

ReplicaUnderRecovery

public ReplicaUnderRecovery(ReplicaUnderRecovery from)
Copy constructor.

Parameters:
from -
Method Detail

getRecoveryID

public long getRecoveryID()
Get the recovery id

Returns:
the generation stamp that the replica will be bumped to

setRecoveryID

public void setRecoveryID(long recoveryId)
Set the recovery id

Parameters:
recoveryId - the new recoveryId

getOriginalReplica

public org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getOriginalReplica()
Get the original replica that's under recovery

Returns:
the original replica under recovery

isUnlinked

public boolean isUnlinked()
Description copied from class: org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
check if this replica has already been unlinked.

Overrides:
isUnlinked in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
Returns:
true if the replica has already been unlinked or no need to be detached; false otherwise

setUnlinked

public void setUnlinked()
Description copied from class: org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
set that this replica is unlinked

Overrides:
setUnlinked in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo

getState

public HdfsServerConstants.ReplicaState getState()
Description copied from interface: org.apache.hadoop.hdfs.server.datanode.Replica
Get the replica state

Returns:
the replica state

getVisibleLength

public long getVisibleLength()
Description copied from interface: org.apache.hadoop.hdfs.server.datanode.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: org.apache.hadoop.hdfs.server.datanode.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

setDir

public void setDir(File dir)
Description copied from class: org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
Set the parent directory where this replica is located

Overrides:
setDir in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
Parameters:
dir - the parent directory where the replica is located

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 org.apache.hadoop.hdfs.server.datanode.ReplicaInfo

createInfo

public org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo createInfo()


Copyright © 2013 Apache Software Foundation. All Rights Reserved.