com.sleepycat.je.dbi
Class DiskOrderedCursorImpl
java.lang.Object
com.sleepycat.je.dbi.DiskOrderedCursorImpl
- All Implemented Interfaces:
- EnvConfigObserver
public class DiskOrderedCursorImpl
- extends Object
- implements EnvConfigObserver
This class implements the DiskOrderedCursor. When an instance is
constructed, a Producer Thread is created which runs a SortedLSNTreeWalker
against the DiskOrderedCursor's Database. The callback for the SLTW takes
Nodes that are passed to it, filters them appropriately (e.g. if the
DiskOrderedCursor is configured for keysOnly, it takes the keys from the
nodes, but not the data), and then puts those entries on a BlockingQueue
which is shared between the Producer Thread and the application thread.
When the application calls getNext(), it simply takes an entry off the queue
and hands it to the caller. The entries on the queue are simple KeyAndData
structs which hold byte[]'s for the key (and optional) data. A special
instance of KeyAndData is used to indicate that the cursor scan has
finished.
Because SLTW doesn't really handle concurrent operations very well,
DiskOrderedCursor assume a relatively loose set of consistency guarantees,
which are in fact, even looser than dirty-read (READ_UNCOMMITTED) semantics.
To wit:
The records returned by the scan correspond to the state of the data set at
the beginning of the scan, plus some but not all changes made by the
application after the start of the scan. The user should not rely on the
scan returning any changes made after the start of the scan.
As with a READ_UNCOMMITTED scan, changes made by all transactions,
including uncommitted transactions, may be returned by the scan. Also, a
record returned by the scan is not locked, and may be modified or deleted
by the application after it is returned, including modification or deletion
of the record at the cursor position.
If a transactionally correct data set is required, the application must
ensure that all transactions that write to the key range are committed
before the beginning of the scan, and that during the scan no records in
the key range of the scan are inserted, deleted, or modified.
If the cleaner is operating concurrently with the SLTW, then it is possible
for a file to be deleted and a not-yet-processed LSN (i.e. one which has not
yet been returned to the user) might be pointing to that deleted file.
Therefore, we must disable file deletion (but not cleaner operation) during
the DOS.
Operations on DiskOrderedCursorImpls are re-entrant.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DiskOrderedCursorImpl
public DiskOrderedCursorImpl(DatabaseImpl dbImpl,
DiskOrderedCursorConfig config)
throws DatabaseException
- Throws:
DatabaseException
envConfigUpdate
public void envConfigUpdate(DbConfigManager cm,
EnvironmentMutableConfig ignore)
throws DatabaseException
- Process notifications of mutable property changes.
- Specified by:
envConfigUpdate
in interface EnvConfigObserver
- Throws:
IllegalArgumentException
- via Environment ctor and
setMutableConfig.
DatabaseException
isClosed
public boolean isClosed()
close
public void close()
checkEnv
public void checkEnv()
getCurrent
public OperationStatus getCurrent(DatabaseEntry foundKey,
DatabaseEntry foundData)
getNext
public OperationStatus getNext(DatabaseEntry foundKey,
DatabaseEntry foundData)
Copyright (c) 2004-2012 Oracle. All rights reserved.