com.sleepycat.je.log
Class CleanerFileReader

java.lang.Object
  extended by com.sleepycat.je.log.FileReader
      extended by com.sleepycat.je.log.CleanerFileReader

public class CleanerFileReader
extends FileReader

CleanerFileReader scans log files for INs and LNs.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sleepycat.je.log.FileReader
FileReader.EOFException, FileReader.ReadWindow
 
Field Summary
 
Fields inherited from class com.sleepycat.je.log.FileReader
cksumValidator, currentEntryHeader, currentEntryOffset, currentEntryPrevOffset, envImpl, eof, fileManager, forward, logger, nextEntryOffset, startLsn, window
 
Constructor Summary
CleanerFileReader(EnvironmentImpl env, int readBufferSize, long startLsn, Long fileNum, FileSummary fileSummary, INSummary inSummary)
          Create this reader to start at a given LSN.
 
Method Summary
 void countObsolete()
          Records the current log entry as obsolete in the FileSummary used to count true utilization.
 BINDelta getBINDelta()
           
 DatabaseId getDatabaseId()
          Get the last databaseId seen by the reader.
 FileHeader getFileHeader()
           
 IN getIN(DatabaseImpl dbImpl)
          Get the last entry seen by the reader as an IN.
 VLSN getLastVLSN()
          Returns the last VLSN encountered, or NULL_VLSN if no entries were replicated.
 LNLogEntry getLNLogEntry()
          Get the last LN log entry seen by the reader.
 boolean isBINDelta()
           
 boolean isDbTree()
           
 boolean isFileHeader()
           
 boolean isIN()
           
 boolean isLN()
           
 boolean isLNDeleted()
           
protected  boolean processEntry(ByteBuffer entryBuffer)
          Process the header to track the last VLSN and count true utilization.
 
Methods inherited from class com.sleepycat.je.log.FileReader
entryIsReplicated, getAndResetNReads, getLastEntrySize, getLastLsn, getNRepeatIteratorReads, getNumRead, initStartingPosition, isTargetEntry, makeWindow, readNextEntry, readNextEntryAllowExceptions, resyncReader, 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
 

Constructor Detail

CleanerFileReader

public CleanerFileReader(EnvironmentImpl env,
                         int readBufferSize,
                         long startLsn,
                         Long fileNum,
                         FileSummary fileSummary,
                         INSummary inSummary)
                  throws DatabaseException
Create this reader to start at a given LSN.

Parameters:
env - The relevant EnvironmentImpl.
readBufferSize - buffer size in bytes for reading in log.
startLsn - where to start in the log, or null for the beginning.
fileNum - single file number.
fileSummary - returns true utilization.
inSummary - returns IN utilization.
Throws:
DatabaseException
Method Detail

processEntry

protected boolean processEntry(ByteBuffer entryBuffer)
                        throws DatabaseException
Process the header to track the last VLSN and count true utilization. Then read the entry and return true if the LogEntryType is of interest. We don't override isTargetEntry so it always returns true and we can count utilization correctly here in processEntry. We call getLastLsn to count utilization and this is not allowed from isTargetEntry.

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

countObsolete

public void countObsolete()
Records the current log entry as obsolete in the FileSummary used to count true utilization.


isIN

public boolean isIN()
Returns:
true if the last entry was an IN.

isBINDelta

public boolean isBINDelta()
Returns:
true if the last entry was an BINDelta.

isLN

public boolean isLN()
Returns:
true if the last entry was a LN.

isDbTree

public boolean isDbTree()
Returns:
true if the last entry was a DbTree entry.

isFileHeader

public boolean isFileHeader()

getLNLogEntry

public LNLogEntry getLNLogEntry()
Get the last LN log entry seen by the reader. Note that LNLogEntry.postFetchInit must be called before calling certain LNLogEntry methods.


isLNDeleted

public boolean isLNDeleted()

getIN

public IN getIN(DatabaseImpl dbImpl)
Get the last entry seen by the reader as an IN.


getBINDelta

public BINDelta getBINDelta()

getFileHeader

public FileHeader getFileHeader()

getDatabaseId

public DatabaseId getDatabaseId()
Get the last databaseId seen by the reader.


getLastVLSN

public VLSN getLastVLSN()
Returns the last VLSN encountered, or NULL_VLSN if no entries were replicated.



Copyright (c) 2004-2012 Oracle. All rights reserved.