@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
JournalManager
close
in interface Closeable
close
in interface AutoCloseable
close
in interface JournalManager
IOException
public void format(NamespaceInfo ns) throws IOException
JournalManager
format
in interface JournalManager
IOException
public boolean hasSomeData()
hasSomeData
in interface Storage.FormatConfirmable
public EditLogOutputStream startLogSegment(long txid) throws IOException
JournalManager
startLogSegment
in interface JournalManager
IOException
public void finalizeLogSegment(long firstTxId, long lastTxId) throws IOException
JournalManager
finalizeLogSegment
in interface JournalManager
IOException
public Storage.StorageDirectory getStorageDirectory()
public void setOutputBufferCapacity(int size)
JournalManager
setOutputBufferCapacity
in interface JournalManager
public 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
JournalManager
recoverUnfinalizedSegments
in interface JournalManager
IOException
public List<FileJournalManager.EditLogFile> getLogFiles(long fromTxId) throws IOException
IOException
public FileJournalManager.EditLogFile getLogFile(long startTxId) throws IOException
IOException
public static FileJournalManager.EditLogFile getLogFile(File dir, long startTxId) throws IOException
IOException
public String toString()
toString
in interface Storage.FormatConfirmable
toString
in class Object
Copyright © 2013 Apache Software Foundation. All rights reserved.