public class RecoveryManager extends Object implements RecoveryManagerMXBean
Manages the recovery process during Persistit startup. This method is called every time Persistit starts up, even if the previous shutdown was normal.
Find the most recent valid journal file. This is the "keystone" journal file because everything will be based on its content. Read its JH (JournalHeader) record. Validate all fields in the JH.
Read the records in the keystone journal file. Included are IV, PM and TM records that provide an initial load of the pageMap, liveTransactionMap and volume/handle maps for JournalManager. Included also is a keystone CP (checkpoint) record; the presence of a CP record indicates that the IV, PM and TM records constitute a complete checkpoint of the journal to the specified timestamp. Absence of a CP before the scan terminates indicates that the journal file is not a complete snapshot, and therefore the chosen keystone journal file is not valid. In this event, restart Phase 1 using the immediate predecessor file.
During this phase, build a transaction map containing the timestamp and file address of every transaction that had not committed before the last valid checkpoint. The scan stops when recovery finds a JE "journal end" record, end-of-file or an invalid record. The presence of a valid JE record indicates a clean shutdown.
Finally, after processing the keystone journal file, validate all other required journal files. For each journal files from base address to current address, read its JH records, verify contiguity (same creation timestamp), verify that the page image and transaction records closest to the end of that journal file (if there are any) can be read. This last step is a plausibility test to make sure each required journal file is present, readable, and long enough to support recovery. This step does not test for data corruption within the journal since doing so would require a significant amount of additional I/O.
Executed after the buffer pools have been loaded and the journal manager has been instantiated. This step applies every committed transaction in the transaction map and prunes the MVV values for every uncommitted transaction in the transaction map.
Transactions are applied in their commit timestamp ordering so that their affect on the recovered database is consistent with their original serial order. A checkpoint at timestamp T indicates that all pages made dirty prior to T have been written to the journal; therefore any transaction with a commit timestamp before T does not need to be reapplied because its effects are already present in the recovered B-Trees.
This class is not threadsafe; it is intended to be called only during the single-threaded recovery process.
MXBEAN_NAME
Modifier and Type | Method and Description |
---|---|
void |
applyAllRecoveredTransactions(com.persistit.TransactionPlayer.TransactionPlayerListener commitListener,
com.persistit.TransactionPlayer.TransactionPlayerListener rollbackListener) |
void |
buildRecoveryPlan() |
int |
getAppliedTransactionCount() |
long |
getBaseAddress() |
long |
getBlockSize() |
int |
getCommittedCount() |
com.persistit.TransactionPlayer.TransactionPlayerListener |
getDefaultCommitListener() |
com.persistit.TransactionPlayer.TransactionPlayerListener |
getDefaultRollbackListener() |
int |
getErrorCount() |
long |
getJournalCreatedTime() |
String |
getJournalFilePath() |
long |
getKeystoneAddress() |
CheckpointManager.Checkpoint |
getLastValidCheckpoint() |
long |
getLastValidCheckpointAddress() |
long |
getLastValidCheckpointTimestamp() |
int |
getPageMapSize() |
long |
getRecoveryEndedAddress() |
String |
getRecoveryEndedException() |
int |
getTransactionMapSize() |
int |
getUncommittedCount() |
void |
init(String path) |
Volume |
lookupVolumeHandle(int handle) |
static void |
main(String[] args)
Read and display information about a journal.
|
void |
setDefaultCommitListener(com.persistit.TransactionPlayer.TransactionPlayerListener listener) |
void |
setDefaultRollbackListener(com.persistit.TransactionPlayer.TransactionPlayerListener listener) |
String |
toString() |
public void init(String path) throws PersistitException
PersistitException
public String getJournalFilePath()
getJournalFilePath
in interface RecoveryManagerMXBean
public int getCommittedCount()
getCommittedCount
in interface RecoveryManagerMXBean
public int getUncommittedCount()
getUncommittedCount
in interface RecoveryManagerMXBean
public int getAppliedTransactionCount()
getAppliedTransactionCount
in interface RecoveryManagerMXBean
public int getErrorCount()
getErrorCount
in interface RecoveryManagerMXBean
public CheckpointManager.Checkpoint getLastValidCheckpoint()
public long getLastValidCheckpointTimestamp()
getLastValidCheckpointTimestamp
in interface RecoveryManagerMXBean
public long getLastValidCheckpointAddress()
getLastValidCheckpointAddress
in interface RecoveryManagerMXBean
public String getRecoveryEndedException()
getRecoveryEndedException
in interface RecoveryManagerMXBean
public long getRecoveryEndedAddress()
getRecoveryEndedAddress
in interface RecoveryManagerMXBean
public long getKeystoneAddress()
getKeystoneAddress
in interface RecoveryManagerMXBean
public long getBaseAddress()
getBaseAddress
in interface RecoveryManagerMXBean
public long getBlockSize()
getBlockSize
in interface RecoveryManagerMXBean
public long getJournalCreatedTime()
getJournalCreatedTime
in interface RecoveryManagerMXBean
public int getTransactionMapSize()
getTransactionMapSize
in interface RecoveryManagerMXBean
public int getPageMapSize()
getPageMapSize
in interface RecoveryManagerMXBean
public com.persistit.TransactionPlayer.TransactionPlayerListener getDefaultCommitListener()
public void setDefaultCommitListener(com.persistit.TransactionPlayer.TransactionPlayerListener listener)
public com.persistit.TransactionPlayer.TransactionPlayerListener getDefaultRollbackListener()
public void setDefaultRollbackListener(com.persistit.TransactionPlayer.TransactionPlayerListener listener)
public Volume lookupVolumeHandle(int handle)
public void buildRecoveryPlan() throws PersistitIOException, PersistitInterruptedException
public void applyAllRecoveredTransactions(com.persistit.TransactionPlayer.TransactionPlayerListener commitListener, com.persistit.TransactionPlayer.TransactionPlayerListener rollbackListener) throws TestException
TestException
Copyright © 2025 Open Identity Platform Community. All rights reserved.