com.sleepycat.je.log
Class INFileReader

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

public class INFileReader
extends FileReader

INFileReader supports recovery by scanning log files during the IN rebuild pass. It looks for internal nodes (all types), segregated by whether they belong to the main tree or the duplicate trees.

This file reader can also be run in tracking mode to keep track of the maximum node id, database id and txn id seen so those sequences can be updated properly at recovery. In this mode it also performs utilization counting. It is only run once in tracking mode per recovery, in the first phase of recovery.


Field Summary
 
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
INFileReader(EnvironmentImpl env, int readBufferSize, long startLsn, long finishLsn, boolean trackIds, boolean mapDbOnly, long partialCkptStart, Map fileSummaryLsns)
          Create this reader to start at a given LSN.
 
Method Summary
 void addTargetType(LogEntryType entryType)
          Configure this reader to target this kind of entry.
 DatabaseId getDatabaseId()
          Get the last databaseId seen by the reader.
 byte[] getDeletedIdKey()
          Get the deleted id key stored in the last delete info log entry.
 long getDeletedNodeId()
          Get the deleted node id stored in the last delete info log entry.
 byte[] getDupDeletedDupKey()
          Get the deleted main key stored in the last delete info log entry.
 byte[] getDupDeletedMainKey()
          Get the deleted main key stored in the last delete info log entry.
 long getDupDeletedNodeId()
          Get the deleted node id stored in the last delete info log entry.
 IN getIN()
          Get the last IN seen by the reader.
 LogEntryType getLogEntryType()
          Get the current log entry type.
 long getLsnOfIN()
          Get the LSN that should represent this IN.
 int getMaxDbId()
          Get the maximum db id seen by the reader.
 long getMaxNodeId()
          Get the maximum node id seen by the reader.
 long getMaxTxnId()
          Get the maximum txn id seen by the reader.
 boolean isDeleteInfo()
           
 boolean isDupDeleteInfo()
           
protected  boolean isTargetEntry(byte entryTypeNum, byte entryTypeVersion)
          If we're tracking node, database and txn ids, we want to see all node log entries.
protected  boolean processEntry(ByteBuffer entryBuffer)
          This reader looks at all nodes for the max node id and database id.
 
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
 

Constructor Detail

INFileReader

public INFileReader(EnvironmentImpl env,
                    int readBufferSize,
                    long startLsn,
                    long finishLsn,
                    boolean trackIds,
                    boolean mapDbOnly,
                    long partialCkptStart,
                    Map fileSummaryLsns)
             throws IOException,
                    DatabaseException
Create this reader to start at a given LSN.

Throws:
IOException
DatabaseException
Method Detail

addTargetType

public void addTargetType(LogEntryType entryType)
                   throws DatabaseException
Configure this reader to target this kind of entry.

Throws:
DatabaseException

isTargetEntry

protected boolean isTargetEntry(byte entryTypeNum,
                                byte entryTypeVersion)
                         throws DatabaseException
If we're tracking node, database and txn ids, we want to see all node log entries. If not, we only want to see IN entries.

Overrides:
isTargetEntry in class FileReader
Returns:
true if this is an IN entry.
Throws:
DatabaseException

processEntry

protected boolean processEntry(ByteBuffer entryBuffer)
                        throws DatabaseException
This reader looks at all nodes for the max node id and database id. It only returns non-provisional INs and IN delete entries.

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

getIN

public IN getIN()
         throws DatabaseException
Get the last IN seen by the reader.

Throws:
DatabaseException

getDatabaseId

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


getMaxNodeId

public long getMaxNodeId()
Get the maximum node id seen by the reader.


getMaxDbId

public int getMaxDbId()
Get the maximum db id seen by the reader.


getMaxTxnId

public long getMaxTxnId()
Get the maximum txn id seen by the reader.


isDeleteInfo

public boolean isDeleteInfo()
Returns:
true if the last entry was a delete info entry.

isDupDeleteInfo

public boolean isDupDeleteInfo()
Returns:
true if the last entry was a dup delete info entry.

getDeletedNodeId

public long getDeletedNodeId()
Get the deleted node id stored in the last delete info log entry.


getDeletedIdKey

public byte[] getDeletedIdKey()
Get the deleted id key stored in the last delete info log entry.


getDupDeletedNodeId

public long getDupDeletedNodeId()
Get the deleted node id stored in the last delete info log entry.


getDupDeletedMainKey

public byte[] getDupDeletedMainKey()
Get the deleted main key stored in the last delete info log entry.


getDupDeletedDupKey

public byte[] getDupDeletedDupKey()
Get the deleted main key stored in the last delete info log entry.


getLsnOfIN

public long getLsnOfIN()
Get the LSN that should represent this IN. For most INs, it's the LSN that was just read. For BINDelta entries, it's the LSN of the last full version.


getLogEntryType

public LogEntryType getLogEntryType()
Get the current log entry type.



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