public interface BlockMaster extends Master, ContainerIdGenerable
Modifier and Type | Method and Description |
---|---|
void |
commitBlock(long workerId,
long usedBytesOnTier,
String tierAlias,
String mediumType,
long blockId,
long length)
Marks a block as committed on a specific worker.
|
void |
commitBlockInUFS(long blockId,
long length)
Marks a block as committed, but without a worker location.
|
BlockInfo |
getBlockInfo(long blockId) |
List<BlockInfo> |
getBlockInfoList(List<Long> blockIds)
Retrieves information for the given list of block ids.
|
long |
getBlockReplicaCount() |
long |
getCapacityBytes() |
StorageTierAssoc |
getGlobalStorageTierAssoc() |
int |
getLostBlocksCount() |
Iterator<Long> |
getLostBlocksIterator()
Returns an
Iterator over the lost blocks. |
int |
getLostWorkerCount() |
List<WorkerInfo> |
getLostWorkersInfoList() |
Map<String,Long> |
getTotalBytesOnTiers() |
long |
getUniqueBlockCount() |
long |
getUsedBytes() |
Map<String,Long> |
getUsedBytesOnTiers() |
MasterWorkerInfo |
getWorker(long workerId)
Returns the internal
MasterWorkerInfo object to the caller. |
Set<WorkerNetAddress> |
getWorkerAddresses() |
int |
getWorkerCount() |
long |
getWorkerId(WorkerNetAddress workerNetAddress)
Returns a worker id for the given worker, creating one if the worker is new.
|
List<WorkerInfo> |
getWorkerInfoList() |
List<WorkerLostStorageInfo> |
getWorkerLostStorage() |
List<WorkerInfo> |
getWorkerReport(GetWorkerReportOptions options)
Gets the worker information list for report CLI.
|
boolean |
hasRegisterLease(long workerId)
Verifies if the worker currently holds a
RegisterLease . |
boolean |
isBlockLost(long blockId) |
void |
registerLostWorkerFoundListener(java.util.function.Consumer<Address> function)
Registers callback functions to use when lost workers become alive.
|
void |
registerNewWorkerConfListener(java.util.function.BiConsumer<Address,List<ConfigProperty>> function)
Registers callback functions to use when workers register with configuration.
|
void |
registerWorkerLostListener(java.util.function.Consumer<Address> function)
Registers callback functions to use when detecting lost workers.
|
void |
releaseRegisterLease(long workerId)
Releases the
RegisterLease for the specified worker. |
void |
removeBlocks(List<Long> blockIds,
boolean delete)
Removes blocks from workers.
|
void |
reportLostBlocks(List<Long> blockIds)
Reports the ids of the blocks lost on workers.
|
Optional<RegisterLease> |
tryAcquireRegisterLease(GetRegisterLeasePRequest request)
Try to acquire a
RegisterLease for the worker. |
void |
validateBlocks(java.util.function.Function<Long,Boolean> validator,
boolean repair)
Validates the integrity of blocks with respect to the validator.
|
Command |
workerHeartbeat(long workerId,
Map<String,Long> capacityBytesOnTiers,
Map<String,Long> usedBytesOnTiers,
List<Long> removedBlockIds,
Map<Block.BlockLocation,List<Long>> addedBlocks,
Map<String,StorageList> lostStorage,
List<Metric> metrics)
Updates metadata when a worker periodically heartbeats with the master.
|
void |
workerRegister(long workerId,
List<String> storageTiers,
Map<String,Long> totalBytesOnTiers,
Map<String,Long> usedBytesOnTiers,
Map<Block.BlockLocation,List<Long>> currentBlocksOnLocation,
Map<String,StorageList> lostStorage,
RegisterWorkerPOptions options)
Updates metadata when a worker registers with the master.
|
void |
workerRegisterFinish(WorkerRegisterContext context)
Completes the worker registration stream.
|
void |
workerRegisterStream(WorkerRegisterContext context,
RegisterWorkerPRequest chunk,
boolean isFirstMsg)
Handles messages in a register stream.
|
createJournalContext, getMasterContext
applyAndJournal, processJournalEntry, resetState, restoreFromCheckpoint, writeToCheckpoint
getCheckpointName
getJournalEntryIterator
close, getDependencies, getName, getServices, start, stop
getNewContainerId
int getWorkerCount()
int getLostWorkerCount()
long getCapacityBytes()
long getUniqueBlockCount()
long getBlockReplicaCount()
StorageTierAssoc getGlobalStorageTierAssoc()
long getUsedBytes()
List<WorkerInfo> getWorkerInfoList() throws UnavailableException
WorkerInfo
objects representing the live workers in AlluxioUnavailableException
List<WorkerInfo> getLostWorkersInfoList() throws UnavailableException
WorkerInfo
s of lost workersUnavailableException
Set<WorkerNetAddress> getWorkerAddresses() throws UnavailableException
UnavailableException
List<WorkerInfo> getWorkerReport(GetWorkerReportOptions options) throws UnavailableException, InvalidArgumentException
options
- the GetWorkerReportOptions defines the info rangeWorkerInfo
objects representing the workers in AlluxioUnavailableException
InvalidArgumentException
List<WorkerLostStorageInfo> getWorkerLostStorage()
void removeBlocks(List<Long> blockIds, boolean delete) throws UnavailableException
blockIds
- a list of block ids to remove from Alluxio spacedelete
- whether to delete blocks' metadata in MasterUnavailableException
void validateBlocks(java.util.function.Function<Long,Boolean> validator, boolean repair) throws UnavailableException
validator
- a function returns true if the given block id is validrepair
- if true, deletes the invalid blocksUnavailableException
- if the invalid blocks cannot be deletedvoid commitBlock(long workerId, long usedBytesOnTier, String tierAlias, String mediumType, long blockId, long length) throws NotFoundException, UnavailableException
workerId
- the worker id committing the blockusedBytesOnTier
- the updated used bytes on the tier of the workertierAlias
- the alias of the storage tier where the worker is committing the block tomediumType
- the medium type where the worker is committing the block toblockId
- the committing block idlength
- the length of the blockNotFoundException
- if the workerId is not activeUnavailableException
void commitBlockInUFS(long blockId, long length) throws UnavailableException
blockId
- the id of the block to commitlength
- the length of the blockUnavailableException
BlockInfo getBlockInfo(long blockId) throws BlockInfoException, UnavailableException
blockId
- the block id to get information forBlockInfo
for the given block idBlockInfoException
- if the block info is not foundUnavailableException
List<BlockInfo> getBlockInfoList(List<Long> blockIds) throws UnavailableException
blockIds
- A list of block ids to retrieve the information forBlockInfo
objects corresponding to the input list of block ids. The
list is in the same order as the input listUnavailableException
Map<String,Long> getTotalBytesOnTiers()
Map<String,Long> getUsedBytesOnTiers()
long getWorkerId(WorkerNetAddress workerNetAddress)
workerNetAddress
- the worker WorkerNetAddress
Optional<RegisterLease> tryAcquireRegisterLease(GetRegisterLeasePRequest request)
RegisterLease
for the worker.
If the lease is not granted, this will return empty immediately rather than blocking.request
- the request with all information for the master to make a decision withboolean hasRegisterLease(long workerId)
RegisterLease
.workerId
- the worker IDvoid releaseRegisterLease(long workerId)
RegisterLease
for the specified worker.
If the worker currently does not hold a lease, return without throwing an error.
The lease may have been recycled already.workerId
- the worker IDvoid workerRegister(long workerId, List<String> storageTiers, Map<String,Long> totalBytesOnTiers, Map<String,Long> usedBytesOnTiers, Map<Block.BlockLocation,List<Long>> currentBlocksOnLocation, Map<String,StorageList> lostStorage, RegisterWorkerPOptions options) throws NotFoundException
workerId
- the worker id of the worker registeringstorageTiers
- a list of storage tier aliases in order of their position in the worker's
hierarchytotalBytesOnTiers
- a mapping from storage tier alias to total bytesusedBytesOnTiers
- a mapping from storage tier alias to the used byescurrentBlocksOnLocation
- a mapping from storage tier alias to a list of blockslostStorage
- a mapping from storage tier alias to a list of lost storage pathsoptions
- the options that may contain worker configurationNotFoundException
- if workerId cannot be foundCommand workerHeartbeat(long workerId, Map<String,Long> capacityBytesOnTiers, Map<String,Long> usedBytesOnTiers, List<Long> removedBlockIds, Map<Block.BlockLocation,List<Long>> addedBlocks, Map<String,StorageList> lostStorage, List<Metric> metrics)
workerId
- the worker idcapacityBytesOnTiers
- a mapping from tier alias to the capacity bytesusedBytesOnTiers
- a mapping from tier alias to the used bytesremovedBlockIds
- a list of block ids removed from this workeraddedBlocks
- a mapping from tier alias to the added blockslostStorage
- a mapping from tier alias to lost storage pathsmetrics
- worker metricsboolean isBlockLost(long blockId)
blockId
- the block IDIterator<Long> getLostBlocksIterator()
Iterator
over the lost blocks.
Note that the iterator should not be shared across threads.int getLostBlocksCount()
void reportLostBlocks(List<Long> blockIds)
blockIds
- the ids of the lost blocksvoid registerLostWorkerFoundListener(java.util.function.Consumer<Address> function)
function
- the function to registervoid registerWorkerLostListener(java.util.function.Consumer<Address> function)
function
- the function to registervoid registerNewWorkerConfListener(java.util.function.BiConsumer<Address,List<ConfigProperty>> function)
function
- the function to registerMasterWorkerInfo getWorker(long workerId) throws NotFoundException
MasterWorkerInfo
object to the caller.
This is specifically for the tests and the WorkerRegisterContext
.
Note that this operations on the object requires locking.
See the javadoc of MasterWorkerInfo
for how the locking should be carefully done.
When in doubt, do not use this API. Find other methods in this class that exposes
necessary information.workerId
- the worker IDMasterWorkerInfo
for the workerNotFoundException
void workerRegisterStream(WorkerRegisterContext context, RegisterWorkerPRequest chunk, boolean isFirstMsg)
context
- the stream context that contains the worker informationchunk
- the message in a streamisFirstMsg
- whether the message is the 1st in a streamvoid workerRegisterFinish(WorkerRegisterContext context)
context
- the stream context to be closedCopyright © 2023. All Rights Reserved.