public interface BlockWorker extends DataWorker, 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 |
asyncCache(AsyncCacheRequest request)
Deprecated.
This method will be deprecated as of v3.0, use
cache(alluxio.grpc.CacheRequest) |
void |
cache(CacheRequest request)
Submits the cache request to cache manager to execute.
|
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.
|
String |
createBlock(long sessionId,
long blockId,
int tier,
CreateBlockOptions createBlockOptions)
Creates a block in Alluxio managed space.
|
BlockReader |
createBlockReader(long sessionId,
long blockId,
long offset,
boolean positionShort,
Protocol.OpenUfsBlockOptions options)
Creates the block reader to read from Alluxio block or UFS block.
|
void |
createBlockRemote(long sessionId,
long blockId,
String tierAlias,
long initialBytes)
Creates a block.
|
BlockWriter |
createBlockWriter(long sessionId,
long blockId)
Creates a
BlockWriter for an existing temporary block which is already created by
createBlock(long, long, int, alluxio.worker.block.CreateBlockOptions) . |
BlockReader |
createUfsBlockReader(long sessionId,
long blockId,
long offset,
boolean positionShort,
Protocol.OpenUfsBlockOptions options)
Creates a block reader to read a UFS block starting from given block offset.
|
void |
freeWorker()
Frees all blocks in the current worker by deleting all block store directories.
|
BlockStore |
getBlockStore() |
Configuration |
getConfiguration(GetConfigurationPOptions options) |
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. |
List<String> |
getWhiteList() |
WorkerNetAddress |
getWorkerAddress() |
CompletableFuture<List<BlockStatus>> |
load(List<Block> fileBlocks,
UfsReadOptions options)
Load blocks into alluxio.
|
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.
|
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.
|
BlockReader |
readUfsBlock(long sessionId,
long blockId,
long offset)
Gets a block reader to read a UFS block.
|
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 |
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.
|
getWorkerId
close, getDependencies, getName, getServices, start, stop
cleanupSession
void abortBlock(long sessionId, long blockId) throws IOException
sessionId
- the id of the clientblockId
- the id of the block to be abortedIOException
void commitBlock(long sessionId, long blockId, boolean pinOnCreate)
sessionId
- the id of the clientblockId
- the id of the block to commitpinOnCreate
- whether to pin block on createString createBlock(long sessionId, long blockId, int tier, CreateBlockOptions createBlockOptions)
createBlockWriter(long, long)
to get a writer for writing to the block.
The block will be temporary until it is committed by commitBlock(long, long, boolean)
.
Throws an IllegalArgumentException
if the location does not belong to tiered storage.sessionId
- the id of the clientblockId
- the id of the block to createtier
- the tier to place the new block in
BlockStoreLocation.ANY_TIER
for any tiercreateBlockOptions
- the createBlockOptionsBlockWriter createBlockWriter(long sessionId, long blockId) throws IOException
BlockWriter
for an existing temporary block which is already created by
createBlock(long, long, int, alluxio.worker.block.CreateBlockOptions)
.sessionId
- the id of the clientblockId
- the id of the block to be opened for writingIOException
BlockHeartbeatReport getReport()
BlockStoreMeta getStoreMeta()
BlockStoreMeta getStoreMetaFull()
getStoreMeta()
except that this also contains full blockId
list. This function is expensive.BlockReader createBlockReader(long sessionId, long blockId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws 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 sizeoptions
- the optionsIOException
- if it fails to get block readerBlockReader createUfsBlockReader(long sessionId, long blockId, long offset, boolean positionShort, Protocol.OpenUfsBlockOptions options) throws 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 sizeoptions
- the optionsIOException
- if it fails to get block readervoid removeBlock(long sessionId, long blockId) throws IOException
sessionId
- the id of the clientblockId
- the id of the block to be freedIOException
void freeWorker() throws IOException
IOException
- if free failsvoid requestSpace(long sessionId, long blockId, long additionalBytes)
sessionId
- the id of the clientblockId
- the id of the block to allocate space toadditionalBytes
- the amount of bytes to allocate@Deprecated void asyncCache(AsyncCacheRequest request)
cache(alluxio.grpc.CacheRequest)
request
- the async cache requestvoid cache(CacheRequest request) throws AlluxioException, IOException
request
- the cache requestAlluxioException
IOException
CompletableFuture<List<BlockStatus>> load(List<Block> fileBlocks, UfsReadOptions options)
fileBlocks
- list of fileBlocks, one file blocks contains blocks belong to one fileoptions
- read ufs optionsvoid updatePinList(Set<Long> pinnedInodes)
pinnedInodes
- a set of pinned inodesFileInfo getFileInfo(long fileId) throws IOException
fileId
- the file idIOException
void clearMetrics()
Configuration getConfiguration(GetConfigurationPOptions options)
options
- method optionsBlockStore getBlockStore()
WorkerNetAddress getWorkerAddress()
BlockReader 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
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 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 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
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 lockIdvoid 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 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 createBlockRemote(long sessionId, long blockId, String tierAlias, long initialBytes) throws BlockAlreadyExistsException, WorkerOutOfSpaceException, IOException
#getTempBlockWriterRemote(long, long)
to get a writer for writing to the block.
Throws an IllegalArgumentException
if the location doens 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 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
BlockReader readUfsBlock(long sessionId, long blockId, long offset) throws BlockDoesNotExistException, IOException
sessionId
- the client session IDblockId
- the ID of the UFS block to readoffset
- the offset within the blockBlockDoesNotExistException
- if the block does not exist in the UFS block storeIOException
Copyright © 2023. All Rights Reserved.