Class ReplicaUnderRecovery
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.ReplicaUnderRecovery
- All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>,Replica,org.apache.hadoop.io.Writable,org.apache.hadoop.util.LightWeightGSet.LinkedElement
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.LocalReplica
LocalReplica.ReplicaDirInfo -
Field Summary
Fields inherited from class org.apache.hadoop.hdfs.protocol.Block
BLOCK_FILE_PREFIX, blockFilePattern, METADATA_EXTENSION, metaFilePattern, metaOrBlockFilePattern -
Constructor Summary
ConstructorsConstructorDescriptionReplicaUnderRecovery(ReplicaInfo replica, long recoveryId) Copy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongGet the number of bytes that have written to diskGet the original replica that's under recoverylongGet the recovery id.getState()Get the replica statelongGet the number of bytes that are visible to readersinthashCode()voidsetBlockId(long blockId) voidsetGenerationStamp(long gs) voidsetNumBytes(long numBytes) voidsetRecoveryID(long recoveryId) Set the recovery id.toString()voidupdateWithReplica(StorageLocation replicaLocation) Update this replica with theStorageLocationfound.Methods inherited from class org.apache.hadoop.hdfs.server.datanode.LocalReplica
blockDataExists, breakHardLinksIfNeeded, bumpReplicaGS, compareWith, copyBlockdata, copyMetadata, deleteBlockData, deleteMetadata, fsyncDirectory, getBlockDataLength, getBlockFile, getBlockURI, getDataInputStream, getDataOutputStream, getDir, getMetadataInputStream, getMetadataLength, getMetadataOutputStream, getMetadataURI, getMetaFile, getPinning, getPinning, metadataExists, parseBaseDir, renameData, renameMeta, setPinning, setPinning, truncateBlock, truncateBlockMethods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getBytesReserved, getFileIoProvider, getNext, getOriginalBytesReserved, getStorageUuid, getVolume, isOnTransientStorage, setNextMethods inherited from class org.apache.hadoop.hdfs.protocol.Block
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, metaToBlockFile, readFields, readId, set, toString, write, writeIdMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.hadoop.hdfs.server.datanode.Replica
getBlockId, getGenerationStamp, getNumBytes
-
Constructor Details
-
ReplicaUnderRecovery
-
ReplicaUnderRecovery
Copy constructor.- Parameters:
from- where to copy from
-
-
Method Details
-
getRecoveryID
public long getRecoveryID()Description copied from class:ReplicaInfoGet the recovery id.- Specified by:
getRecoveryIDin classReplicaInfo- Returns:
- the generation stamp that the replica will be bumped to
-
setRecoveryID
public void setRecoveryID(long recoveryId) Description copied from class:ReplicaInfoSet the recovery id.- Specified by:
setRecoveryIDin classReplicaInfo- Parameters:
recoveryId- the new recoveryId
-
getOriginalReplica
Get the original replica that's under recovery- Specified by:
getOriginalReplicain classReplicaInfo- Returns:
- the original replica under recovery
-
getState
Description copied from interface:ReplicaGet the replica state- Returns:
- the replica state
-
getVisibleLength
public long getVisibleLength()Description copied from interface:ReplicaGet 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:ReplicaGet 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:
setBlockIdin classorg.apache.hadoop.hdfs.protocol.Block
-
setGenerationStamp
public void setGenerationStamp(long gs) - Overrides:
setGenerationStampin classorg.apache.hadoop.hdfs.protocol.Block
-
setNumBytes
public void setNumBytes(long numBytes) - Overrides:
setNumBytesin classorg.apache.hadoop.hdfs.protocol.Block
-
updateWithReplica
Description copied from class:ReplicaInfoUpdate this replica with theStorageLocationfound.- Overrides:
updateWithReplicain classLocalReplica- Parameters:
replicaLocation- theStorageLocationfound for this replica.
-
equals
- Overrides:
equalsin classorg.apache.hadoop.hdfs.protocol.Block
-
hashCode
public int hashCode()- Overrides:
hashCodein classorg.apache.hadoop.hdfs.protocol.Block
-
toString
- Overrides:
toStringin classReplicaInfo
-
createInfo
- Specified by:
createInfoin classReplicaInfo
-