com.sleepycat.je.log
Class LNFileReader

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

public class LNFileReader
extends FileReader

LNFileReader scans log files for LNs. Also, if it's going backwards for the undo phase in recovery, it reads transaction commit entries.


Field Summary
protected  Map targetEntryMap
           
protected  LogEntry targetLogEntry
           
 
Fields inherited from class com.sleepycat.je.log.FileReader
anticipateChecksumErrors, cksumValidator, currentEntryChecksum, currentEntryOffset, currentEntryPrevOffset, currentEntrySize, currentEntryTypeNum, currentEntryTypeVersion, env, eof, fileManager, nextEntryOffset, readBufferFileEnd, readBufferFileNum, readBufferFileStart, startLsn
 
Constructor Summary
LNFileReader(EnvironmentImpl env, int readBufferSize, long startLsn, boolean redo, long endOfFileLsn, long finishLsn, Long singleFileNum)
          Create this reader to start at a given LSN.
 
Method Summary
 void addTargetType(LogEntryType entryType)
           
 boolean getAbortKnownDeleted()
          Get last abort known deleted seen by the reader.
 long getAbortLsn()
          Get last abort LSN seen by the reader (may be null).
 DatabaseId getDatabaseId()
          Get the last databaseId seen by the reader.
 byte[] getDupTreeKey()
          Get the last key seen by the reader.
 byte[] getKey()
          Get the last key seen by the reader.
 LN getLN()
          Get the last LN seen by the reader.
 long getNodeId()
          Get node id of current LN.
 long getTxnAbortId()
          Get the last txn abort id seen by the reader.
 long getTxnCommitId()
          Get the last txn commit id seen by the reader.
 Long getTxnId()
           
 long getTxnPrepareId()
          Get the last txn prepare id seen by the reader.
 Xid getTxnPrepareXid()
          Get the last txn prepare Xid seen by the reader.
 boolean isAbort()
           
 boolean isLN()
           
 boolean isPrepare()
           
protected  boolean isTargetEntry(byte entryTypeNum, byte entryTypeVersion)
           
protected  boolean processEntry(ByteBuffer entryBuffer)
          This reader instantiates an LN and key for every LN entry.
 
Methods inherited from class com.sleepycat.je.log.FileReader
getLastLsn, getNRepeatIteratorReads, getNumRead, initStartingPosition, readNextEntry, resyncReader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

targetEntryMap

protected Map targetEntryMap

targetLogEntry

protected LogEntry targetLogEntry
Constructor Detail

LNFileReader

public LNFileReader(EnvironmentImpl env,
                    int readBufferSize,
                    long startLsn,
                    boolean redo,
                    long endOfFileLsn,
                    long finishLsn,
                    Long singleFileNum)
             throws IOException,
                    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
redo - If false, we're going to go forward from the start LSN to the end of the log. If true, we're going backwards from the end of the log to the start LSN.
endOfFileLsn - the virtual LSN that marks the end of the log. (The one off the end of the log). Only used if we're reading backwards. Different from the startLsn because the startLsn tells us where the beginning of the start entry is, but not the length/end of the start entry. May be null if we're going foward.
finishLsn - the last LSN to read in the log. May be null if we want to read to the end of the log.
Throws:
IOException
DatabaseException
Method Detail

addTargetType

public void addTargetType(LogEntryType entryType)
                   throws DatabaseException
Throws:
DatabaseException

isTargetEntry

protected boolean isTargetEntry(byte entryTypeNum,
                                byte entryTypeVersion)
Overrides:
isTargetEntry in class FileReader
Returns:
true if this is a transactional LN or Locker Commit entry.

processEntry

protected boolean processEntry(ByteBuffer entryBuffer)
                        throws DatabaseException
This reader instantiates an LN and key for every LN entry.

Specified by:
processEntry in class FileReader
Returns:
true if this entry should be returned
Throws:
DatabaseException

isLN

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

getLN

public LN getLN()
Get the last LN seen by the reader.


getDatabaseId

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


getKey

public byte[] getKey()
Get the last key seen by the reader.


getDupTreeKey

public byte[] getDupTreeKey()
Get the last key seen by the reader.


getTxnId

public Long getTxnId()
Returns:
the transaction id of the current entry.

isPrepare

public boolean isPrepare()

getTxnPrepareId

public long getTxnPrepareId()
Get the last txn prepare id seen by the reader.


getTxnPrepareXid

public Xid getTxnPrepareXid()
Get the last txn prepare Xid seen by the reader.


isAbort

public boolean isAbort()

getTxnAbortId

public long getTxnAbortId()
Get the last txn abort id seen by the reader.


getTxnCommitId

public long getTxnCommitId()
Get the last txn commit id seen by the reader.


getNodeId

public long getNodeId()
Get node id of current LN.


getAbortLsn

public long getAbortLsn()
Get last abort LSN seen by the reader (may be null).


getAbortKnownDeleted

public boolean getAbortKnownDeleted()
Get last abort known deleted seen by the reader.



Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.