com.sleepycat.je.txn
Class TxnChain
java.lang.Object
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)
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
getRemainingLockedNodes
public Set<Long> getRemainingLockedNodes()
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-2010 Oracle. All rights reserved.