@NotThreadSafe public final class DefaultFileSystemMaster extends AbstractMaster implements FileSystemMaster
Modifier and Type | Class and Description |
---|---|
static class |
DefaultFileSystemMaster.Metrics
Class that contains metrics for FileSystemMaster.
|
mBackupManager, mClock, mPauseStateLock, mSafeModeManager, mStateChangeLock
Modifier and Type | Method and Description |
---|---|
List<AlluxioURI> |
checkConsistency(AlluxioURI path,
CheckConsistencyOptions options)
Checks the consistency of the files and directories in the subtree under the path.
|
void |
completeFile(AlluxioURI path,
CompleteFileOptions options)
Completes a file.
|
long |
createDirectory(AlluxioURI path,
CreateDirectoryOptions options)
Creates a directory for a given path.
|
long |
createFile(AlluxioURI path,
CreateFileOptions options)
Creates a file (not a directory) for a given path.
|
RpcContext |
createRpcContext() |
void |
delete(AlluxioURI path,
DeleteOptions options)
Deletes a given path.
|
void |
deleteAndJournal(RpcContext rpcContext,
LockedInodePath inodePath,
DeleteOptions deleteOptions)
Deletes a given path.
|
void |
free(AlluxioURI path,
FreeOptions options)
Frees or evicts all of the blocks of the file from alluxio storage.
|
Set<Class<? extends Server>> |
getDependencies() |
MountPointInfo |
getDisplayMountPointInfo(AlluxioURI path)
Gets the mount point information of an Alluxio path for display purpose.
|
List<FileBlockInfo> |
getFileBlockInfoList(AlluxioURI path)
Gets the
FileBlockInfo for all blocks of a file. |
long |
getFileId(AlluxioURI path)
Returns the file id for a given path.
|
FileInfo |
getFileInfo(AlluxioURI path,
GetStatusOptions options)
Returns the
FileInfo for a given path. |
FileInfo |
getFileInfo(long fileId)
Returns the
FileInfo for a given file id. |
FileSystemMasterView |
getFileSystemMasterView() |
List<AlluxioURI> |
getInAlluxioFiles() |
List<AlluxioURI> |
getInMemoryFiles() |
Iterator<Journal.JournalEntry> |
getJournalEntryIterator() |
List<Long> |
getLostFiles() |
MountPointInfo |
getMountPointInfo(AlluxioURI path)
Gets the mount point information of an Alluxio path.
|
Map<String,MountPointInfo> |
getMountTable() |
String |
getName() |
long |
getNewBlockIdForFile(AlluxioURI path)
Gets a new block id for the next block of a given file to write to.
|
int |
getNumberOfPaths() |
int |
getNumberOfPinnedFiles() |
AlluxioURI |
getPath(long fileId)
Gets the path of a file with the given id.
|
PersistenceState |
getPersistenceState(long fileId)
Returns the persistence state for a file id.
|
Set<Long> |
getPinIdList() |
Map<String,org.apache.thrift.TProcessor> |
getServices() |
StartupConsistencyCheck |
getStartupConsistencyCheck() |
String |
getUfsAddress() |
UfsInfo |
getUfsInfo(long mountId) |
List<String> |
getWhiteList() |
List<WorkerInfo> |
getWorkerInfoList() |
List<FileInfo> |
listStatus(AlluxioURI path,
ListStatusOptions listStatusOptions)
Returns a list of
FileInfo for a given path. |
long |
loadMetadata(AlluxioURI path,
LoadMetadataOptions options)
Loads metadata for the object identified by the given path from UFS into Alluxio.
|
void |
mount(AlluxioURI alluxioPath,
AlluxioURI ufsPath,
MountOptions options)
Mounts a UFS path onto an Alluxio path.
|
void |
processJournalEntry(Journal.JournalEntry entry)
Applies a journal entry to the state machine.
|
long |
reinitializeFile(AlluxioURI path,
long blockSizeBytes,
long ttl,
TtlAction ttlAction)
Reinitializes the blocks of an existing open file.
|
void |
rename(AlluxioURI srcPath,
AlluxioURI dstPath,
RenameOptions options)
Renames a file to a destination.
|
void |
reportLostFile(long fileId)
Reports a file as lost.
|
void |
resetFile(long fileId)
Resets a file.
|
void |
resetState()
Resets the journaled internal state of the state machine.
|
void |
scheduleAsyncPersistence(AlluxioURI path)
Schedules a file for async persistence.
|
void |
setAttribute(AlluxioURI path,
SetAttributeOptions options)
Sets the file attribute.
|
void |
start(Boolean isPrimary)
Starts the Alluxio server.
|
void |
stop()
Stops the Alluxio server.
|
void |
unmount(AlluxioURI alluxioPath)
Unmounts a UFS path previously mounted onto an Alluxio path.
|
void |
updateUfsMode(AlluxioURI ufsPath,
UnderFileSystem.UfsMode ufsMode)
Update the operation mode for the given ufs path under one or more mount points.
|
void |
validateInodeBlocks(boolean repair)
Checks the integrity of the inodes with respect to the blocks of the system.
|
FileSystemCommand |
workerHeartbeat(long workerId,
List<Long> persistedFiles,
WorkerHeartbeatOptions options)
Instructs a worker to persist the files.
|
createJournalContext, getExecutorService
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createJournalContext
public Map<String,org.apache.thrift.TProcessor> getServices()
getServices
in interface Server<Boolean>
TProcessor
s that serve RPCs for this serverpublic String getName()
getName
in interface JournalEntryStateMachine
getName
in interface Server<Boolean>
public Set<Class<? extends Server>> getDependencies()
getDependencies
in interface Server<Boolean>
getDependencies
in class AbstractMaster
public void processJournalEntry(Journal.JournalEntry entry) throws IOException
JournalEntryStateMachine
processJournalEntry
in interface JournalEntryStateMachine
entry
- the entry to process to update the state of the state machineIOException
public void resetState()
JournalEntryStateMachine
resetState
in interface JournalEntryStateMachine
public Iterator<Journal.JournalEntry> getJournalEntryIterator()
getJournalEntryIterator
in interface JournalEntryIterable
Iterator
that iterates all the journal entriespublic void start(Boolean isPrimary) throws IOException
Server
start
in interface Server<Boolean>
start
in class AbstractMaster
isPrimary
- the start optionsIOException
public void stop() throws IOException
Server
#start(T)
should be
cleaned up and shutdown.stop
in interface Server<Boolean>
stop
in class AbstractMaster
IOException
public void validateInodeBlocks(boolean repair) throws UnavailableException
FileSystemMaster
validateInodeBlocks
in interface FileSystemMaster
repair
- if true, will attempt to repair the state of the system when inconsistencies are
discoveredUnavailableException
- if the repair attempt failspublic StartupConsistencyCheck getStartupConsistencyCheck()
getStartupConsistencyCheck
in interface FileSystemMaster
public long getFileId(AlluxioURI path) throws AccessControlException, UnavailableException
FileSystemMaster
This operation requires users to have READ permission of the path.
getFileId
in interface FileSystemMaster
path
- the path to get the file id forAccessControlException
- if permission checking failsUnavailableException
public FileInfo getFileInfo(long fileId) throws FileDoesNotExistException, AccessControlException, UnavailableException
FileSystemMaster
FileInfo
for a given file id. This method is not user-facing but supposed
to be called by other internal servers (e.g., block workers, lineage master, web UI).getFileInfo
in interface FileSystemMaster
fileId
- the file id to get the FileInfo
forFileInfo
for the given fileFileDoesNotExistException
- if the file does not existAccessControlException
- if permission deniedUnavailableException
public FileInfo getFileInfo(AlluxioURI path, GetStatusOptions options) throws FileDoesNotExistException, InvalidPathException, AccessControlException, UnavailableException, IOException
FileSystemMaster
FileInfo
for a given path.
This operation requires users to have READ permission on the path.
getFileInfo
in interface FileSystemMaster
path
- the path to get the FileInfo
foroptions
- the GetStatusOptions
FileInfo
for the given file idFileDoesNotExistException
- if the file does not existInvalidPathException
- if the file path is not validAccessControlException
- if permission checking failsUnavailableException
IOException
public PersistenceState getPersistenceState(long fileId) throws FileDoesNotExistException
FileSystemMaster
getPersistenceState
in interface FileSystemMaster
fileId
- the file idPersistenceState
for the given file idFileDoesNotExistException
- if the file does not existpublic List<FileInfo> listStatus(AlluxioURI path, ListStatusOptions listStatusOptions) throws AccessControlException, FileDoesNotExistException, InvalidPathException, UnavailableException
FileSystemMaster
FileInfo
for a given path. If the given path is a file, the list only
contains a single object. If it is a directory, the resulting list contains all direct children
of the directory.
This operation requires users to have READ permission on the path, and also EXECUTE permission on the path if it is a directory.
listStatus
in interface FileSystemMaster
path
- the path to get the FileInfo
list forlistStatusOptions
- the ListStatusOptions
FileInfo
sAccessControlException
- if permission checking failsFileDoesNotExistException
- if the file does not existInvalidPathException
- if the path is invalidUnavailableException
public FileSystemMasterView getFileSystemMasterView()
getFileSystemMasterView
in interface FileSystemMaster
public List<AlluxioURI> checkConsistency(AlluxioURI path, CheckConsistencyOptions options) throws AccessControlException, FileDoesNotExistException, InvalidPathException, IOException
FileSystemMaster
checkConsistency
in interface FileSystemMaster
path
- the root of the subtree to checkoptions
- the options to use for the checkConsistency methodAccessControlException
- if the permission checking failsFileDoesNotExistException
- if the path does not existInvalidPathException
- if the path is invalidIOException
public void completeFile(AlluxioURI path, CompleteFileOptions options) throws BlockInfoException, FileDoesNotExistException, InvalidPathException, InvalidFileSizeException, FileAlreadyCompletedException, AccessControlException, UnavailableException
FileSystemMaster
This operation requires users to have WRITE permission on the path.
completeFile
in interface FileSystemMaster
path
- the file path to completeoptions
- the method optionsBlockInfoException
- if a block information exception is encounteredFileDoesNotExistException
- if the file does not existInvalidPathException
- if an invalid path is encounteredInvalidFileSizeException
- if an invalid file size is encounteredFileAlreadyCompletedException
- if the file is already completedAccessControlException
- if permission checking failsUnavailableException
public long createFile(AlluxioURI path, CreateFileOptions options) throws AccessControlException, InvalidPathException, FileAlreadyExistsException, BlockInfoException, IOException, FileDoesNotExistException
FileSystemMaster
This operation requires WRITE permission on the parent of this path.
createFile
in interface FileSystemMaster
path
- the file to createoptions
- method optionsAccessControlException
- if permission checking failsInvalidPathException
- if an invalid path is encounteredFileAlreadyExistsException
- if the file already existsBlockInfoException
- if an invalid block information is encounteredFileDoesNotExistException
- if the parent of the path does not exist and the recursive
option is falseIOException
public long reinitializeFile(AlluxioURI path, long blockSizeBytes, long ttl, TtlAction ttlAction) throws InvalidPathException, FileDoesNotExistException, UnavailableException
FileSystemMaster
reinitializeFile
in interface FileSystemMaster
path
- the path to the fileblockSizeBytes
- the new block sizettl
- the ttlttlAction
- action to take after Ttl expiryInvalidPathException
- if the path is invalidFileDoesNotExistException
- if the path does not existUnavailableException
public long getNewBlockIdForFile(AlluxioURI path) throws FileDoesNotExistException, InvalidPathException, AccessControlException
FileSystemMaster
This operation requires users to have WRITE permission on the path as this API is called when creating a new block for a file.
getNewBlockIdForFile
in interface FileSystemMaster
path
- the path of the file to get the next block id forFileDoesNotExistException
- if the file does not existInvalidPathException
- if the given path is not validAccessControlException
- if permission checking failspublic Map<String,MountPointInfo> getMountTable()
getMountTable
in interface FileSystemMaster
public MountPointInfo getDisplayMountPointInfo(AlluxioURI path) throws InvalidPathException
FileSystemMaster
getDisplayMountPointInfo
in interface FileSystemMaster
path
- an Alluxio path which must be a mount pointInvalidPathException
public MountPointInfo getMountPointInfo(AlluxioURI path) throws InvalidPathException
FileSystemMaster
getMountPointInfo
in interface FileSystemMaster
path
- an Alluxio path which must be a mount pointInvalidPathException
public int getNumberOfPaths()
getNumberOfPaths
in interface FileSystemMaster
public int getNumberOfPinnedFiles()
getNumberOfPinnedFiles
in interface FileSystemMaster
public void delete(AlluxioURI path, DeleteOptions options) throws IOException, FileDoesNotExistException, DirectoryNotEmptyException, InvalidPathException, AccessControlException
FileSystemMaster
This operation requires user to have WRITE permission on the parent of the path.
delete
in interface FileSystemMaster
path
- the path to deleteoptions
- method optionsFileDoesNotExistException
- if the file does not existDirectoryNotEmptyException
- if recursive is false and the file is a nonempty directoryInvalidPathException
- if the path is invalidAccessControlException
- if permission checking failsIOException
public void deleteAndJournal(RpcContext rpcContext, LockedInodePath inodePath, DeleteOptions deleteOptions) throws InvalidPathException, FileDoesNotExistException, IOException, DirectoryNotEmptyException
Writes to the journal. This method does not delete blocks. Instead, it adds blocks to the blockDeletionContext so that they can be deleted after the inode deletion journal entry has been written. We cannot delete blocks earlier because the inode deletion may fail, leaving us with inode containing deleted blocks.
rpcContext
- the rpc contextinodePath
- the path to deletedeleteOptions
- the method optionsInvalidPathException
- if the path is invalidFileDoesNotExistException
- if the file does not existDirectoryNotEmptyException
- if recursive is false and the file is a nonempty directoryIOException
public List<FileBlockInfo> getFileBlockInfoList(AlluxioURI path) throws FileDoesNotExistException, InvalidPathException, AccessControlException, UnavailableException
FileSystemMaster
FileBlockInfo
for all blocks of a file. If path is a directory, an exception
is thrown.
This operation requires the client user to have READ permission on the the path.
getFileBlockInfoList
in interface FileSystemMaster
path
- the path to get the info forFileBlockInfo
for all the blocks of the given pathFileDoesNotExistException
- if the file does not exist or path is a directoryInvalidPathException
- if the path of the given file is invalidAccessControlException
- if permission checking failsUnavailableException
public List<AlluxioURI> getInAlluxioFiles() throws UnavailableException
getInAlluxioFiles
in interface FileSystemMaster
UnavailableException
public List<AlluxioURI> getInMemoryFiles() throws UnavailableException
getInMemoryFiles
in interface FileSystemMaster
UnavailableException
public long createDirectory(AlluxioURI path, CreateDirectoryOptions options) throws InvalidPathException, FileAlreadyExistsException, IOException, AccessControlException, FileDoesNotExistException
FileSystemMaster
This operation requires the client user to have WRITE permission on the parent of the path.
createDirectory
in interface FileSystemMaster
path
- the path of the directoryoptions
- method optionsInvalidPathException
- when the path is invalidFileAlreadyExistsException
- when there is already a file at pathAccessControlException
- if permission checking failsFileDoesNotExistException
- if the parent of the path does not exist and the recursive
option is falseIOException
public void rename(AlluxioURI srcPath, AlluxioURI dstPath, RenameOptions options) throws FileAlreadyExistsException, FileDoesNotExistException, InvalidPathException, IOException, AccessControlException
FileSystemMaster
This operation requires users to have WRITE permission on the parent of the src path, and WRITE permission on the parent of the dst path.
rename
in interface FileSystemMaster
srcPath
- the source path to renamedstPath
- the destination path to rename the file tooptions
- method optionsFileAlreadyExistsException
- if the file already existsFileDoesNotExistException
- if a non-existent file is encounteredInvalidPathException
- if an invalid path is encounteredAccessControlException
- if permission checking failsIOException
public void free(AlluxioURI path, FreeOptions options) throws FileDoesNotExistException, InvalidPathException, AccessControlException, UnexpectedAlluxioException, IOException
FileSystemMaster
This operation requires users to have READ permission on the path.
free
in interface FileSystemMaster
path
- the path to freeoptions
- options to freeFileDoesNotExistException
- if the file does not existInvalidPathException
- if the given path is invalidAccessControlException
- if permission checking failsUnexpectedAlluxioException
- if the file or directory can not be freedIOException
public AlluxioURI getPath(long fileId) throws FileDoesNotExistException
FileSystemMaster
getPath
in interface FileSystemMaster
fileId
- the id of the file to look upFileDoesNotExistException
- raise if the file does not existpublic Set<Long> getPinIdList()
getPinIdList
in interface FileSystemMaster
public String getUfsAddress()
getUfsAddress
in interface FileSystemMaster
public UfsInfo getUfsInfo(long mountId)
getUfsInfo
in interface FileSystemMaster
mountId
- the mount id to querypublic List<String> getWhiteList()
getWhiteList
in interface FileSystemMaster
public List<Long> getLostFiles()
getLostFiles
in interface FileSystemMaster
public void reportLostFile(long fileId) throws FileDoesNotExistException, UnavailableException
FileSystemMaster
reportLostFile
in interface FileSystemMaster
fileId
- the id of the fileFileDoesNotExistException
- if the file does not existUnavailableException
public long loadMetadata(AlluxioURI path, LoadMetadataOptions options) throws BlockInfoException, FileDoesNotExistException, InvalidPathException, InvalidFileSizeException, FileAlreadyCompletedException, IOException, AccessControlException
FileSystemMaster
This operation requires users to have WRITE permission on the path and its parent path if path is a file, or WRITE permission on the parent path if path is a directory.
loadMetadata
in interface FileSystemMaster
path
- the path for which metadata should be loadedoptions
- the load metadata optionsBlockInfoException
- if an invalid block size is encounteredFileDoesNotExistException
- if there is no UFS pathInvalidPathException
- if invalid path is encounteredInvalidFileSizeException
- if invalid file size is encounteredFileAlreadyCompletedException
- if the file is already completedAccessControlException
- if permission checking failsIOException
public void mount(AlluxioURI alluxioPath, AlluxioURI ufsPath, MountOptions options) throws FileAlreadyExistsException, FileDoesNotExistException, InvalidPathException, IOException, AccessControlException
FileSystemMaster
This operation requires users to have WRITE permission on the parent of the Alluxio path.
mount
in interface FileSystemMaster
alluxioPath
- the Alluxio path to mount toufsPath
- the UFS path to mountoptions
- the mount optionsFileAlreadyExistsException
- if the path to be mounted to already existsFileDoesNotExistException
- if the parent of the path to be mounted to does not existInvalidPathException
- if an invalid path is encounteredAccessControlException
- if the permission check failsIOException
public void unmount(AlluxioURI alluxioPath) throws FileDoesNotExistException, InvalidPathException, IOException, AccessControlException
FileSystemMaster
This operation requires users to have WRITE permission on the parent of the Alluxio path.
unmount
in interface FileSystemMaster
alluxioPath
- the Alluxio path to unmount, must be a mount pointFileDoesNotExistException
- if the path to be mounted does not existInvalidPathException
- if the given path is not a mount pointAccessControlException
- if the permission check failsIOException
public void resetFile(long fileId) throws UnexpectedAlluxioException, FileDoesNotExistException, InvalidPathException, AccessControlException, IOException
FileSystemMaster
resetFile
in interface FileSystemMaster
fileId
- the id of the fileUnexpectedAlluxioException
- if the file or directory can not be freedFileDoesNotExistException
- if the file does not existInvalidPathException
- if the path is invalid for the id of the fileAccessControlException
- if permission checking failsIOException
public void setAttribute(AlluxioURI path, SetAttributeOptions options) throws FileDoesNotExistException, AccessControlException, InvalidPathException, IOException
FileSystemMaster
This operation requires users to have WRITE permission on the path. In addition, the client user must be a super user when setting the owner, and must be a super user or the owner when setting the group or permission.
setAttribute
in interface FileSystemMaster
path
- the path to set attribute foroptions
- attributes to be set, see SetAttributeOptions
FileDoesNotExistException
- if the file does not existAccessControlException
- if permission checking failsInvalidPathException
- if the given path is invalidIOException
public void scheduleAsyncPersistence(AlluxioURI path) throws AlluxioException, UnavailableException
FileSystemMaster
scheduleAsyncPersistence
in interface FileSystemMaster
path
- the path of the file for persistenceAlluxioException
UnavailableException
public FileSystemCommand workerHeartbeat(long workerId, List<Long> persistedFiles, WorkerHeartbeatOptions options) throws FileDoesNotExistException, InvalidPathException, AccessControlException, IOException
FileSystemMaster
Needs WRITE permission on the list of files.
workerHeartbeat
in interface FileSystemMaster
workerId
- the id of the worker that heartbeatspersistedFiles
- the files that persisted on the workeroptions
- the method optionsFileDoesNotExistException
- if the file does not existInvalidPathException
- if the file path corresponding to the file id is invalidAccessControlException
- if permission checking failsIOException
public List<WorkerInfo> getWorkerInfoList() throws UnavailableException
getWorkerInfoList
in interface FileSystemMaster
WorkerInfo
objects representing the workers in AlluxioUnavailableException
public void updateUfsMode(AlluxioURI ufsPath, UnderFileSystem.UfsMode ufsMode) throws InvalidPathException, InvalidArgumentException, UnavailableException, AccessControlException
FileSystemMaster
updateUfsMode
in interface FileSystemMaster
ufsPath
- the physical ufs pathufsMode
- the ufs operation modeInvalidPathException
- if ufs path is not used by any mount pointInvalidArgumentException
- if arguments for the method are invalidUnavailableException
AccessControlException
public RpcContext createRpcContext() throws UnavailableException
UnavailableException
Copyright © 2023. All Rights Reserved.