com.sleepycat.je.txn
Class TxnChain

java.lang.Object
  extended by com.sleepycat.je.txn.TxnChain

public class TxnChain
extends Object

TxnChain supports Txn.rollback(), which undoes the write operations for a given transaction to an arbitrary point. This is used by HA during the syncup phase, and by recovery when it is processes a RollbackStart/End. In the JE log, the log entries that make up a transaction are chained, but each entry refers only to its pre-transaction value, and doesn't know its intra-txn previous value. For example, a log looks like this: lsn key abortlsn 100 A/node 10 null_lsn (first instance of a record) ..... txn begins ..... 200 A'/node10 100 300 A'delete/node10 100 400 A new/node77 100 500 B/node80 null_lsn When reading the log, we can find all the records in the transaction. This chain exists: 500->400->300->200->null_lsn To rollback to an arbitrary entry in the transaction, we need a chain of all the records that occupied a given BIN slot during the transaction. chain. The key, data, and comparators are used to determine which records hash to the same slot, mimicking the btree itself. 500 -> null_lsn (reverts to no-record) 400 -> 300 (reverts to previous deleted record in that slot) 300 -> 200 (reverts to A', intermediate version of the record) 200 -> 100 (reverts to original, pre-txn version)


Nested Class Summary
static class TxnChain.CompareSlot
          Compare two keys using the appropriate comparator.
static class TxnChain.RevertInfo
           
 
Constructor Summary
TxnChain(long lastLoggedLsn, long txnId, long matchpoint, EnvironmentImpl envImpl)
           
TxnChain(long lastLoggedLsn, long txnId, long matchpoint, Map<DatabaseId,DatabaseImpl> undoDatabases, EnvironmentImpl envImpl)
           
 
Method Summary
 VLSN getLastValidVLSN()
           
 Set<Long> getRemainingLockedNodes()
          Returns LSNs for all nodes that should remain locked by the txn.
 TxnChain.RevertInfo pop()
          Return information about the next item on the transaction chain and remove it from the chain.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TxnChain

public TxnChain(long lastLoggedLsn,
                long txnId,
                long matchpoint,
                EnvironmentImpl envImpl)

TxnChain

public TxnChain(long lastLoggedLsn,
                long txnId,
                long matchpoint,
                Map<DatabaseId,DatabaseImpl> undoDatabases,
                EnvironmentImpl envImpl)
         throws DatabaseException
Throws:
DatabaseException
Method Detail

getRemainingLockedNodes

public Set<Long> getRemainingLockedNodes()
Returns LSNs for all nodes that should remain locked by the txn. Note that when multiple versions of a record were locked by the txn, the LSNs of all versions are returned. Only the latest version will actually be locked.


pop

public TxnChain.RevertInfo pop()
Return information about the next item on the transaction chain and remove it from the chain.


getLastValidVLSN

public VLSN getLastValidVLSN()

toString

public String toString()
Overrides:
toString in class Object


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