Class ReplicaBeingWritten
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.LocalReplicaInPipeline
org.apache.hadoop.hdfs.server.datanode.ReplicaBeingWritten
- All Implemented Interfaces:
Comparable<org.apache.hadoop.hdfs.protocol.Block>,Replica,ReplicaInPipeline,org.apache.hadoop.io.Writable,org.apache.hadoop.util.LightWeightGSet.LinkedElement
This class represents replicas being written.
Those are the replicas that
are created in a pipeline initiated by a dfs client.
-
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
ConstructorsConstructorDescriptionReplicaBeingWritten(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, Thread writer, long bytesToReserve) Constructor.ReplicaBeingWritten(long blockId, long genStamp, FsVolumeSpi vol, File dir, long bytesToReserve) Constructor for a zero length replica.ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, Thread writer) Constructor.Copy constructor. -
Method Summary
Methods inherited from class org.apache.hadoop.hdfs.server.datanode.LocalReplicaInPipeline
attemptToSetWriter, createInfo, createRestartMetaStream, createStreams, getBytesAcked, getBytesOnDisk, getBytesReserved, getLastChecksumAndDataLen, getOriginalBytesReserved, getOriginalReplica, getRecoveryID, getReplicaInfo, interruptThread, moveReplicaFrom, releaseAllBytesReserved, releaseReplicaInfoBytesReserved, setBytesAcked, setLastChecksumAndDataLen, setRecoveryID, setWriter, stopWriter, toString, waitForMinLengthMethods 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, truncateBlock, updateWithReplicaMethods inherited from class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getFileIoProvider, getNext, 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, getStorageUuid, getVolume, isOnTransientStorageMethods inherited from interface org.apache.hadoop.hdfs.server.datanode.ReplicaInPipeline
setNumBytes
-
Constructor Details
-
ReplicaBeingWritten
public ReplicaBeingWritten(long blockId, long genStamp, FsVolumeSpi vol, File dir, long bytesToReserve) Constructor for a zero length replica.- Parameters:
blockId- block idgenStamp- replica generation stampvol- volume where replica is locateddir- directory path where block and meta files are locatedbytesToReserve- disk space to reserve for this replica, based on the estimated maximum block length.
-
ReplicaBeingWritten
public ReplicaBeingWritten(org.apache.hadoop.hdfs.protocol.Block block, FsVolumeSpi vol, File dir, Thread writer) Constructor.- Parameters:
block- a blockvol- volume where replica is locateddir- directory path where block and meta files are locatedwriter- a thread that is writing to this replica
-
ReplicaBeingWritten
public ReplicaBeingWritten(long blockId, long len, long genStamp, FsVolumeSpi vol, File dir, Thread writer, long bytesToReserve) Constructor.- Parameters:
blockId- block idlen- replica lengthgenStamp- replica generation stampvol- volume where replica is locateddir- directory path where block and meta files are locatedwriter- a thread that is writing to this replicabytesToReserve- disk space to reserve for this replica, based on the estimated maximum block length.
-
ReplicaBeingWritten
Copy constructor.- Parameters:
from- where to copy from
-
-
Method Details
-
getVisibleLength
public long getVisibleLength()Description copied from interface:ReplicaGet the number of bytes that are visible to readers- Specified by:
getVisibleLengthin interfaceReplica- Overrides:
getVisibleLengthin classLocalReplicaInPipeline- Returns:
- the number of bytes that are visible to readers
-
getState
Description copied from interface:ReplicaGet the replica state- Specified by:
getStatein interfaceReplica- Overrides:
getStatein classLocalReplicaInPipeline- Returns:
- the replica state
-
equals
- Overrides:
equalsin classLocalReplicaInPipeline
-
hashCode
public int hashCode()- Overrides:
hashCodein classLocalReplicaInPipeline
-