public class LocalReplicaInPipeline extends LocalReplica implements ReplicaInPipeline
LocalReplica.ReplicaDirInfo| Constructor and Description |
|---|
LocalReplicaInPipeline(LocalReplicaInPipeline from)
Copy constructor.
|
LocalReplicaInPipeline(long blockId,
long genStamp,
FsVolumeSpi vol,
File dir,
long bytesToReserve)
Constructor for a zero length replica.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
attemptToSetWriter(Thread prevWriter,
Thread newWriter)
Attempt to set the writer to a new value.
|
org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo |
createInfo() |
OutputStream |
createRestartMetaStream()
Create an output stream to write restart metadata in case of datanode
shutting down for quick restart.
|
ReplicaOutputStreams |
createStreams(boolean isCreate,
org.apache.hadoop.util.DataChecksum requestedChecksum)
Create output streams for writing to this replica,
one for block file and one for CRC file
|
boolean |
equals(Object o) |
long |
getBytesAcked()
Get the number of bytes acked
|
long |
getBytesOnDisk()
Get the number of bytes that have written to disk
|
long |
getBytesReserved()
Number of bytes reserved for this replica on disk.
|
ChunkChecksum |
getLastChecksumAndDataLen()
gets the last chunk checksum and the length of the block corresponding
to that checksum
|
long |
getOriginalBytesReserved()
Number of bytes originally reserved for this replica.
|
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo |
getOriginalReplica() |
long |
getRecoveryID()
Get the recovery id.
|
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo |
getReplicaInfo() |
HdfsServerConstants.ReplicaState |
getState()
Get the replica state
|
long |
getVisibleLength()
Get the number of bytes that are visible to readers
|
int |
hashCode() |
void |
interruptThread() |
void |
moveReplicaFrom(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo oldReplicaInfo,
File newBlkFile) |
void |
releaseAllBytesReserved()
Release any disk space reserved for this replica.
|
void |
releaseReplicaInfoBytesReserved()
Release the reserved space from the ReplicaInfo.
|
void |
setBytesAcked(long bytesAcked)
Set the number bytes that have acked
|
void |
setLastChecksumAndDataLen(long dataLength,
byte[] checksum)
store the checksum for the last chunk along with the data length
|
void |
setRecoveryID(long recoveryId)
Set the recovery id.
|
void |
setWriter(Thread writer)
Set the thread that is writing to this replica
|
void |
stopWriter(long xceiverStopTimeout)
Interrupt the writing thread and wait until it dies.
|
String |
toString() |
void |
waitForMinLength(long minLength,
long time,
TimeUnit unit)
Causes the current thread to wait until a minimum length is reached, the
thread is interrupted, or the specified waiting time elapses.
|
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, updateWithReplicagetFileIoProvider, getNext, getStorageUuid, getVolume, isOnTransientStorage, setNextappendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, metaToBlockFile, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, toString, write, writeIdclone, finalize, getClass, notify, notifyAll, wait, wait, waitsetNumBytespublic LocalReplicaInPipeline(long blockId,
long genStamp,
FsVolumeSpi vol,
File dir,
long bytesToReserve)
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.public LocalReplicaInPipeline(LocalReplicaInPipeline from)
from - where to copy frompublic long getVisibleLength()
org.apache.hadoop.hdfs.server.datanode.ReplicagetVisibleLength in interface org.apache.hadoop.hdfs.server.datanode.Replicapublic HdfsServerConstants.ReplicaState getState()
org.apache.hadoop.hdfs.server.datanode.ReplicagetState in interface org.apache.hadoop.hdfs.server.datanode.Replicapublic long getBytesAcked()
ReplicaInPipelinegetBytesAcked in interface ReplicaInPipelinepublic void setBytesAcked(long bytesAcked)
ReplicaInPipelinesetBytesAcked in interface ReplicaInPipelinebytesAcked - number bytes ackedpublic long getBytesOnDisk()
org.apache.hadoop.hdfs.server.datanode.ReplicagetBytesOnDisk in interface org.apache.hadoop.hdfs.server.datanode.Replicapublic long getBytesReserved()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfogetBytesReserved in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic long getOriginalBytesReserved()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfogetOriginalBytesReserved in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic void releaseAllBytesReserved()
ReplicaInPipelinereleaseAllBytesReserved in interface ReplicaInPipelinepublic void releaseReplicaInfoBytesReserved()
ReplicaInPipelinereleaseReplicaInfoBytesReserved in interface ReplicaInPipelinepublic void setLastChecksumAndDataLen(long dataLength,
byte[] checksum)
ReplicaInPipelinesetLastChecksumAndDataLen in interface ReplicaInPipelinedataLength - number of bytes on diskchecksum - - checksum bytes for the last chunkpublic ChunkChecksum getLastChecksumAndDataLen()
ReplicaInPipelinegetLastChecksumAndDataLen in interface ReplicaInPipelinepublic void waitForMinLength(long minLength,
long time,
TimeUnit unit)
throws IOException
ReplicaInPipelinewaitForMinLength in interface ReplicaInPipelineminLength - The minimum length to achievetime - the maximum time to waitunit - the time unit of the time argumentIOException - if the current thread is interrupted or the minimum
length is not achieved within the time allowed.public void setWriter(Thread writer)
ReplicaInPipelinesetWriter in interface ReplicaInPipelinewriter - a thread writing to this replicapublic void interruptThread()
interruptThread in interface ReplicaInPipelinepublic boolean equals(Object o)
equals in class org.apache.hadoop.hdfs.protocol.Blockpublic boolean attemptToSetWriter(Thread prevWriter, Thread newWriter)
attemptToSetWriter in interface ReplicaInPipelinepublic void stopWriter(long xceiverStopTimeout)
throws IOException
stopWriter in interface ReplicaInPipelineIOException - the waiting is interruptedpublic int hashCode()
hashCode in class org.apache.hadoop.hdfs.protocol.Blockpublic ReplicaOutputStreams createStreams(boolean isCreate, org.apache.hadoop.util.DataChecksum requestedChecksum) throws IOException
ReplicaInPipelinecreateStreams in interface ReplicaInPipelineisCreate - if it is for creationrequestedChecksum - the checksum the writer would prefer to useIOException - if any error occurspublic OutputStream createRestartMetaStream() throws IOException
ReplicaInPipelinecreateRestartMetaStream in interface ReplicaInPipelineIOException - if any error occurspublic String toString()
toString in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getOriginalReplica()
getOriginalReplica in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic long getRecoveryID()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfogetRecoveryID in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic void setRecoveryID(long recoveryId)
org.apache.hadoop.hdfs.server.datanode.ReplicaInfosetRecoveryID in class org.apache.hadoop.hdfs.server.datanode.ReplicaInforecoveryId - the new recoveryIdpublic org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo createInfo()
createInfo in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfopublic void moveReplicaFrom(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo oldReplicaInfo,
File newBlkFile)
throws IOException
IOExceptionpublic org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getReplicaInfo()
getReplicaInfo in interface ReplicaInPipelineCopyright © 2008–2024 Apache Software Foundation. All rights reserved.