public interface BlockWorker extends Worker, SessionCleanable
Modifier and Type | Method and Description |
---|---|
void |
abortBlock(long sessionId,
long blockId)
Aborts the temporary block created by the session.
|
void |
accessBlock(long sessionId,
long blockId)
Access the block for a given session.
|
void |
clearMetrics()
Clears the worker metrics.
|
void |
closeUfsBlock(long sessionId,
long blockId)
Closes a UFS block for a client session.
|
void |
commitBlock(long sessionId,
long blockId,
boolean pinOnCreate)
Commits a block to Alluxio managed space.
|
void |
commitBlockInUfs(long blockId,
long length)
Commits a block in UFS.
|
String |
createBlock(long sessionId,
long blockId,
String tierAlias,
String medium,
long initialBytes)
Creates a block in Alluxio managed space for short-circuit writes.
|
void |
createBlockRemote(long sessionId,
long blockId,
String tierAlias,
String medium,
long initialBytes)
Creates a block for non short-circuit writes or caching requests.
|
void |
freeSpace(long sessionId,
long availableBytes,
String tierAlias)
Deprecated.
to be removed at Alluxio 3.0
Frees space to make a specific amount of bytes available in a best-effort way in the tier. The
implementation should try to free at least 1 byte from the worker, otherwise a
WorkerOutOfSpaceException should be thrown if no space is available. |
BlockMeta |
getBlockMeta(long sessionId,
long blockId,
long lockId)
Gets the metadata of a specific block from local storage.
|
BlockStore |
getBlockStore() |
FileInfo |
getFileInfo(long fileId)
Gets the file information.
|
BlockHeartbeatReport |
getReport()
Gets a report for the periodic heartbeat to master.
|
BlockStoreMeta |
getStoreMeta()
Gets the metadata for the entire block store.
|
BlockStoreMeta |
getStoreMetaFull()
Similar as
getStoreMeta() except that this also contains full blockId
list. |
BlockWriter |
getTempBlockWriterRemote(long sessionId,
long blockId)
Opens a
BlockWriter for an existing temporary block for non short-circuit writes or
cache requests. |
BlockMeta |
getVolatileBlockMeta(long blockId)
Gets the metadata of a block given its blockId or throws IOException.
|
AtomicReference<Long> |
getWorkerId() |
boolean |
hasBlockMeta(long blockId)
Checks if the storage has a given block.
|
long |
lockBlock(long sessionId,
long blockId)
Obtains a read lock the block.
|
long |
lockBlockNoException(long sessionId,
long blockId)
Obtains a read lock the block without throwing an exception.
|
void |
moveBlock(long sessionId,
long blockId,
String tierAlias)
Moves a block from its current location to a target location, currently only tier level moves
are supported.
|
void |
moveBlockToMedium(long sessionId,
long blockId,
String mediumType)
Moves a block from its current location to a target location, with a specific medium type.
|
boolean |
openUfsBlock(long sessionId,
long blockId,
Protocol.OpenUfsBlockOptions options)
Opens a UFS block.
|
String |
readBlock(long sessionId,
long blockId,
long lockId)
Gets the path to the block file in local storage.
|
BlockReader |
readBlockRemote(long sessionId,
long blockId,
long lockId)
Gets the block reader for the block for non short-circuit reads.
|
BlockReader |
readUfsBlock(long sessionId,
long blockId,
long offset,
boolean positionShort)
Gets a block reader to read a UFS block for non short-circuit reads.
|
void |
removeBlock(long sessionId,
long blockId)
Frees a block from Alluxio managed space.
|
void |
requestSpace(long sessionId,
long blockId,
long additionalBytes)
Request an amount of space for a block in its storage directory.
|
void |
sessionHeartbeat(long sessionId)
Handles the heartbeat from a client.
|
void |
unlockBlock(long lockId)
Releases the lock with the specified lock id.
|
boolean |
unlockBlock(long sessionId,
long blockId)
Releases the lock with the specified session and block id.
|
void |
updatePinList(Set<Long> pinnedInodes)
Sets the pinlist for the underlying block store.
|
close, getDependencies, getName, getServices, start, stop
cleanupSession
BlockStore getBlockStore()
AtomicReference<Long> getWorkerId()
void abortBlock(long sessionId, long blockId) throws BlockAlreadyExistsException, BlockDoesNotExistException, InvalidWorkerStateException, IOException
sessionId
- the id of the clientblockId
- the id of the block to be abortedBlockAlreadyExistsException
- if blockId already exists in committed blocksBlockDoesNotExistException
- if the temporary block cannot be foundInvalidWorkerStateException
- if blockId does not belong to sessionIdIOException
void accessBlock(long sessionId, long blockId) throws BlockDoesNotExistException
sessionId
- the id of the clientblockId
- the id of the block to accessBlockDoesNotExistException
- this exception is not thrown in the tiered block store
implementationvoid commitBlock(long sessionId, long blockId, boolean pinOnCreate) throws BlockAlreadyExistsException, BlockDoesNotExistException, InvalidWorkerStateException, IOException, WorkerOutOfSpaceException
BlockStore.commitBlock(long, long, boolean)
. The block will not be accessible
until BlockMasterClient.commitBlock(long, long, String, String, long, long)
succeeds.sessionId
- the id of the clientblockId
- the id of the block to commitpinOnCreate
- whether to pin block on createBlockAlreadyExistsException
- if blockId already exists in committed blocksBlockDoesNotExistException
- if the temporary block cannot be foundInvalidWorkerStateException
- if blockId does not belong to sessionIdWorkerOutOfSpaceException
- if there is no more space left to hold the blockIOException
void commitBlockInUfs(long blockId, long length) throws IOException
blockId
- the id of the block to commitlength
- length of the block to commitIOException
String createBlock(long sessionId, long blockId, String tierAlias, String medium, long initialBytes) throws BlockAlreadyExistsException, WorkerOutOfSpaceException, IOException
IllegalArgumentException
if the location does not belong to tiered storage.sessionId
- the id of the clientblockId
- the id of the block to createtierAlias
- the alias of the tier to place the new block in,
BlockStoreLocation.ANY_TIER
for any tiermedium
- the name of the medium to place the new block ininitialBytes
- the initial amount of bytes to be allocatedBlockAlreadyExistsException
- if blockId already exists, either temporary or committed,
or block in eviction plan already existsWorkerOutOfSpaceException
- if this Store has no more space than the initialBlockSizeIOException
void createBlockRemote(long sessionId, long blockId, String tierAlias, String medium, long initialBytes) throws BlockAlreadyExistsException, WorkerOutOfSpaceException, IOException
getTempBlockWriterRemote(long, long)
to get a writer for writing to the
block. Throws an IllegalArgumentException
if the location does not belong to tiered
storage.sessionId
- the id of the clientblockId
- the id of the block to be createdtierAlias
- the alias of the tier to place the new block inmedium
- the name of the medium to place the new block ininitialBytes
- the initial amount of bytes to be allocatedBlockAlreadyExistsException
- if blockId already exists, either temporary or committed,
or block in eviction plan already existsWorkerOutOfSpaceException
- if this Store has no more space than the initialBlockSizeIOException
@Deprecated void freeSpace(long sessionId, long availableBytes, String tierAlias) throws WorkerOutOfSpaceException, BlockDoesNotExistException, IOException, BlockAlreadyExistsException, InvalidWorkerStateException
WorkerOutOfSpaceException
should be thrown if no space is available.sessionId
- the session idavailableBytes
- the amount of free space in bytestierAlias
- the alias of the tier to free spaceWorkerOutOfSpaceException
- if there is not enough spaceBlockDoesNotExistException
- if blocks can not be foundBlockAlreadyExistsException
- if blocks to move already exists in destination locationInvalidWorkerStateException
- if blocks to move/evict is uncommittedIOException
BlockWriter getTempBlockWriterRemote(long sessionId, long blockId) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, IOException
BlockWriter
for an existing temporary block for non short-circuit writes or
cache requests. The temporary block must already exist with
createBlockRemote(long, long, String, String, long)
.sessionId
- the id of the clientblockId
- the id of the block to be opened for writingBlockDoesNotExistException
- if the block cannot be foundBlockAlreadyExistsException
- if a committed block with the same ID existsInvalidWorkerStateException
- if the worker state is invalidIOException
BlockHeartbeatReport getReport()
BlockStoreMeta getStoreMeta()
BlockStoreMeta getStoreMetaFull()
getStoreMeta()
except that this also contains full blockId
list. This function is expensive.BlockMeta getVolatileBlockMeta(long blockId) throws BlockDoesNotExistException
blockId
- the block idBlockDoesNotExistException
- if no BlockMeta
for this blockId is foundBlockMeta getBlockMeta(long sessionId, long blockId, long lockId) throws BlockDoesNotExistException, InvalidWorkerStateException
Unlike getVolatileBlockMeta(long)
, this method requires the lock id returned by a
previously acquired lockBlock(long, long)
.
sessionId
- the id of the session to get this fileblockId
- the id of the blocklockId
- the id of the lockBlockDoesNotExistException
- if the block id can not be found in committed blocks or
lockId can not be foundInvalidWorkerStateException
- if session id or block id is not the same as that in the
LockRecord of lockIdboolean hasBlockMeta(long blockId)
blockId
- the block idlong lockBlock(long sessionId, long blockId) throws BlockDoesNotExistException
sessionId
- the id of the clientblockId
- the id of the block to be lockedBlockDoesNotExistException
- if blockId cannot be found, for example, evicted alreadylong lockBlockNoException(long sessionId, long blockId)
BlockLockManager.INVALID_LOCK_ID
.sessionId
- the id of the clientblockId
- the id of the block to be lockedBlockLockManager.INVALID_LOCK_ID
if it failed to lockvoid moveBlock(long sessionId, long blockId, String tierAlias) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, WorkerOutOfSpaceException, IOException
IllegalArgumentException
if the tierAlias is out of range of
tiered storage.sessionId
- the id of the clientblockId
- the id of the block to movetierAlias
- the alias of the tier to move the block toBlockDoesNotExistException
- if blockId cannot be foundBlockAlreadyExistsException
- if blockId already exists in committed blocks of the
newLocationInvalidWorkerStateException
- if blockId has not been committedWorkerOutOfSpaceException
- if newLocation does not have enough extra space to hold the
blockIOException
void moveBlockToMedium(long sessionId, long blockId, String mediumType) throws BlockDoesNotExistException, BlockAlreadyExistsException, InvalidWorkerStateException, WorkerOutOfSpaceException, IOException
IllegalArgumentException
if the medium type is not one of the listed medium
types.sessionId
- the id of the clientblockId
- the id of the block to movemediumType
- the medium type to move toBlockDoesNotExistException
- if blockId cannot be foundBlockAlreadyExistsException
- if blockId already exists in committed blocks of the
newLocationInvalidWorkerStateException
- if blockId has not been committedWorkerOutOfSpaceException
- if newLocation does not have enough extra space to hold the
blockIOException
String readBlock(long sessionId, long blockId, long lockId) throws BlockDoesNotExistException, InvalidWorkerStateException
sessionId
- the id of the clientblockId
- the id of the block to readlockId
- the id of the lock on this blockBlockDoesNotExistException
- if the blockId cannot be found in committed blocks or lockId
cannot be foundInvalidWorkerStateException
- if sessionId or blockId is not the same as that in the
LockRecord of lockIdBlockReader readBlockRemote(long sessionId, long blockId, long lockId) throws BlockDoesNotExistException, InvalidWorkerStateException, IOException
sessionId
- the id of the clientblockId
- the id of the block to readlockId
- the id of the lock on this blockBlockDoesNotExistException
- if lockId is not foundInvalidWorkerStateException
- if sessionId or blockId is not the same as that in the
LockRecord of lockIdIOException
BlockReader readUfsBlock(long sessionId, long blockId, long offset, boolean positionShort) throws BlockDoesNotExistException, IOException
sessionId
- the client session IDblockId
- the ID of the UFS block to readoffset
- the offset within the blockpositionShort
- whether the operation is using positioned read to a small buffer sizeBlockDoesNotExistException
- if the block does not exist in the UFS block storeIOException
void removeBlock(long sessionId, long blockId) throws InvalidWorkerStateException, BlockDoesNotExistException, IOException
sessionId
- the id of the clientblockId
- the id of the block to be freedInvalidWorkerStateException
- if blockId has not been committedBlockDoesNotExistException
- if block cannot be foundIOException
void requestSpace(long sessionId, long blockId, long additionalBytes) throws BlockDoesNotExistException, WorkerOutOfSpaceException, IOException
sessionId
- the id of the clientblockId
- the id of the block to allocate space toadditionalBytes
- the amount of bytes to allocateBlockDoesNotExistException
- if blockId can not be found, or some block in eviction plan
cannot be foundWorkerOutOfSpaceException
- if requested space can not be satisfiedIOException
void unlockBlock(long lockId) throws BlockDoesNotExistException
lockId
- the id of the lock to releaseBlockDoesNotExistException
- if lock id cannot be foundboolean unlockBlock(long sessionId, long blockId)
sessionId
- the session idblockId
- the block idvoid sessionHeartbeat(long sessionId)
sessionId
- the id of the clientvoid updatePinList(Set<Long> pinnedInodes)
PinListSync
.pinnedInodes
- a set of pinned inodesFileInfo getFileInfo(long fileId) throws IOException
fileId
- the file idIOException
boolean openUfsBlock(long sessionId, long blockId, Protocol.OpenUfsBlockOptions options) throws BlockAlreadyExistsException
UfsBlockAccessTokenUnavailableException
if the number of concurrent readers
on this block exceeds a threshold.sessionId
- the session IDblockId
- the block IDoptions
- the optionsBlockAlreadyExistsException
- if the UFS block already exists in the
UnderFileSystemBlockStore
void closeUfsBlock(long sessionId, long blockId) throws BlockAlreadyExistsException, BlockDoesNotExistException, IOException, WorkerOutOfSpaceException
sessionId
- the session IDblockId
- the block IDBlockAlreadyExistsException
- if it fails to commit the block to Alluxio block store
because the block exists in the Alluxio block storeBlockDoesNotExistException
- if the UFS block does not exist in the
UnderFileSystemBlockStore
WorkerOutOfSpaceException
- the the worker does not have enough space to commit the blockIOException
void clearMetrics()
Copyright © 2023. All Rights Reserved.