com.sleepycat.je.log.entry
Class LNLogEntry

java.lang.Object
  extended by com.sleepycat.je.log.entry.BaseEntry
      extended by com.sleepycat.je.log.entry.LNLogEntry
All Implemented Interfaces:
LogEntry, NodeLogEntry, Cloneable
Direct Known Subclasses:
DeletedDupLNLogEntry, NameLNLogEntry

public class LNLogEntry
extends BaseEntry
implements LogEntry, NodeLogEntry

LNLogEntry embodies all LN transactional log entries. On disk, an LN log entry contains (pre version 6)

   LN
   databaseid
   key
   abortLsn          -- if transactional
   abortKnownDeleted -- if transactional
   txn               -- if transactional

 (version 6)
   databaseid
   abortLsn          -- if transactional
   abortKnownDeleted -- if transactional
   txn               -- if transactional
   LN
   key
 
Before version 6, a non-full-item read of a log entry only retrieved the node id. After version 6, the database id, transaction id and node id are all available.


Field Summary
 
Fields inherited from class com.sleepycat.je.log.entry.BaseEntry
entryType
 
Constructor Summary
LNLogEntry(Class<? extends LN> LNClass)
           
LNLogEntry(LogEntryType entryType, LN ln, DatabaseId dbId, byte[] key, long abortLsn, boolean abortKnownDeleted, Txn txn)
           
 
Method Summary
 Object clone()
           
 StringBuilder dumpEntry(StringBuilder sb, boolean verbose)
          Print out the contents of an entry.
 void dumpRep(StringBuilder sb)
          Dump the contents of the log entry that are interesting for replication.
 boolean getAbortKnownDeleted()
           
 long getAbortLsn()
           
 DatabaseId getDbId()
          All node entries have a database ID.
 byte[] getDupKey()
           
 byte[] getKey()
           
 int getLastLoggedSize()
          Returns the last logged size, saved by readEntry and writeEntry.
 LN getLN()
           
 Object getMainItem()
           
 long getNodeId()
          Returns the node ID.
 int getSize()
          #see LogEntry#getSize
 long getTransactionId()
           
 Long getTxnId()
           
 Txn getUserTxn()
           
 boolean isDeleted()
          Returns true for a deleted LN to count it immediately as obsolete.
 boolean logicalEquals(LogEntry other)
           
 void postLogWork(long justLoggedLsn)
          For LN entries, we need to record the latest LSN for that node with the owning transaction, within the protection of the log latch.
 void readEntry(LogEntryHeader header, ByteBuffer entryBuffer, boolean readFullItem)
          Read in a log entry.
 void writeEntry(LogEntryHeader header, ByteBuffer destBuffer)
          Serialize this object into the buffer.
 
Methods inherited from class com.sleepycat.je.log.entry.BaseEntry
getLogType, newInstanceOfType, setLogType, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.sleepycat.je.log.entry.LogEntry
getLogType, setLogType
 

Constructor Detail

LNLogEntry

public LNLogEntry(Class<? extends LN> LNClass)

LNLogEntry

public LNLogEntry(LogEntryType entryType,
                  LN ln,
                  DatabaseId dbId,
                  byte[] key,
                  long abortLsn,
                  boolean abortKnownDeleted,
                  Txn txn)
Method Detail

readEntry

public void readEntry(LogEntryHeader header,
                      ByteBuffer entryBuffer,
                      boolean readFullItem)
               throws DatabaseException
Description copied from interface: LogEntry
Read in a log entry.

Specified by:
readEntry in interface LogEntry
Throws:
DatabaseException
See Also:
LogEntry.readEntry(com.sleepycat.je.log.LogEntryHeader, java.nio.ByteBuffer, boolean)

dumpEntry

public StringBuilder dumpEntry(StringBuilder sb,
                               boolean verbose)
Description copied from interface: LogEntry
Print out the contents of an entry.

Specified by:
dumpEntry in interface LogEntry
Specified by:
dumpEntry in class BaseEntry
See Also:
LogEntry.dumpEntry(java.lang.StringBuilder, boolean)

dumpRep

public void dumpRep(StringBuilder sb)
Description copied from interface: LogEntry
Dump the contents of the log entry that are interesting for replication.

Specified by:
dumpRep in interface LogEntry
See Also:
LogEntry.dumpRep(java.lang.StringBuilder)

getMainItem

public Object getMainItem()
Specified by:
getMainItem in interface LogEntry
Returns:
the first item of the log entry
See Also:
LogEntry.getMainItem()

clone

public Object clone()
             throws CloneNotSupportedException
Specified by:
clone in interface LogEntry
Overrides:
clone in class Object
Returns:
a shallow clone.
Throws:
CloneNotSupportedException
See Also:
LogEntry.clone()

getTransactionId

public long getTransactionId()
Specified by:
getTransactionId in interface LogEntry
Returns:
return the transaction id if this log entry is transactional, 0 otherwise.
See Also:
LogEntry.getTransactionId()

getNodeId

public long getNodeId()
Description copied from interface: NodeLogEntry
Returns the node ID. This value is redundant with the main item (Node) of a log entry. It is returned separately so that it can be obtained when the entry's main item (Node) is not loaded. Partial loading is an optimization for recovery.

Specified by:
getNodeId in interface NodeLogEntry
See Also:
NodeLogEntry.getNodeId()

getSize

public int getSize()
#see LogEntry#getSize

Specified by:
getSize in interface LogEntry
Returns:
size of byte buffer needed to store this entry.

getLastLoggedSize

public int getLastLoggedSize()
Returns the last logged size, saved by readEntry and writeEntry.

Specified by:
getLastLoggedSize in interface LogEntry
Overrides:
getLastLoggedSize in class BaseEntry
Returns:
total size of last logged entry, or zero if unknown. The last logged size is known for LNs, and is used for obsolete size counting.

writeEntry

public void writeEntry(LogEntryHeader header,
                       ByteBuffer destBuffer)
Description copied from interface: LogEntry
Serialize this object into the buffer.

Specified by:
writeEntry in interface LogEntry
destBuffer - is the destination buffer
See Also:
LogEntry.writeEntry(com.sleepycat.je.log.LogEntryHeader, java.nio.ByteBuffer)

isDeleted

public boolean isDeleted()
Returns true for a deleted LN to count it immediately as obsolete.

Specified by:
isDeleted in interface LogEntry
Overrides:
isDeleted in class BaseEntry
See Also:
LogEntry.isDeleted()

postLogWork

public void postLogWork(long justLoggedLsn)
For LN entries, we need to record the latest LSN for that node with the owning transaction, within the protection of the log latch. This is a callback for the log manager to do that recording.

Specified by:
postLogWork in interface LogEntry
Overrides:
postLogWork in class BaseEntry
See Also:
LogEntry.postLogWork(long)

getLN

public LN getLN()

getDbId

public DatabaseId getDbId()
Description copied from interface: NodeLogEntry
All node entries have a database ID.

Specified by:
getDbId in interface NodeLogEntry

getKey

public byte[] getKey()

getDupKey

public byte[] getDupKey()

getAbortLsn

public long getAbortLsn()

getAbortKnownDeleted

public boolean getAbortKnownDeleted()

getTxnId

public Long getTxnId()

getUserTxn

public Txn getUserTxn()

logicalEquals

public boolean logicalEquals(LogEntry other)
Specified by:
logicalEquals in interface LogEntry
Returns:
true if these two log entries are logically the same. Used for replication.
See Also:
LogEntry.logicalEquals(com.sleepycat.je.log.entry.LogEntry)


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