public class JournalSet extends Object implements JournalManager
JournalManager.CorruptionException
Modifier and Type | Field and Description |
---|---|
static Comparator<EditLogInputStream> |
EDIT_LOG_INPUT_STREAM_COMPARATOR |
Modifier and Type | Method and Description |
---|---|
static void |
chainAndMakeRedundantStreams(Collection<EditLogInputStream> outStreams,
PriorityQueue<EditLogInputStream> allStreams,
long fromTxId) |
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 nsInfo)
Format the underlying storage, removing any previously
stored data.
|
RemoteEditLogManifest |
getEditLogManifest(long fromTxId,
boolean forReading)
Return a manifest of what finalized edit logs are available.
|
boolean |
hasSomeData() |
boolean |
isEmpty()
Returns true if there are no journals, all redundant journals are disabled,
or any required journals are disabled.
|
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)
In this function, we get a bunch of streams from all of our JournalManager
objects.
|
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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toString
public static final Comparator<EditLogInputStream> EDIT_LOG_INPUT_STREAM_COMPARATOR
public void format(NamespaceInfo nsInfo) throws IOException
JournalManager
format
in interface JournalManager
IOException
public boolean hasSomeData() throws IOException
hasSomeData
in interface Storage.FormatConfirmable
IOException
- if the storage cannot be accessed at all.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 void close() throws IOException
JournalManager
close
in interface Closeable
close
in interface AutoCloseable
close
in interface JournalManager
IOException
public void selectInputStreams(Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk, boolean forReading) throws IOException
streams
- The collection to add the streams to. It may or
may not be sorted-- this is up to the caller.fromTxId
- The transaction ID to start looking for streams atinProgressOk
- Should we consider unfinalized streams?forReading
- Whether or not the caller intends to read from
the returned streams.IOException
- if the underlying storage has an error or is otherwise
inaccessiblepublic static void chainAndMakeRedundantStreams(Collection<EditLogInputStream> outStreams, PriorityQueue<EditLogInputStream> allStreams, long fromTxId)
public boolean isEmpty()
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 void recoverUnfinalizedSegments() throws IOException
JournalManager
recoverUnfinalizedSegments
in interface JournalManager
IOException
public RemoteEditLogManifest getEditLogManifest(long fromTxId, boolean forReading)
fromTxId
- Starting transaction id to read the logs.Copyright © 2013 Apache Software Foundation. All rights reserved.