@InterfaceAudience.Private public interface FsDatasetSpi<V extends FsVolumeSpi> extends FSDatasetMBean
Modifier and Type | Interface and Description |
---|---|
static class |
FsDatasetSpi.Factory<D extends FsDatasetSpi<?>>
A factory for creating
FsDatasetSpi objects. |
Modifier and Type | Method and Description |
---|---|
void |
addBlockPool(String bpid,
Configuration conf)
add new block pool ID
|
void |
adjustCrcChannelPosition(ExtendedBlock b,
ReplicaOutputStreams outs,
int checksumSize)
Sets the file pointer of the checksum stream so that the last checksum
will be overwritten
|
ReplicaInPipelineInterface |
append(ExtendedBlock b,
long newGS,
long expectedBlockLen)
Append to a finalized replica and returns the meta info of the replica
|
void |
checkAndUpdate(String bpid,
long blockId,
File diskFile,
File diskMetaFile,
FsVolumeSpi vol)
Check whether the in-memory block record matches the block on the disk,
and, in case that they are not matched, update the record or mark it
as corrupted.
|
void |
checkDataDir()
Check if all the data directories are healthy
|
boolean |
contains(ExtendedBlock block)
Does the dataset contain the block?
|
ReplicaInPipelineInterface |
convertTemporaryToRbw(ExtendedBlock temporary)
Covert a temporary replica to a RBW.
|
ReplicaInPipelineInterface |
createRbw(ExtendedBlock b)
Creates a RBW replica and returns the meta info of the replica
|
RollingLogs |
createRollingLogs(String bpid,
String prefix)
Create rolling logs.
|
ReplicaInPipelineInterface |
createTemporary(ExtendedBlock b)
Creates a temporary replica and returns the meta information of the replica
|
void |
deleteBlockPool(String bpid,
boolean force)
Deletes the block pool directories.
|
void |
finalizeBlock(ExtendedBlock b)
Finalizes the block previously opened for writing using writeToBlock.
|
InputStream |
getBlockInputStream(ExtendedBlock b,
long seekOffset)
Returns an input stream at specified offset of the specified block
|
BlockLocalPathInfo |
getBlockLocalPathInfo(ExtendedBlock b)
Get
BlockLocalPathInfo for the given block. |
String[] |
getBlockPoolList() |
BlockListAsLongs |
getBlockReport(String bpid)
Returns the block report - the full list of blocks stored under a
block pool
|
List<Block> |
getFinalizedBlocks(String bpid) |
HdfsBlocksMetadata |
getHdfsBlocksMetadata(List<ExtendedBlock> blocks)
Get a
HdfsBlocksMetadata corresponding to the list of blocks in
blocks . |
long |
getLength(ExtendedBlock b)
Returns the specified block's on-disk length (excluding metadata)
|
LengthInputStream |
getMetaDataInputStream(ExtendedBlock b) |
Replica |
getReplica(String bpid,
long blockId)
Deprecated.
|
String |
getReplicaString(String bpid,
long blockId) |
long |
getReplicaVisibleLength(ExtendedBlock block)
Get visible length of the specified replica.
|
Block |
getStoredBlock(String bpid,
long blkid) |
ReplicaInputStreams |
getTmpInputStreams(ExtendedBlock b,
long blkoff,
long ckoff)
Returns an input stream at specified offset of the specified block
The block is still in the tmp directory and is not finalized
|
V |
getVolume(ExtendedBlock b) |
Map<String,Object> |
getVolumeInfoMap() |
List<V> |
getVolumes() |
boolean |
hasEnoughResource()
Checks how many valid storage volumes there are in the DataNode.
|
ReplicaRecoveryInfo |
initReplicaRecovery(BlockRecoveryCommand.RecoveringBlock rBlock)
Initialize a replica recovery.
|
void |
invalidate(String bpid,
Block[] invalidBlks)
Invalidates the specified blocks
|
boolean |
isValidBlock(ExtendedBlock b)
Is the block valid?
|
boolean |
isValidRbw(ExtendedBlock b)
Is the block a valid RBW?
|
ReplicaInPipelineInterface |
recoverAppend(ExtendedBlock b,
long newGS,
long expectedBlockLen)
Recover a failed append to a finalized replica
and returns the meta info of the replica
|
void |
recoverClose(ExtendedBlock b,
long newGS,
long expectedBlockLen)
Recover a failed pipeline close
It bumps the replica's generation stamp and finalize it if RBW replica
|
ReplicaInPipelineInterface |
recoverRbw(ExtendedBlock b,
long newGS,
long minBytesRcvd,
long maxBytesRcvd)
Recovers a RBW replica and returns the meta info of the replica
|
void |
shutdown()
Shutdown the FSDataset
|
void |
shutdownBlockPool(String bpid)
Shutdown and remove the block pool from underlying storage.
|
void |
unfinalizeBlock(ExtendedBlock b)
Unfinalizes the block previously opened for writing using writeToBlock.
|
String |
updateReplicaUnderRecovery(ExtendedBlock oldBlock,
long recoveryId,
long newLength)
Update replica's generation stamp and length and finalize it.
|
getBlockPoolUsed, getCapacity, getDfsUsed, getNumFailedVolumes, getRemaining, getStorageInfo
RollingLogs createRollingLogs(String bpid, String prefix) throws IOException
prefix
- the prefix of the log names.IOException
V getVolume(ExtendedBlock b)
Map<String,Object> getVolumeInfoMap()
String[] getBlockPoolList()
List<Block> getFinalizedBlocks(String bpid)
void checkAndUpdate(String bpid, long blockId, File diskFile, File diskMetaFile, FsVolumeSpi vol)
LengthInputStream getMetaDataInputStream(ExtendedBlock b) throws IOException
b
- - the blockIOException
long getLength(ExtendedBlock b) throws IOException
b
- IOException
@Deprecated Replica getReplica(String bpid, long blockId)
FSDataset
blockId
- String getReplicaString(String bpid, long blockId)
Block getStoredBlock(String bpid, long blkid) throws IOException
IOException
InputStream getBlockInputStream(ExtendedBlock b, long seekOffset) throws IOException
b
- seekOffset
- IOException
ReplicaInputStreams getTmpInputStreams(ExtendedBlock b, long blkoff, long ckoff) throws IOException
b
- blkoff
- ckoff
- IOException
ReplicaInPipelineInterface createTemporary(ExtendedBlock b) throws IOException
b
- blockIOException
- if an error occursReplicaInPipelineInterface createRbw(ExtendedBlock b) throws IOException
b
- blockIOException
- if an error occursReplicaInPipelineInterface recoverRbw(ExtendedBlock b, long newGS, long minBytesRcvd, long maxBytesRcvd) throws IOException
b
- blocknewGS
- the new generation stamp for the replicaminBytesRcvd
- the minimum number of bytes that the replica could havemaxBytesRcvd
- the maximum number of bytes that the replica could haveIOException
- if an error occursReplicaInPipelineInterface convertTemporaryToRbw(ExtendedBlock temporary) throws IOException
temporary
- the temporary replica being convertedIOException
ReplicaInPipelineInterface append(ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException
b
- blocknewGS
- the new generation stamp for the replicaexpectedBlockLen
- the number of bytes the replica is expected to haveIOException
ReplicaInPipelineInterface recoverAppend(ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException
b
- blocknewGS
- the new generation stamp for the replicaexpectedBlockLen
- the number of bytes the replica is expected to haveIOException
void recoverClose(ExtendedBlock b, long newGS, long expectedBlockLen) throws IOException
b
- blocknewGS
- the new generation stamp for the replicaexpectedBlockLen
- the number of bytes the replica is expected to haveIOException
void finalizeBlock(ExtendedBlock b) throws IOException
b
- IOException
void unfinalizeBlock(ExtendedBlock b) throws IOException
b
- IOException
BlockListAsLongs getBlockReport(String bpid)
bpid
- Block Pool Idboolean contains(ExtendedBlock block)
boolean isValidBlock(ExtendedBlock b)
b
- boolean isValidRbw(ExtendedBlock b)
b
- void invalidate(String bpid, Block[] invalidBlks) throws IOException
bpid
- Block pool IdinvalidBlks
- - the blocks to be invalidatedIOException
void checkDataDir() throws DiskChecker.DiskErrorException
DiskChecker.DiskErrorException
void shutdown()
void adjustCrcChannelPosition(ExtendedBlock b, ReplicaOutputStreams outs, int checksumSize) throws IOException
b
- blockouts
- The streams for the data file and checksum filechecksumSize
- number of bytes each checksum hasIOException
boolean hasEnoughResource()
long getReplicaVisibleLength(ExtendedBlock block) throws IOException
IOException
ReplicaRecoveryInfo initReplicaRecovery(BlockRecoveryCommand.RecoveringBlock rBlock) throws IOException
IOException
String updateReplicaUnderRecovery(ExtendedBlock oldBlock, long recoveryId, long newLength) throws IOException
IOException
void addBlockPool(String bpid, Configuration conf) throws IOException
bpid
- Block pool Idconf
- ConfigurationIOException
void shutdownBlockPool(String bpid)
bpid
- Block pool Id to be removedvoid deleteBlockPool(String bpid, boolean force) throws IOException
bpid
- BlockPool Id to be deleted.force
- If force is false, directories are deleted only if no
block files exist for the block pool, otherwise entire
directory for the blockpool is deleted along with its contents.IOException
BlockLocalPathInfo getBlockLocalPathInfo(ExtendedBlock b) throws IOException
BlockLocalPathInfo
for the given block.IOException
HdfsBlocksMetadata getHdfsBlocksMetadata(List<ExtendedBlock> blocks) throws IOException
HdfsBlocksMetadata
corresponding to the list of blocks in
blocks
.blocks
- List of blocks for which to return metadataIOException
Copyright © 2013 Apache Software Foundation. All rights reserved.