com.sleepycat.je.log
Class ScavengerFileReader
java.lang.Object
com.sleepycat.je.log.FileReader
com.sleepycat.je.log.ScavengerFileReader
public abstract class ScavengerFileReader
- extends FileReader
A ScavengerFileReader reads the log backwards. If it encounters a checksum
error, it goes to the start of that log file and reads forward until it
encounters a checksum error. It then continues the reading backwards in the
log.
The caller may set "dumpCorruptedBounds" to true if information about the
start and finish of the corrupted portion should be displayed on stderr.
The caller is expected to implement processEntryCallback. This method is
called once for each entry that the ScavengerFileReader finds in the log.
Fields inherited from class com.sleepycat.je.log.FileReader |
cksumValidator, currentEntryHeader, currentEntryOffset, currentEntryPrevOffset, envImpl, eof, fileManager, forward, logger, nextEntryOffset, startLsn, window |
Constructor Summary |
ScavengerFileReader(EnvironmentImpl env,
int readBufferSize,
long startLsn,
long finishLsn,
long endOfFileLsn)
Create this reader to start at a given LSN. |
Methods inherited from class com.sleepycat.je.log.FileReader |
entryIsReplicated, getAndResetNReads, getLastEntrySize, getLastLsn, getNRepeatIteratorReads, getNumRead, initStartingPosition, makeWindow, readNextEntryAllowExceptions, setAlwaysValidateChecksum, setBackwardPosition, setForwardPosition, skipData, skipEntry, threadSafeBufferFlip, threadSafeBufferPosition, threadSafeBufferPosition |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ScavengerFileReader
public ScavengerFileReader(EnvironmentImpl env,
int readBufferSize,
long startLsn,
long finishLsn,
long endOfFileLsn)
throws DatabaseException
- Create this reader to start at a given LSN.
- Throws:
DatabaseException
setDumpCorruptedBounds
public void setDumpCorruptedBounds(boolean dumpCorruptedBounds)
- Set to true if corrupted boundaries should be dumped to stderr.
setTargetType
public void setTargetType(LogEntryType type)
- Tell the reader that we are interested in these kind of entries.
processEntry
protected boolean processEntry(ByteBuffer entryBuffer)
throws DatabaseException
- Description copied from class:
FileReader
- Each file reader implements this method to process the entry data.
- Specified by:
processEntry
in class FileReader
- Parameters:
entryBuffer
- contains the entry data and is positioned at the
data
- Returns:
- true if this entry should be returned
- Throws:
DatabaseException
processEntryCallback
protected abstract void processEntryCallback(LogEntry entry,
LogEntryType entryType)
throws DatabaseException
- Throws:
DatabaseException
readNextEntry
public boolean readNextEntry()
- Description copied from class:
FileReader
- Scans the log files until either it has reached the end of the log or
has hit an invalid portion.
- Overrides:
readNextEntry
in class FileReader
- Returns:
- true if an element has been read, false at end-of-log.
resyncReader
protected boolean resyncReader(long nextGoodRecordPostCorruption,
boolean showCorruptedBounds)
throws DatabaseException
- Overrides:
resyncReader
in class FileReader
- Throws:
DatabaseException
isTargetEntry
protected boolean isTargetEntry()
- Overrides:
isTargetEntry
in class FileReader
- Returns:
- true if this reader should process this entry, or just skip
over it.
Copyright (c) 2004-2012 Oracle. All rights reserved.