@InterfaceAudience.Private public class FileJournalManager extends Object implements JournalManager
| Modifier and Type | Class and Description |
|---|---|
static class |
FileJournalManager.EditLogFile
Record of an edit log that has been located and had its filename parsed.
|
JournalManager.CorruptionException| Constructor and Description |
|---|
FileJournalManager(Configuration conf,
Storage.StorageDirectory sd,
StorageErrorReporter errorReporter) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the journal manager, freeing any resources it may hold.
|
void |
finalizeLogSegment(long firstTxId,
long lastTxId)
Mark the log segment that spans from firstTxId to lastTxId
as finalized and complete.
|
void |
format(NamespaceInfo ns)
Format the underlying storage, removing any previously
stored data.
|
static FileJournalManager.EditLogFile |
getLogFile(File dir,
long startTxId) |
FileJournalManager.EditLogFile |
getLogFile(long startTxId) |
List<FileJournalManager.EditLogFile> |
getLogFiles(long fromTxId) |
List<RemoteEditLog> |
getRemoteEditLogs(long firstTxId,
boolean forReading,
boolean inProgressOk)
Find all editlog segments starting at or above the given txid.
|
Storage.StorageDirectory |
getStorageDirectory() |
boolean |
hasSomeData() |
static List<FileJournalManager.EditLogFile> |
matchEditLogs(File logDir)
returns matching edit logs via the log directory.
|
void |
purgeLogsOlderThan(long minTxIdToKeep)
Remove all edit logs with transaction IDs lower than the given transaction
ID.
|
void |
recoverUnfinalizedSegments()
Recover segments which have not been finalized.
|
void |
selectInputStreams(Collection<EditLogInputStream> streams,
long fromTxId,
boolean inProgressOk,
boolean forReading)
Get a list of edit log input streams.
|
void |
setOutputBufferCapacity(int size)
Set the amount of memory that this stream should use to buffer edits
|
EditLogOutputStream |
startLogSegment(long txid)
Begin writing to a new segment of the log stream, which starts at
the given transaction ID.
|
String |
toString() |
public FileJournalManager(Configuration conf, Storage.StorageDirectory sd, StorageErrorReporter errorReporter)
public void close()
throws IOException
JournalManagerclose in interface Closeableclose in interface AutoCloseableclose in interface JournalManagerIOExceptionpublic void format(NamespaceInfo ns) throws IOException
JournalManagerformat in interface JournalManagerIOExceptionpublic boolean hasSomeData()
hasSomeData in interface Storage.FormatConfirmablepublic EditLogOutputStream startLogSegment(long txid) throws IOException
JournalManagerstartLogSegment in interface JournalManagerIOExceptionpublic void finalizeLogSegment(long firstTxId,
long lastTxId)
throws IOException
JournalManagerfinalizeLogSegment in interface JournalManagerIOExceptionpublic Storage.StorageDirectory getStorageDirectory()
public void setOutputBufferCapacity(int size)
JournalManagersetOutputBufferCapacity in interface JournalManagerpublic void purgeLogsOlderThan(long minTxIdToKeep)
throws IOException
minTxIdToKeep - the lowest transaction ID that should be retainedIOException - in the event of errorpublic List<RemoteEditLog> getRemoteEditLogs(long firstTxId, boolean forReading, boolean inProgressOk) throws IOException
fromTxId - the txnid which to start lookingforReading - whether or not the caller intends to read from the edit
logsinProgressOk - whether or not to include the in-progress edit log
segmentIOException - if edit logs cannot be listed.public static List<FileJournalManager.EditLogFile> matchEditLogs(File logDir) throws IOException
logDir - directory to match edit logs inIOException - IOException thrown for invalid logDirpublic void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk, boolean forReading) throws IOException
fromTxId - the first transaction id we want to readinProgressOk - whether or not in-progress streams should be returnedforReading - whether or not the caller intends to read from the edit logsIOException - if the underlying storage has an error or is otherwise
inaccessiblepublic void recoverUnfinalizedSegments()
throws IOException
JournalManagerrecoverUnfinalizedSegments in interface JournalManagerIOExceptionpublic List<FileJournalManager.EditLogFile> getLogFiles(long fromTxId) throws IOException
IOExceptionpublic FileJournalManager.EditLogFile getLogFile(long startTxId) throws IOException
IOExceptionpublic static FileJournalManager.EditLogFile getLogFile(File dir, long startTxId) throws IOException
IOExceptionpublic String toString()
toString in interface Storage.FormatConfirmabletoString in class ObjectCopyright © 2013 Apache Software Foundation. All rights reserved.