java.lang.Comparable<org.apache.hadoop.hdfs.protocol.Block>, Replica, org.apache.hadoop.io.Writable, org.apache.hadoop.util.LightWeightGSet.LinkedElementFinalizedProvidedReplica@Private @Unstable public abstract class ProvidedReplica extends ReplicaInfo
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
ProvidedReplica(long blockId,
java.net.URI fileURI,
long fileOffset,
long blockLen,
long genStamp,
org.apache.hadoop.fs.PathHandle pathHandle,
FsVolumeSpi volume,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem remoteFS) |
Constructor.
|
ProvidedReplica(long blockId,
org.apache.hadoop.fs.Path pathPrefix,
java.lang.String pathSuffix,
long fileOffset,
long blockLen,
long genStamp,
org.apache.hadoop.fs.PathHandle pathHandle,
FsVolumeSpi volume,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem remoteFS) |
Constructor.
|
ProvidedReplica(ProvidedReplica r) |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
blockDataExists() |
|
boolean |
breakHardLinksIfNeeded() |
|
void |
bumpReplicaGS(long newGS) |
Bump a replica's generation stamp to a new one.
|
int |
compareWith(FsVolumeSpi.ScanInfo info) |
|
void |
copyBlockdata(java.net.URI destination) |
|
void |
copyMetadata(java.net.URI destination) |
|
ReplicaRecoveryInfo |
createInfo() |
|
boolean |
deleteBlockData() |
Used to deletes the replica's block data.
|
boolean |
deleteMetadata() |
Used to deletes the replica's metadata.
|
long |
getBlockDataLength() |
|
java.net.URI |
getBlockURI() |
Get the
URI for where the data of this replica is stored. |
java.io.InputStream |
getDataInputStream(long seekOffset) |
Returns an
InputStream to the replica's data. |
java.io.OutputStream |
getDataOutputStream(boolean append) |
Returns an
OutputStream to the replica's data. |
LengthInputStream |
getMetadataInputStream(long offset) |
Returns an
InputStream to the replica's metadata. |
long |
getMetadataLength() |
|
java.io.OutputStream |
getMetadataOutputStream(boolean append) |
Returns an
OutputStream to the replica's metadata. |
java.net.URI |
getMetadataURI() |
Get the
URI for where the metadata of this replica is stored. |
org.apache.hadoop.fs.Path |
getPathPrefix() |
|
java.lang.String |
getPathSuffix() |
|
boolean |
getPinning(org.apache.hadoop.fs.LocalFileSystem localFS) |
Check whether the block was pinned.
|
boolean |
metadataExists() |
|
boolean |
renameData(java.net.URI destURI) |
Rename the data
URI to that referenced by destURI. |
boolean |
renameMeta(java.net.URI destURI) |
Rename the metadata
URI to that referenced by destURI. |
void |
setPathHandle(org.apache.hadoop.fs.PathHandle pathHandle) |
|
void |
setPinning(org.apache.hadoop.fs.LocalFileSystem localFS) |
Set a block to be pinned on this datanode so that it cannot be moved
by Balancer/Mover.
|
void |
truncateBlock(long newLength) |
|
void |
updateWithReplica(StorageLocation replicaLocation) |
Update this replica with the
StorageLocation found. |
getBytesReserved, getFileIoProvider, getNext, getOriginalBytesReserved, getOriginalReplica, getRecoveryID, getStorageUuid, getVolume, isOnTransientStorage, setNext, setRecoveryID, toStringappendStringTo, compareTo, equals, filename2id, getBlockId, getBlockId, getBlockName, getGenerationStamp, getGenerationStamp, getNumBytes, hashCode, isBlockFilename, isMetaFilename, matchingIdAndGenStamp, metaToBlockFile, readFields, readId, set, setBlockId, setGenerationStamp, setNumBytes, toString, write, writeIdclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetBlockId, getBytesOnDisk, getGenerationStamp, getNumBytes, getState, getVisibleLengthpublic ProvidedReplica(long blockId,
java.net.URI fileURI,
long fileOffset,
long blockLen,
long genStamp,
org.apache.hadoop.fs.PathHandle pathHandle,
FsVolumeSpi volume,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem remoteFS)
blockId - block idfileURI - remote URI this block is to be read fromfileOffset - the offset in the remote URIblockLen - the length of the blockgenStamp - the generation stamp of the blockvolume - the volume this block belongs toconf - the configurationremoteFS - reference to the remote filesystem to use for this replica.public ProvidedReplica(long blockId,
org.apache.hadoop.fs.Path pathPrefix,
java.lang.String pathSuffix,
long fileOffset,
long blockLen,
long genStamp,
org.apache.hadoop.fs.PathHandle pathHandle,
FsVolumeSpi volume,
org.apache.hadoop.conf.Configuration conf,
org.apache.hadoop.fs.FileSystem remoteFS)
blockId - block idpathPrefix - A prefix of the Path associated with this replica
on the remote FileSystem.pathSuffix - A suffix of the Path associated with this replica
on the remote FileSystem. Resolving the pathSuffix
against the pathPrefix should provide the exact
Path of the data associated with this replica on the
remote FileSystem.fileOffset - the offset in the remote URIblockLen - the length of the blockgenStamp - the generation stamp of the blockvolume - the volume this block belongs toconf - the configurationremoteFS - reference to the remote filesystem to use for this replica.public ProvidedReplica(ProvidedReplica r)
public java.net.URI getBlockURI()
ReplicaInfoURI for where the data of this replica is stored.getBlockURI in class ReplicaInfoURI for the location of replica data.@VisibleForTesting public java.lang.String getPathSuffix()
@VisibleForTesting public org.apache.hadoop.fs.Path getPathPrefix()
public java.io.InputStream getDataInputStream(long seekOffset)
throws java.io.IOException
ReplicaInfoInputStream to the replica's data.getDataInputStream in class ReplicaInfoseekOffset - the offset at which the read is started from.InputStream to read the replica data.java.io.IOException - if an error occurs in opening a stream to the data.public java.io.OutputStream getDataOutputStream(boolean append)
throws java.io.IOException
ReplicaInfoOutputStream to the replica's data.getDataOutputStream in class ReplicaInfoappend - indicates if the block should be opened for append.OutputStream to write to the replica.java.io.IOException - if an error occurs in creating an OutputStream.public java.net.URI getMetadataURI()
ReplicaInfoURI for where the metadata of this replica is stored.getMetadataURI in class ReplicaInfoURI for the location of replica metadata.public java.io.OutputStream getMetadataOutputStream(boolean append)
throws java.io.IOException
ReplicaInfoOutputStream to the replica's metadata.getMetadataOutputStream in class ReplicaInfoappend - indicates if the block metadata should be opened for append.OutputStream to write to the replica's metadata.java.io.IOException - if an error occurs in creating an OutputStream.public boolean blockDataExists()
blockDataExists in class ReplicaInfopublic boolean deleteBlockData()
ReplicaInfodeleteBlockData in class ReplicaInfopublic long getBlockDataLength()
getBlockDataLength in class ReplicaInfopublic LengthInputStream getMetadataInputStream(long offset) throws java.io.IOException
ReplicaInfoInputStream to the replica's metadata.getMetadataInputStream in class ReplicaInfooffset - the offset at which the read is started from.LengthInputStream to read the replica metadata.java.io.IOExceptionpublic boolean metadataExists()
metadataExists in class ReplicaInfopublic boolean deleteMetadata()
ReplicaInfodeleteMetadata in class ReplicaInfopublic long getMetadataLength()
getMetadataLength in class ReplicaInfopublic boolean renameMeta(java.net.URI destURI)
throws java.io.IOException
ReplicaInfoURI to that referenced by destURI.renameMeta in class ReplicaInfodestURI - the target URI.java.io.IOException - if an exception occurs in the rename.public boolean renameData(java.net.URI destURI)
throws java.io.IOException
ReplicaInfoURI to that referenced by destURI.renameData in class ReplicaInfodestURI - the target URI.java.io.IOException - if an exception occurs in the rename.public boolean getPinning(org.apache.hadoop.fs.LocalFileSystem localFS)
throws java.io.IOException
ReplicaInfogetPinning in class ReplicaInfolocalFS - the local filesystem to use.java.io.IOExceptionpublic void setPinning(org.apache.hadoop.fs.LocalFileSystem localFS)
throws java.io.IOException
ReplicaInfosetPinning in class ReplicaInfolocalFS - the local filesystem to use.java.io.IOException - if there is an exception in the pinning.public void bumpReplicaGS(long newGS)
throws java.io.IOException
ReplicaInfobumpReplicaGS in class ReplicaInfonewGS - new generation stampjava.io.IOException - if the change failspublic boolean breakHardLinksIfNeeded()
throws java.io.IOException
breakHardLinksIfNeeded in class ReplicaInfojava.io.IOExceptionpublic ReplicaRecoveryInfo createInfo() throws java.lang.UnsupportedOperationException
createInfo in class ReplicaInfojava.lang.UnsupportedOperationExceptionpublic int compareWith(FsVolumeSpi.ScanInfo info)
compareWith in class ReplicaInfopublic void truncateBlock(long newLength)
throws java.io.IOException
truncateBlock in class ReplicaInfojava.io.IOExceptionpublic void updateWithReplica(StorageLocation replicaLocation)
ReplicaInfoStorageLocation found.updateWithReplica in class ReplicaInforeplicaLocation - the StorageLocation found for this replica.public void copyMetadata(java.net.URI destination)
throws java.io.IOException
copyMetadata in class ReplicaInfojava.io.IOExceptionpublic void copyBlockdata(java.net.URI destination)
throws java.io.IOException
copyBlockdata in class ReplicaInfojava.io.IOException@VisibleForTesting public void setPathHandle(org.apache.hadoop.fs.PathHandle pathHandle)
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.