Class FinalizedReplica
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.FinalizedReplica
- All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>,Replica,org.apache.hadoop.io.Writable,org.apache.hadoop.util.LightWeightGSet.LinkedElement
This class describes a replica that has been finalized.
-
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
ConstructorsConstructorDescriptionFinalizedReplica(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir) Constructor.FinalizedReplica(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, byte[] checksum) Constructor.FinalizedReplica(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir) ConstructorFinalizedReplica(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, byte[] checksum) ConstructorCopy constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongGet the number of bytes that have written to diskbyte[]longlongGet the recovery id.getState()Get the replica statelongGet the number of bytes that are visible to readersinthashCode()voidvoidsetLastPartialChunkChecksum(byte[] checksum) voidsetRecoveryID(long recoveryId) Set the recovery id.toString()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, getMetadataOutputStream, getMetadataURI, getMetaFile, getPinning, getPinning, metadataExists, parseBaseDir, renameData, renameMeta, setPinning, setPinning, truncateBlock, truncateBlock, updateWithReplicaMethods 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, setBlockId, setGenerationStamp, setNumBytes, 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
-
FinalizedReplica
Constructor.- Parameters:
blockId- block idlen- replica lengthgenStamp- replica generation stampvol- volume where replica is locateddir- directory path where block and meta files are located
-
FinalizedReplica
public FinalizedReplica(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, byte[] checksum) Constructor.- Parameters:
blockId- block idlen- replica lengthgenStamp- replica generation stampvol- volume where replica is locateddir- directory path where block and meta files are locatedchecksum- the last partial chunk checksum
-
FinalizedReplica
Constructor- Parameters:
block- a blockvol- volume where replica is locateddir- directory path where block and meta files are located
-
FinalizedReplica
public FinalizedReplica(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, byte[] checksum) Constructor- Parameters:
block- a blockvol- volume where replica is locateddir- directory path where block and meta files are locatedchecksum- the last partial chunk checksum
-
FinalizedReplica
Copy constructor.- Parameters:
from- where to copy construct from
-
-
Method Details
-
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
-
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
-
getOriginalReplica
- Specified by:
getOriginalReplicain classReplicaInfo
-
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
-
createInfo
- Specified by:
createInfoin classReplicaInfo
-
getMetadataLength
public long getMetadataLength()- Overrides:
getMetadataLengthin classLocalReplica- Returns:
- the length of the metadata on storage.
-
getLastPartialChunkChecksum
public byte[] getLastPartialChunkChecksum() -
setLastPartialChunkChecksum
public void setLastPartialChunkChecksum(byte[] checksum) -
loadLastPartialChunkChecksum
- Throws:
IOException
-