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 |
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() |
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, updateWithReplica
getFileIoProvider, getNext, getStorageUuid, getVolume, isOnTransientStorage, setNext
appendStringTo, compareTo, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, metaToBlockFile, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, toString, write, writeId
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
setNumBytes
public 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.Replica
getVisibleLength
in interface org.apache.hadoop.hdfs.server.datanode.Replica
public HdfsServerConstants.ReplicaState getState()
org.apache.hadoop.hdfs.server.datanode.Replica
getState
in interface org.apache.hadoop.hdfs.server.datanode.Replica
public long getBytesAcked()
ReplicaInPipeline
getBytesAcked
in interface ReplicaInPipeline
public void setBytesAcked(long bytesAcked)
ReplicaInPipeline
setBytesAcked
in interface ReplicaInPipeline
bytesAcked
- number bytes ackedpublic long getBytesOnDisk()
org.apache.hadoop.hdfs.server.datanode.Replica
getBytesOnDisk
in interface org.apache.hadoop.hdfs.server.datanode.Replica
public long getBytesReserved()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getBytesReserved
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public long getOriginalBytesReserved()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getOriginalBytesReserved
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public void releaseAllBytesReserved()
ReplicaInPipeline
releaseAllBytesReserved
in interface ReplicaInPipeline
public void setLastChecksumAndDataLen(long dataLength, byte[] checksum)
ReplicaInPipeline
setLastChecksumAndDataLen
in interface ReplicaInPipeline
dataLength
- number of bytes on diskchecksum
- - checksum bytes for the last chunkpublic ChunkChecksum getLastChecksumAndDataLen()
ReplicaInPipeline
getLastChecksumAndDataLen
in interface ReplicaInPipeline
public void setWriter(Thread writer)
ReplicaInPipeline
setWriter
in interface ReplicaInPipeline
writer
- a thread writing to this replicapublic void interruptThread()
interruptThread
in interface ReplicaInPipeline
public boolean equals(Object o)
equals
in class org.apache.hadoop.hdfs.protocol.Block
public boolean attemptToSetWriter(Thread prevWriter, Thread newWriter)
attemptToSetWriter
in interface ReplicaInPipeline
public void stopWriter(long xceiverStopTimeout) throws IOException
stopWriter
in interface ReplicaInPipeline
IOException
- the waiting is interruptedpublic int hashCode()
hashCode
in class org.apache.hadoop.hdfs.protocol.Block
public ReplicaOutputStreams createStreams(boolean isCreate, org.apache.hadoop.util.DataChecksum requestedChecksum) throws IOException
ReplicaInPipeline
createStreams
in interface ReplicaInPipeline
isCreate
- if it is for creationrequestedChecksum
- the checksum the writer would prefer to useIOException
- if any error occurspublic OutputStream createRestartMetaStream() throws IOException
ReplicaInPipeline
createRestartMetaStream
in interface ReplicaInPipeline
IOException
- if any error occurspublic String toString()
toString
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getOriginalReplica()
getOriginalReplica
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public long getRecoveryID()
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
getRecoveryID
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public void setRecoveryID(long recoveryId)
org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
setRecoveryID
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
recoveryId
- the new recoveryIdpublic org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo createInfo()
createInfo
in class org.apache.hadoop.hdfs.server.datanode.ReplicaInfo
public void moveReplicaFrom(org.apache.hadoop.hdfs.server.datanode.ReplicaInfo oldReplicaInfo, File newBlkFile) throws IOException
IOException
public org.apache.hadoop.hdfs.server.datanode.ReplicaInfo getReplicaInfo()
getReplicaInfo
in interface ReplicaInPipeline
Copyright © 2008–2018 Apache Software Foundation. All rights reserved.