public class SortedLSNTreeWalker
extends java.lang.Object
A callback function specified in the constructor is executed for each LSN found.
The walker works in two phases. The first phase is to gather and return all the resident INs using the roots that were specified when the SLTW was constructed. For each child of each root, if the child is resident it is passed to the callback method (processLSN). If the child was not in memory, it is added to a list of LSNs to read. When all of the in-memory INs have been passed to the callback for all LSNs collected, phase 1 is complete.
In phase 2, for each of the sorted LSNs, the target is fetched, the type determined, and the LSN and type passed to the callback method for processing. LSNs of the children of those nodes are retrieved and the process repeated until there are no more nodes to be fetched for this database's tree. LSNs are accumlated in batches in this phase so that memory consumption is not excessive. For instance, if batches were not used then the LSNs of all of the BINs would need to be held in memory.
Modifier and Type | Class and Description |
---|---|
static class |
SortedLSNTreeWalker.DeltaINEntry
Supplements INEntry with BINDelta information.
|
static interface |
SortedLSNTreeWalker.ExceptionPredicate |
static class |
SortedLSNTreeWalker.INEntry |
static interface |
SortedLSNTreeWalker.TreeNodeProcessor |
Modifier and Type | Field and Description |
---|---|
protected boolean |
accumulateDupLNs |
protected boolean |
accumulateLNs |
protected DatabaseImpl[] |
dbImpls |
protected EnvironmentImpl |
envImpl |
Constructor and Description |
---|
SortedLSNTreeWalker(DatabaseImpl[] dbImpls,
boolean setDbState,
long[] rootLsns,
SortedLSNTreeWalker.TreeNodeProcessor callback,
java.util.List<DatabaseException> savedExceptions,
SortedLSNTreeWalker.ExceptionPredicate excPredicate) |
Modifier and Type | Method and Description |
---|---|
protected void |
accumulateLSNs(IN in,
LSNAccumulator pendingLSNs) |
protected void |
callProcessLSNHandleExceptions(long childLSN,
LogEntryType childType,
Node theNode,
byte[] lnKey) |
protected boolean |
fetchAndInsertIntoTree() |
protected Node |
fetchLSN(long lsn,
DatabaseEntry lnKeyEntry,
LSNAccumulator pendingLSNs) |
protected IN |
getOrFetchRootIN(DatabaseImpl dbImpl,
long rootLsn)
Returns the root IN, latched shared.
|
protected IN |
getResidentRootIN(DatabaseImpl dbImpl)
The default behavior returns (and latches shared) the IN if it is
resident in the Btree, or null otherwise.
|
protected IN |
getRootIN(DatabaseImpl dbImpl,
long rootLsn)
The default behavior fetches the rootIN from the log and latches it
shared.
|
java.util.List<DatabaseException> |
getSavedExceptions() |
(package private) void |
incInternalMemoryUsage(long increment) |
protected void |
processAccumulatedLSNs(LSNAccumulator pendingLSNs) |
protected void |
processResidentChild(long lsn,
Node node,
byte[] lnKey,
LSNAccumulator pendingLSNs) |
protected void |
releaseRootIN(IN root)
Release the latch.
|
(package private) void |
setInternalMemoryLimit(long internalMemoryLimit) |
(package private) void |
setLSNBatchSize(long lsnBatchSize) |
void |
walk()
Find all non-resident nodes, and execute the callback.
|
protected void |
walkInternal() |
protected final DatabaseImpl[] dbImpls
protected final EnvironmentImpl envImpl
protected boolean accumulateLNs
protected boolean accumulateDupLNs
public SortedLSNTreeWalker(DatabaseImpl[] dbImpls, boolean setDbState, long[] rootLsns, SortedLSNTreeWalker.TreeNodeProcessor callback, java.util.List<DatabaseException> savedExceptions, SortedLSNTreeWalker.ExceptionPredicate excPredicate) throws DatabaseException
DatabaseException
void setLSNBatchSize(long lsnBatchSize)
void setInternalMemoryLimit(long internalMemoryLimit)
void incInternalMemoryUsage(long increment)
public void walk() throws DatabaseException
DatabaseException
protected void walkInternal() throws DatabaseException
DatabaseException
protected void processAccumulatedLSNs(LSNAccumulator pendingLSNs)
protected void accumulateLSNs(IN in, LSNAccumulator pendingLSNs) throws DatabaseException
DatabaseException
protected void processResidentChild(long lsn, Node node, byte[] lnKey, LSNAccumulator pendingLSNs)
protected void callProcessLSNHandleExceptions(long childLSN, LogEntryType childType, Node theNode, byte[] lnKey)
protected IN getOrFetchRootIN(DatabaseImpl dbImpl, long rootLsn)
protected IN getRootIN(DatabaseImpl dbImpl, long rootLsn)
protected IN getResidentRootIN(DatabaseImpl dbImpl)
protected void releaseRootIN(IN root)
protected Node fetchLSN(long lsn, DatabaseEntry lnKeyEntry, LSNAccumulator pendingLSNs) throws java.io.FileNotFoundException, DatabaseException
java.io.FileNotFoundException
DatabaseException
protected boolean fetchAndInsertIntoTree()
public java.util.List<DatabaseException> getSavedExceptions()
Copyright (c) 2004-2012 Oracle. All rights reserved.