java.io.Closeable, java.lang.AutoCloseable, Storage.FormatConfirmable, JournalManager@Private public class JournalSet extends java.lang.Object implements JournalManager
JournalManager.CorruptionException| Modifier and Type | Field | Description |
|---|---|---|
static java.util.Comparator<EditLogInputStream> |
EDIT_LOG_INPUT_STREAM_COMPARATOR |
| Modifier and Type | Method | Description |
|---|---|---|
boolean |
canRollBack(StorageInfo storage,
StorageInfo prevStorage,
int targetLayoutVersion) |
Return true if this JM can roll back to the previous storage state, false
otherwise.
|
static void |
chainAndMakeRedundantStreams(java.util.Collection<EditLogInputStream> outStreams,
java.util.PriorityQueue<EditLogInputStream> allStreams,
long fromTxId) |
|
void |
close() |
Close the journal manager, freeing any resources it may hold.
|
void |
discardSegments(long startTxId) |
Discard the segments whose first txid is >= the given txid.
|
void |
doFinalize() |
Finalize the upgrade.
|
void |
doPreUpgrade() |
Perform any steps that must succeed across all JournalManagers involved in
an upgrade before proceeding onto the actual upgrade stage.
|
void |
doRollback() |
Perform the rollback to the previous FS state.
|
void |
doUpgrade(Storage storage) |
Perform the actual upgrade of the JM.
|
void |
finalizeLogSegment(long firstTxId,
long lastTxId) |
Mark the log segment that spans from firstTxId to lastTxId
as finalized and complete.
|
void |
format(NamespaceInfo nsInfo,
boolean force) |
Format the underlying storage, removing any previously
stored data.
|
RemoteEditLogManifest |
getEditLogManifest(long fromTxId) |
Return a manifest of what finalized edit logs are available.
|
long |
getJournalCTime() |
|
boolean |
hasSomeData() |
|
boolean |
isEmpty() |
Returns true if there are no journals, all redundant journals are disabled,
or any required journals are disabled.
|
boolean |
isOpen() |
|
void |
purgeLogsOlderThan(long minTxIdToKeep) |
|
void |
recoverUnfinalizedSegments() |
Recover segments which have not been finalized.
|
void |
selectInputStreams(java.util.Collection<EditLogInputStream> streams,
long fromTxId,
boolean inProgressOk,
boolean onlyDurableTxns) |
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,
int layoutVersion) |
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, waittoStringpublic static final java.util.Comparator<EditLogInputStream> EDIT_LOG_INPUT_STREAM_COMPARATOR
public void format(NamespaceInfo nsInfo, boolean force) throws java.io.IOException
JournalManagerformat in interface JournalManagerjava.io.IOExceptionpublic boolean hasSomeData()
throws java.io.IOException
hasSomeData in interface Storage.FormatConfirmablejava.io.IOException - if the storage cannot be accessed at all.public EditLogOutputStream startLogSegment(long txId, int layoutVersion) throws java.io.IOException
JournalManagerstartLogSegment in interface JournalManagerjava.io.IOExceptionpublic void finalizeLogSegment(long firstTxId,
long lastTxId)
throws java.io.IOException
JournalManagerfinalizeLogSegment in interface JournalManagerjava.io.IOExceptionpublic void close()
throws java.io.IOException
JournalManagerclose in interface java.lang.AutoCloseableclose in interface java.io.Closeableclose in interface JournalManagerjava.io.IOExceptionpublic boolean isOpen()
public void selectInputStreams(java.util.Collection<EditLogInputStream> streams, long fromTxId, boolean inProgressOk, boolean onlyDurableTxns)
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?onlyDurableTxns - Set to true if streams are bounded by the durable
TxId. A durable TxId is the committed txid in QJM
or the largest txid written into file in FJMpublic static void chainAndMakeRedundantStreams(java.util.Collection<EditLogInputStream> outStreams, java.util.PriorityQueue<EditLogInputStream> allStreams, long fromTxId)
public boolean isEmpty()
public void setOutputBufferCapacity(int size)
JournalManagersetOutputBufferCapacity in interface JournalManagerpublic void purgeLogsOlderThan(long minTxIdToKeep)
throws java.io.IOException
java.io.IOExceptionpublic void recoverUnfinalizedSegments()
throws java.io.IOException
JournalManagerrecoverUnfinalizedSegments in interface JournalManagerjava.io.IOExceptionpublic RemoteEditLogManifest getEditLogManifest(long fromTxId)
fromTxId - Starting transaction id to read the logs.public void doPreUpgrade()
throws java.io.IOException
JournalManagerdoPreUpgrade in interface JournalManagerjava.io.IOExceptionpublic void doUpgrade(Storage storage) throws java.io.IOException
JournalManagerdoUpgrade in interface JournalManagerstorage - info about the new upgraded versions.java.io.IOExceptionpublic void doFinalize()
throws java.io.IOException
JournalManagerdoFinalize in interface JournalManagerjava.io.IOExceptionpublic boolean canRollBack(StorageInfo storage, StorageInfo prevStorage, int targetLayoutVersion) throws java.io.IOException
JournalManagercanRollBack in interface JournalManagerstorage - the storage info for the current stateprevStorage - the storage info for the previous (unupgraded) statetargetLayoutVersion - the layout version we intend to roll back tojava.io.IOExceptionpublic void doRollback()
throws java.io.IOException
JournalManagerdoRollback in interface JournalManagerjava.io.IOExceptionpublic void discardSegments(long startTxId)
throws java.io.IOException
JournalManagerdiscardSegments in interface JournalManagerstartTxId - The given txid should be right at the segment boundary,
i.e., it should be the first txid of some segment, if segment corresponding
to the txid exists.java.io.IOExceptionpublic long getJournalCTime()
throws java.io.IOException
getJournalCTime in interface JournalManagerjava.io.IOExceptionCopyright © 2008–2025 Apache Software Foundation. All rights reserved.