com.sleepycat.je.dbi
Class SortedLSNTreeWalker
java.lang.Object
com.sleepycat.je.dbi.SortedLSNTreeWalker
public class SortedLSNTreeWalker
- extends Object
SortedLSNTreeWalker uses ordered disk access rather than random access to
iterate over a database tree. Faulting in data records by on-disk order can
provide much improved performance over faulting in by key order, since the
latter may require random access. SortedLSN walking does not obey cursor
and locking constraints, and therefore can only be guaranteed consistent for
a quiescent tree which is not being modified by user or daemon threads.
The class walks over the tree using sorted LSN fetching for parts of the
tree that are not in memory. Returns LSNs for each node in the tree
except the root IN, but in an arbitrary order (i.e. not key
order). The caller is responsible for getting the root IN's LSN explicitly.
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 INs from the INList that match the database being iterated over. For
each IN, all of the LSNs of the children are 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 processed, the list of
LSNs that were harvested is sorted.
Then 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dbImpl
protected DatabaseImpl dbImpl
accumulateLNs
protected boolean accumulateLNs
SortedLSNTreeWalker
public SortedLSNTreeWalker(DatabaseImpl dbImpl,
boolean setDbState,
long rootLsn,
SortedLSNTreeWalker.TreeNodeProcessor callback,
List<DatabaseException> savedExceptions,
SortedLSNTreeWalker.ExceptionPredicate excPredicate)
throws DatabaseException
- Throws:
DatabaseException
setProcessDupTree
void setProcessDupTree(boolean processDupTree)
setPassNullLSNNodes
void setPassNullLSNNodes(boolean passNullLSNNodes)
setAccumulateLNs
void setAccumulateLNs(boolean accumulateLNs)
walk
public void walk()
throws DatabaseException
- Find all non-resident nodes, and execute the callback. The root IN's
LSN is not returned to the callback.
- Throws:
DatabaseException
walkInternal
protected void walkInternal()
throws DatabaseException
- Throws:
DatabaseException
getRootIN
protected IN getRootIN(long rootLsn)
throws DatabaseException
- The default behavior fetches the rootIN from the log, but classes
extending this may fetch the root from the tree.
- Throws:
DatabaseException
getResidentRootIN
protected IN getResidentRootIN()
throws DatabaseException
- Throws:
DatabaseException
releaseRootIN
protected void releaseRootIN(IN ignore)
addToLsnINMap
protected void addToLsnINMap(Long lsn,
IN in,
int index)
- Parameters:
index
- a negative index signifies a DupCountLN.
fetchLSN
protected Node fetchLSN(long lsn,
DatabaseEntry lnKeyEntry)
throws FileNotFoundException,
DatabaseException
- Throws:
FileNotFoundException
DatabaseException
getSavedExceptions
public List<DatabaseException> getSavedExceptions()
Copyright (c) 2004-2010 Oracle. All rights reserved.