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.


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
INFileReader(EnvironmentImpl env, int readBufferSize, long startLsn, long finishLsn, boolean trackIds, boolean mapDbOnly, long partialCkptStart, long ckptEnd, RecoveryUtilizationTracker tracker)
          Create this reader to start at a given LSN.
INFileReader(EnvironmentImpl env, int readBufferSize, long startLsn, long finishLsn, boolean trackIds, boolean mapDbOnly, long partialCkptStart, long ckptEnd, RecoveryUtilizationTracker tracker, Set<DatabaseId> logVersion8UpgradeDbs, AtomicBoolean logVersion8UpgradeDeltas)
          Create with logVersion8UpgradeDbs and logVersion8UpgradeDeltas params.
 
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.
 IN getIN(DatabaseImpl dbImpl)
          Get the last IN seen by the reader.
 long 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.
 long getMinReplicatedDbId()
           
 long getMinReplicatedNodeId()
           
 long getMinReplicatedTxnId()
           
 VLSNRecoveryProxy getVLSNProxy()
           
 boolean isBINDelta()
           
 boolean isDeleteInfo()
           
 boolean isDupDeleteInfo()
           
protected  boolean isTargetEntry()
          If we're tracking node, database and txn IDs, we want to see all node log entries.
protected  boolean processEntry(ByteBuffer entryBuffer)
          This reader returns non-provisional INs and IN delete entries.
 
Methods inherited from class com.sleepycat.je.log.FileReader
entryIsReplicated, getAndResetNReads, getLastEntrySize, getLastLsn, getNRepeatIteratorReads, getNumRead, initStartingPosition, 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

INFileReader

public INFileReader(EnvironmentImpl env,
                    int readBufferSize,
                    long startLsn,
                    long finishLsn,
                    boolean trackIds,
                    boolean mapDbOnly,
                    long partialCkptStart,
                    long ckptEnd,
                    RecoveryUtilizationTracker tracker)
Create this reader to start at a given LSN.


INFileReader

public INFileReader(EnvironmentImpl env,
                    int readBufferSize,
                    long startLsn,
                    long finishLsn,
                    boolean trackIds,
                    boolean mapDbOnly,
                    long partialCkptStart,
                    long ckptEnd,
                    RecoveryUtilizationTracker tracker,
                    Set<DatabaseId> logVersion8UpgradeDbs,
                    AtomicBoolean logVersion8UpgradeDeltas)
             throws DatabaseException
Create with logVersion8UpgradeDbs and logVersion8UpgradeDeltas params.

Throws:
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()
                         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 reader should process this entry, or just skip over it.
Throws:
DatabaseException - from subclasses.

processEntry

protected boolean processEntry(ByteBuffer entryBuffer)
                        throws DatabaseException
This reader returns non-provisional INs and IN delete entries. In tracking mode, it may also scan log entries that aren't returned: -to set the sequences for txn, node, and database ID. -to update utilization and obsolete offset information. -for VLSN mappings for recovery

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

getIN

public IN getIN(DatabaseImpl dbImpl)
         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.


getMinReplicatedNodeId

public long getMinReplicatedNodeId()

getMaxDbId

public long getMaxDbId()
Get the maximum DB ID seen by the reader.


getMinReplicatedDbId

public long getMinReplicatedDbId()

getMaxTxnId

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


getMinReplicatedTxnId

public long getMinReplicatedTxnId()

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.

isBINDelta

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

getVLSNProxy

public VLSNRecoveryProxy getVLSNProxy()


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