com.sleepycat.je.log.entry
Class NameLNLogEntry

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

public class NameLNLogEntry
extends LNLogEntry

NameLNLogEntry contains all the regular LNLogEntry fields and additional information about the database operation which instigated the logging of this NameLN. This additional information is used to support replication of database operations in a replication group. Database operations pose a special problem for replication because unlike data record put and get calls, they can result in multiple log entries that are not all members of a single transaction. Create and truncate are the problem operations because they end up logging new MapLNs, and our implementation does not treat MapLNs as transactional. Database operations challenge two replication assumptions: (a) that all logical operations can be repeated on the client node based on the contents of a single log entry, and (b) that non-txnal log entries like MapLNs need not be replicated. Specifically, here's what is logged for database operations. create: 1. new NameLN_TX 2. new MapLN, which has the database config info. 3. txn commit of autocommit or user txn. rename: 1. deleted NameLN_TX 2. new NameLN_TX 3. txn commit from autocommit or user txn truncate: 1. new MapLN w/new id 2. modify the existing NameLN with new id (old database is deleted by usual commit-time processing) 3. txn commit from autocommit or user txn delete 1. deleted NameLN_TX (old database gets deleted by usual commit-time processing) 2. txn commit from autocommit or user txn Extra information is needed for create and truncate, which both log information within the MapLN. Rename and delete only log NameLNs, so they can be replicated on the client using the normal replication messages. The extra fields which follow the usual LNLogEntry fields are: operationType - the type of database operation. In a single node system, this is local information implicit in the code path. databaseConfig (optional) - For creates, database configuration info databaseId (optional)- For truncates, the old db id, so we know which MapLN to delete.


Field Summary
 
Fields inherited from class com.sleepycat.je.log.entry.BaseEntry
entryType
 
Constructor Summary
NameLNLogEntry()
          Constructor to read an entry.
NameLNLogEntry(LogEntryType entryType, NameLN nameLN, DatabaseId dbId, byte[] key, long abortLsn, boolean abortKnownDeleted, Txn txn, ReplicationContext repContext)
          Constructor to write this entry.
 
Method Summary
 StringBuilder dumpEntry(StringBuilder sb, boolean verbose)
          Extends its super class to dump database operation information.
 void dumpRep(StringBuilder sb)
          Dump the contents of the log entry that are interesting for replication.
 DbOperationType getOperationType()
           
 ReplicatedDatabaseConfig getReplicatedCreateConfig()
           
 int getSize()
          Extends its super class to add in database operation information.
 DatabaseId getTruncateOldDbId()
           
 boolean logicalEquals(LogEntry other)
           
 void readEntry(LogEntryHeader header, ByteBuffer entryBuffer, boolean readFullItem)
          Extends its super class to read in database operation information.
 void writeEntry(LogEntryHeader header, ByteBuffer destBuffer)
          Extends its super class to add in database operation information.
 
Methods inherited from class com.sleepycat.je.log.entry.LNLogEntry
clone, getAbortKnownDeleted, getAbortLsn, getDbId, getDupKey, getKey, getLastLoggedSize, getLN, getMainItem, getNodeId, getTransactionId, getTxnId, getUserTxn, isDeleted, postLogWork
 
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

NameLNLogEntry

public NameLNLogEntry()
Constructor to read an entry.


NameLNLogEntry

public NameLNLogEntry(LogEntryType entryType,
                      NameLN nameLN,
                      DatabaseId dbId,
                      byte[] key,
                      long abortLsn,
                      boolean abortKnownDeleted,
                      Txn txn,
                      ReplicationContext repContext)
Constructor to write this entry.

Method Detail

readEntry

public void readEntry(LogEntryHeader header,
                      ByteBuffer entryBuffer,
                      boolean readFullItem)
               throws DatabaseException
Extends its super class to read in database operation information.

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

dumpEntry

public StringBuilder dumpEntry(StringBuilder sb,
                               boolean verbose)
Extends its super class to dump database operation information.

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

getSize

public int getSize()
Extends its super class to add in database operation information.

Specified by:
getSize in interface LogEntry
Overrides:
getSize in class LNLogEntry
Returns:
size of byte buffer needed to store this entry.
See Also:
LNLogEntry.getSize()

writeEntry

public void writeEntry(LogEntryHeader header,
                       ByteBuffer destBuffer)
Extends its super class to add in database operation information.

Specified by:
writeEntry in interface LogEntry
Overrides:
writeEntry in class LNLogEntry
destBuffer - is the destination buffer
See Also:
LogEntry#writeToLog

logicalEquals

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

getOperationType

public DbOperationType getOperationType()
Returns:
the operationType

getReplicatedCreateConfig

public ReplicatedDatabaseConfig getReplicatedCreateConfig()
Returns:
the replicatedCreateConfig

getTruncateOldDbId

public DatabaseId getTruncateOldDbId()
Returns:
the truncateOldDbId

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
Overrides:
dumpRep in class LNLogEntry
See Also:
LogEntry.dumpRep(java.lang.StringBuilder)


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