public final class EditLog extends Object
Constructor and Description |
---|
EditLog(String path,
boolean inactive,
long transactionId)
Create a new EditLog
|
Modifier and Type | Method and Description |
---|---|
void |
addBlock(int fileId,
int blockIndex,
long blockLength,
long opTimeMs)
Log an addBlock operation.
|
void |
addCheckpoint(int fileId,
long length,
TachyonURI checkpointPath,
long opTimeMs)
Log an addCheckpoint operation.
|
void |
close()
Close the log.
|
void |
completeFile(int fileId,
long opTimeMs)
Log a completeFile operation.
|
void |
createDependency(List<Integer> parents,
List<Integer> children,
String commandPrefix,
List<ByteBuffer> data,
String comment,
String framework,
String frameworkVersion,
DependencyType dependencyType,
int depId,
long creationTimeMs)
Log a createDependency operation.
|
void |
createFile(boolean recursive,
TachyonURI path,
boolean directory,
long blockSizeByte,
long creationTimeMs)
Log a createFile operation.
|
void |
createRawTable(int tableId,
int columns,
ByteBuffer metadata)
Log a createRawTable operation.
|
void |
delete(int fileId,
boolean recursive,
long opTimeMs)
Log a delete operation.
|
void |
deleteCompletedLogs(String path,
int upTo)
Delete the completed logs.
|
void |
flush()
Flush the log onto the storage.
|
Pair<Long,Long> |
getTransactionIds()
Get the current TransactionId and FlushedTransactionId
|
static long |
load(MasterInfo info,
String path,
int currentLogFileNum)
Load edit log.
|
static void |
loadSingleLog(MasterInfo info,
String path)
Load one edit log.
|
static void |
markUpToDate(String path)
Make the edit log up-to-date, It will delete all editlogs since sBackUpLogStartNum.
|
void |
rename(int fileId,
TachyonURI dstPath,
long opTimeMs)
Log a rename operation.
|
void |
rotateEditLog(String path)
The edit log reaches the max log size and needs rotate.
|
void |
setPinned(int fileId,
boolean pinned,
long opTimeMs)
Log a setPinned operation.
|
void |
updateRawTableMetadata(int tableId,
ByteBuffer metadata)
Log an updateRawTableMetadata operation.
|
public EditLog(String path, boolean inactive, long transactionId) throws IOException
path
- The path of the edit logs.inactive
- If a master is replaying an edit log, the current edit log is inactive.transactionId
- The beginning transactionId of the edit logIOException
public static long load(MasterInfo info, String path, int currentLogFileNum) throws IOException
info
- The Master Info.path
- The path of the edit logs.currentLogFileNum
- The smallest completed log number that this master has not loadedIOException
public static void loadSingleLog(MasterInfo info, String path) throws IOException
info
- The Master Infopath
- The path of the edit logIOException
public static void markUpToDate(String path)
path
- The path of the edit logspublic void addBlock(int fileId, int blockIndex, long blockLength, long opTimeMs)
fileId
- The id of the fileblockIndex
- The index of the block to be addedblockLength
- The length of the block to be addedopTimeMs
- The time of the addBlock operation, in millisecondspublic void addCheckpoint(int fileId, long length, TachyonURI checkpointPath, long opTimeMs)
fileId
- The file to add the checkpointlength
- The length of the checkpointcheckpointPath
- The path of the checkpointopTimeMs
- The time of the addCheckpoint operation, in millisecondspublic void close()
public void completeFile(int fileId, long opTimeMs)
fileId
- The id of the fileopTimeMs
- The time of the completeFile operation, in millisecondspublic void createDependency(List<Integer> parents, List<Integer> children, String commandPrefix, List<ByteBuffer> data, String comment, String framework, String frameworkVersion, DependencyType dependencyType, int depId, long creationTimeMs)
parents
- The input files' id of the dependencychildren
- The output files' id of the dependencycommandPrefix
- The prefix of the command used for recomputationdata
- The list of the data used for recomputationcomment
- The comment of the dependencyframework
- The framework of the dependency, used for recomputationframeworkVersion
- The version of the frameworkdependencyType
- The type of the dependency, DependencyType.Wide or DependencyType.NarrowdepId
- The id of the dependencycreationTimeMs
- The create time of the dependency, in millisecondspublic void createFile(boolean recursive, TachyonURI path, boolean directory, long blockSizeByte, long creationTimeMs)
recursive
- If recursive is true and the filesystem tree is not filled in all the way to
path yet, it fills in the missing components.path
- The path to createdirectory
- If true, creates an InodeFolder instead of an InodeblockSizeByte
- If it's a file, the block size for the InodecreationTimeMs
- The time the file was createdpublic void createRawTable(int tableId, int columns, ByteBuffer metadata)
tableId
- The id of the raw tablecolumns
- The number of columns in the tablemetadata
- Additional metadata about the tablepublic void delete(int fileId, boolean recursive, long opTimeMs)
fileId
- the file to be deleted.recursive
- whether delete the file recursively or not.opTimeMs
- The time of the delete operation, in millisecondspublic void deleteCompletedLogs(String path, int upTo)
path
- The path of the logsupTo
- The logs in the path from 0 to upTo-1 are completed and to be deletedpublic void flush()
public Pair<Long,Long> getTransactionIds()
public void rename(int fileId, TachyonURI dstPath, long opTimeMs)
fileId
- The id of the file to renamedstPath
- The new path of the fileopTimeMs
- The time of the rename operation, in millisecondspublic void rotateEditLog(String path)
path
- The path of the edit logpublic void setPinned(int fileId, boolean pinned, long opTimeMs)
fileId
- The id of the filepinned
- If true, the file is never evicted from memoryopTimeMs
- The time of the setPinned operation, in millisecondspublic void updateRawTableMetadata(int tableId, ByteBuffer metadata)
tableId
- The id of the raw tablemetadata
- The new metadata of the raw tableCopyright © 2015. All Rights Reserved.