@NotThreadSafe public final class DefaultBlockMaster extends CoreMaster implements BlockMaster
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultBlockMaster.Metrics
Class that contains metrics related to BlockMaster.
|
mBackupManager, mJournalSystem, mPort, mSafeModeManager, mStartTimeMsmClock, mMasterContext| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
commitBlock(long workerId,
long usedBytesOnTier,
java.lang.String tierAlias,
java.lang.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) |
java.util.List<BlockInfo> |
getBlockInfoList(java.util.List<java.lang.Long> blockIds)
Retrieves information for the given list of block ids.
|
long |
getCapacityBytes() |
CheckpointName |
getCheckpointName() |
java.util.Set<java.lang.Class<? extends Server>> |
getDependencies() |
StorageTierAssoc |
getGlobalStorageTierAssoc() |
java.util.Iterator<Journal.JournalEntry> |
getJournalEntryIterator() |
java.util.Set<java.lang.Long> |
getLostBlocks() |
int |
getLostWorkerCount() |
java.util.List<WorkerInfo> |
getLostWorkersInfoList() |
java.lang.String |
getName() |
long |
getNewContainerId() |
java.util.Map<ServiceType,GrpcService> |
getServices() |
java.util.Map<java.lang.String,java.lang.Long> |
getTotalBytesOnTiers() |
long |
getUsedBytes() |
java.util.Map<java.lang.String,java.lang.Long> |
getUsedBytesOnTiers() |
int |
getWorkerCount() |
long |
getWorkerId(WorkerNetAddress workerNetAddress)
Returns a worker id for the given worker, creating one if the worker is new.
|
java.util.List<WorkerInfo> |
getWorkerInfoList() |
java.util.List<WorkerLostStorageInfo> |
getWorkerLostStorage() |
java.util.List<WorkerInfo> |
getWorkerReport(GetWorkerReportOptions options)
Gets the worker information list for report CLI.
|
boolean |
processJournalEntry(Journal.JournalEntry entry) |
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,java.util.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 |
removeBlocks(java.util.List<java.lang.Long> blockIds,
boolean delete)
Removes blocks from workers.
|
void |
reportLostBlocks(java.util.List<java.lang.Long> blockIds)
Reports the ids of the blocks lost on workers.
|
void |
resetState() |
void |
start(java.lang.Boolean isLeader) |
void |
stop() |
void |
validateBlocks(java.util.function.Function<java.lang.Long,java.lang.Boolean> validator,
boolean repair)
Validates the integrity of blocks with respect to the validator.
|
Command |
workerHeartbeat(long workerId,
java.util.Map<java.lang.String,java.lang.Long> capacityBytesOnTiers,
java.util.Map<java.lang.String,java.lang.Long> usedBytesOnTiers,
java.util.List<java.lang.Long> removedBlockIds,
java.util.Map<Block.BlockLocation,java.util.List<java.lang.Long>> addedBlocks,
java.util.Map<java.lang.String,StorageList> lostStorage,
java.util.List<Metric> metrics)
Updates metadata when a worker periodically heartbeats with the master.
|
void |
workerRegister(long workerId,
java.util.List<java.lang.String> storageTiers,
java.util.Map<java.lang.String,java.lang.Long> totalBytesOnTiers,
java.util.Map<java.lang.String,java.lang.Long> usedBytesOnTiers,
java.util.Map<Block.BlockLocation,java.util.List<java.lang.Long>> currentBlocksOnLocation,
java.util.Map<java.lang.String,StorageList> lostStorage,
RegisterWorkerPOptions options)
Updates metadata when a worker registers with the master.
|
createJournalContext, getExecutorServiceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateJournalContextapplyAndJournal, restoreFromCheckpoint, writeToCheckpointpublic java.lang.String getName()
public java.util.Map<ServiceType,GrpcService> getServices()
getServices in interface Server<java.lang.Boolean>public boolean processJournalEntry(Journal.JournalEntry entry)
processJournalEntry in interface Journaledpublic void resetState()
resetState in interface Journaledpublic CheckpointName getCheckpointName()
getCheckpointName in interface Checkpointedpublic java.util.Iterator<Journal.JournalEntry> getJournalEntryIterator()
getJournalEntryIterator in interface JournalEntryIterablepublic void start(java.lang.Boolean isLeader)
throws java.io.IOException
start in interface Server<java.lang.Boolean>start in class AbstractMasterjava.io.IOExceptionpublic void stop()
throws java.io.IOException
stop in interface Server<java.lang.Boolean>stop in class AbstractMasterjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface Server<java.lang.Boolean>close in class AbstractMasterjava.io.IOExceptionpublic int getWorkerCount()
getWorkerCount in interface BlockMasterpublic int getLostWorkerCount()
getLostWorkerCount in interface BlockMasterpublic long getCapacityBytes()
getCapacityBytes in interface BlockMasterpublic StorageTierAssoc getGlobalStorageTierAssoc()
getGlobalStorageTierAssoc in interface BlockMasterpublic long getUsedBytes()
getUsedBytes in interface BlockMasterpublic java.util.List<WorkerInfo> getWorkerInfoList() throws UnavailableException
getWorkerInfoList in interface BlockMasterWorkerInfo objects representing the live workers in AlluxioUnavailableExceptionpublic java.util.List<WorkerInfo> getLostWorkersInfoList() throws UnavailableException
getLostWorkersInfoList in interface BlockMasterWorkerInfos of lost workersUnavailableExceptionpublic java.util.List<WorkerInfo> getWorkerReport(GetWorkerReportOptions options) throws UnavailableException, InvalidArgumentException
BlockMastergetWorkerReport in interface BlockMasteroptions - the GetWorkerReportOptions defines the info rangeWorkerInfo objects representing the workers in AlluxioUnavailableExceptionInvalidArgumentExceptionpublic java.util.List<WorkerLostStorageInfo> getWorkerLostStorage()
getWorkerLostStorage in interface BlockMasterpublic void removeBlocks(java.util.List<java.lang.Long> blockIds,
boolean delete)
throws UnavailableException
BlockMasterremoveBlocks in interface BlockMasterblockIds - a list of block ids to remove from Alluxio spacedelete - whether to delete blocks' metadata in MasterUnavailableExceptionpublic void validateBlocks(java.util.function.Function<java.lang.Long,java.lang.Boolean> validator,
boolean repair)
throws UnavailableException
BlockMastervalidateBlocks in interface BlockMastervalidator - a function returns true if the given block id is validrepair - if true, deletes the invalid blocksUnavailableException - if the invalid blocks cannot be deletedpublic long getNewContainerId()
throws UnavailableException
getNewContainerId in interface ContainerIdGenerableUnavailableExceptionpublic void commitBlock(long workerId,
long usedBytesOnTier,
java.lang.String tierAlias,
java.lang.String mediumType,
long blockId,
long length)
throws NotFoundException,
UnavailableException
BlockMastercommitBlock in interface BlockMasterworkerId - 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 activeUnavailableExceptionpublic void commitBlockInUFS(long blockId,
long length)
throws UnavailableException
BlockMastercommitBlockInUFS in interface BlockMasterblockId - the id of the block to commitlength - the length of the blockUnavailableExceptionpublic BlockInfo getBlockInfo(long blockId) throws BlockInfoException, UnavailableException
getBlockInfo in interface BlockMasterblockId - the block id to get information forBlockInfo for the given block idBlockInfoException - if the block info is not foundUnavailableExceptionpublic java.util.List<BlockInfo> getBlockInfoList(java.util.List<java.lang.Long> blockIds) throws UnavailableException
BlockMastergetBlockInfoList in interface BlockMasterblockIds - 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 listUnavailableExceptionpublic java.util.Map<java.lang.String,java.lang.Long> getTotalBytesOnTiers()
getTotalBytesOnTiers in interface BlockMasterpublic java.util.Map<java.lang.String,java.lang.Long> getUsedBytesOnTiers()
getUsedBytesOnTiers in interface BlockMasterpublic long getWorkerId(WorkerNetAddress workerNetAddress)
BlockMastergetWorkerId in interface BlockMasterworkerNetAddress - the worker WorkerNetAddresspublic void workerRegister(long workerId,
java.util.List<java.lang.String> storageTiers,
java.util.Map<java.lang.String,java.lang.Long> totalBytesOnTiers,
java.util.Map<java.lang.String,java.lang.Long> usedBytesOnTiers,
java.util.Map<Block.BlockLocation,java.util.List<java.lang.Long>> currentBlocksOnLocation,
java.util.Map<java.lang.String,StorageList> lostStorage,
RegisterWorkerPOptions options)
throws NotFoundException
BlockMasterworkerRegister in interface BlockMasterworkerId - 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 foundpublic Command workerHeartbeat(long workerId, java.util.Map<java.lang.String,java.lang.Long> capacityBytesOnTiers, java.util.Map<java.lang.String,java.lang.Long> usedBytesOnTiers, java.util.List<java.lang.Long> removedBlockIds, java.util.Map<Block.BlockLocation,java.util.List<java.lang.Long>> addedBlocks, java.util.Map<java.lang.String,StorageList> lostStorage, java.util.List<Metric> metrics)
BlockMasterworkerHeartbeat in interface BlockMasterworkerId - 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 metricspublic java.util.Set<java.lang.Long> getLostBlocks()
getLostBlocks in interface BlockMasterpublic void reportLostBlocks(java.util.List<java.lang.Long> blockIds)
BlockMasterreportLostBlocks in interface BlockMasterblockIds - the ids of the lost blockspublic java.util.Set<java.lang.Class<? extends Server>> getDependencies()
getDependencies in interface Server<java.lang.Boolean>getDependencies in class AbstractMasterpublic void registerLostWorkerFoundListener(java.util.function.Consumer<Address> function)
BlockMasterregisterLostWorkerFoundListener in interface BlockMasterfunction - the function to registerpublic void registerWorkerLostListener(java.util.function.Consumer<Address> function)
BlockMasterregisterWorkerLostListener in interface BlockMasterfunction - the function to registerpublic void registerNewWorkerConfListener(java.util.function.BiConsumer<Address,java.util.List<ConfigProperty>> function)
BlockMasterregisterNewWorkerConfListener in interface BlockMasterfunction - the function to registerCopyright © 2019. All Rights Reserved.