| java.lang.Object com.sleepycat.je.txn.Locker com.sleepycat.je.txn.Txn
All known Subclasses: com.sleepycat.je.txn.AutoTxn,
Txn | public class Txn extends Locker implements Loggable(Code) | | A Txn is one that's created by a call to Environment.txnBegin. This class
must support multithreaded use.
|
Method Summary | |
public void | abort(Xid xid) | public long | abort(boolean forceFlush) Abort this transaction. | void | addLock(Long nodeId, LockType type, LockGrantType grantStatus) Add lock to the appropriate queue. | public void | addLogInfo(long lastLsn) Called by the recovery manager when logging a transaction aware object.
This method is synchronized by the caller, by being called within the
log latch. | protected void | checkState(boolean calledByAbort) Throw an exception if the transaction is not open. | public LockStats | collectStats(LockStats stats) | public void | commit(Xid xid) | public long | commit() Call commit() with the default sync configuration property. | public long | commit(byte flushSyncBehavior) Commit this transaction
1. | public boolean | createdNode(long nodeId) true if this transaction created this node. | public void | dumpLog(StringBuffer sb, boolean verbose) | protected long | generateId(TxnManager txnManager) UserTxns get a new unique id for each instance. | public long | getAbortLsn(long nodeId) | int | getAccumulatedDelta() | long | getFirstActiveLsn() | int | getInMemorySize() | long | getLastLsn() Access to last LSN. | public int | getLogSize() | public boolean | getOnlyAbortable() Get the state of a transaction's ONLY_ABORTABLE. | public boolean | getPrepared() | public long | getTransactionId() | public Txn | getTxnLocker() This is a transactional locker. | public WriteLockInfo | getWriteLockInfo(long nodeId) | public boolean | isHandleLockTransferrable() | public boolean | isReadCommittedIsolation() Is read-committed isolation if so configured. | public boolean | isSerializableIsolation() Is serializable isolation if so configured. | public boolean | isSuspended() | public boolean | isTransactional() Is always transactional. | LockResult | lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) Gets a lock on this nodeId and, if it is a write lock, saves an abort
LSN. | public void | markDeleteAtTxnEnd(DatabaseImpl dbImpl, boolean deleteAtCommit) | void | moveWriteToReadLock(long nodeId, Lock lock) A lock is being demoted. | public Locker | newNonTxnLocker() Returns 'this', since this locker holds no non-transactional locks. | public void | operationEnd() Created transactions do nothing at the end of the operation. | public void | operationEnd(boolean operationOK) Created transactions do nothing at the end of the operation. | public int | prepare(Xid xid) | public void | readFromLog(ByteBuffer logBuffer, byte entryTypeVersion) | public void | registerCursor(CursorImpl cursor) Cursors operating under this transaction are added to the collection. | public void | releaseNonTxnLocks() This locker holds no non-transactional locks. | void | removeLock(long nodeId) Remove the lock from the set owned by this transaction. | public void | setHandleLockOwner(boolean ignore, Database dbHandle, boolean dbIsClosing) Created transactions don't transfer locks until commit. | public void | setOnlyAbortable() Set the state of a transaction to ONLY_ABORTABLE. | public void | setPrepared(boolean prepared) | public void | setSuspended(boolean suspended) | public void | unRegisterCursor(CursorImpl cursor) Remove a cursor from the collection. | public void | writeToLog(ByteBuffer logBuffer) |
ACCUMULATED_LIMIT | public static int ACCUMULATED_LIMIT(Code) | | |
TXN_NOSYNC | final public static byte TXN_NOSYNC(Code) | | |
TXN_SYNC | final public static byte TXN_SYNC(Code) | | |
TXN_WRITE_NOSYNC | final public static byte TXN_WRITE_NOSYNC(Code) | | |
Txn | public Txn()(Code) | | Constructor for reading from log.
|
abort | public long abort(boolean forceFlush) throws DatabaseException(Code) | | Abort this transaction. Steps are:
1. Release LN read locks.
2. Write a txn abort entry to the log. This is only for log
file cleaning optimization and there's no need to guarantee a
flush to disk.
3. Find the last LN log entry written for this txn, and use that
to traverse the log looking for nodes to undo. For each node,
use the same undo logic as recovery to rollback the transaction. Note
that we walk the log in order to undo in reverse order of the
actual operations. For example, suppose the txn did this:
delete K1/D1 (in LN 10)
create K1/D1 (in LN 20)
If we process LN10 before LN 20, we'd inadvertently create a
duplicate tree of "K1", which would be fatal for the mapping tree.
4. Release the write lock for this LN.
|
addLogInfo | public void addLogInfo(long lastLsn) throws DatabaseException(Code) | | Called by the recovery manager when logging a transaction aware object.
This method is synchronized by the caller, by being called within the
log latch. Record the last LSN for this transaction, to create the
transaction chain, and also record the LSN in the write info for abort
logic.
|
checkState | protected void checkState(boolean calledByAbort) throws DatabaseException(Code) | | Throw an exception if the transaction is not open.
If calledByAbort is true, it means we're being called
from abort().
Caller must invoke with "this" synchronized.
|
commit | public long commit() throws DatabaseException(Code) | | Call commit() with the default sync configuration property.
|
commit | public long commit(byte flushSyncBehavior) throws DatabaseException(Code) | | Commit this transaction
1. Releases read locks
2. Writes a txn commit record into the log
3. Flushes the log to disk.
4. Add deleted LN info to IN compressor queue
5. Release all write locks
If any step of this fails, we must convert this transaction to an abort.
|
createdNode | public boolean createdNode(long nodeId) throws DatabaseException(Code) | | true if this transaction created this node. We know that thisis true if the node is write locked and has a null abort LSN. |
generateId | protected long generateId(TxnManager txnManager)(Code) | | UserTxns get a new unique id for each instance.
|
getAccumulatedDelta | int getAccumulatedDelta()(Code) | | |
getFirstActiveLsn | long getFirstActiveLsn() throws DatabaseException(Code) | | first logged LSN, to aid recovery rollback. |
getInMemorySize | int getInMemorySize()(Code) | | |
getLastLsn | long getLastLsn()(Code) | | Access to last LSN.
|
getOnlyAbortable | public boolean getOnlyAbortable()(Code) | | Get the state of a transaction's ONLY_ABORTABLE.
|
getPrepared | public boolean getPrepared()(Code) | | |
getTxnLocker | public Txn getTxnLocker()(Code) | | This is a transactional locker.
|
isHandleLockTransferrable | public boolean isHandleLockTransferrable()(Code) | | true if this txn is willing to give up the handle lock toanother txn before this txn ends. |
isReadCommittedIsolation | public boolean isReadCommittedIsolation()(Code) | | Is read-committed isolation if so configured.
|
isSerializableIsolation | public boolean isSerializableIsolation()(Code) | | Is serializable isolation if so configured.
|
isSuspended | public boolean isSuspended()(Code) | | |
isTransactional | public boolean isTransactional()(Code) | | Is always transactional.
|
markDeleteAtTxnEnd | public void markDeleteAtTxnEnd(DatabaseImpl dbImpl, boolean deleteAtCommit) throws DatabaseException(Code) | | Parameters: dbImpl - databaseImpl to remove Parameters: deleteAtCommit - true if this databaseImpl should be cleaned oncommit, false if it should be cleaned on abort. Parameters: mb - environment memory budget. |
moveWriteToReadLock | void moveWriteToReadLock(long nodeId, Lock lock)(Code) | | A lock is being demoted. Move it from the write collection into the read
collection.
|
newNonTxnLocker | public Locker newNonTxnLocker() throws DatabaseException(Code) | | Returns 'this', since this locker holds no non-transactional locks.
|
operationEnd | public void operationEnd() throws DatabaseException(Code) | | Created transactions do nothing at the end of the operation.
|
operationEnd | public void operationEnd(boolean operationOK) throws DatabaseException(Code) | | Created transactions do nothing at the end of the operation.
|
readFromLog | public void readFromLog(ByteBuffer logBuffer, byte entryTypeVersion)(Code) | | See Also: Loggable.readFromLog See Also: It's ok for FindBugs to whine about id not being synchronized. |
releaseNonTxnLocks | public void releaseNonTxnLocks() throws DatabaseException(Code) | | This locker holds no non-transactional locks.
|
removeLock | void removeLock(long nodeId) throws DatabaseException(Code) | | Remove the lock from the set owned by this transaction. If specified to
LockManager.release, the lock manager will call this when its releasing
a lock. Usually done because the transaction doesn't need to really keep
the lock, i.e for a deleted record.
|
setHandleLockOwner | public void setHandleLockOwner(boolean ignore, Database dbHandle, boolean dbIsClosing) throws DatabaseException(Code) | | Created transactions don't transfer locks until commit.
|
setOnlyAbortable | public void setOnlyAbortable()(Code) | | Set the state of a transaction to ONLY_ABORTABLE.
|
setPrepared | public void setPrepared(boolean prepared)(Code) | | |
setSuspended | public void setSuspended(boolean suspended)(Code) | | |
Methods inherited from com.sleepycat.je.txn.Locker | public void addDeleteInfo(BIN bin, Key deletedKey) throws DatabaseException(Code)(Java Doc) abstract void addLock(Long nodeId, LockType type, LockGrantType grantStatus) throws DatabaseException(Code)(Java Doc) public void addToHandleMaps(Long handleLockId, Database databaseHandle)(Code)(Java Doc) abstract protected void checkState(boolean ignoreCalledByAbort) throws DatabaseException(Code)(Java Doc) abstract public LockStats collectStats(LockStats stats) throws DatabaseException(Code)(Java Doc) abstract public boolean createdNode(long nodeId) throws DatabaseException(Code)(Java Doc) public void demoteLock(long nodeId) throws DatabaseException(Code)(Java Doc) public void dumpLockTable() throws DatabaseException(Code)(Java Doc) abstract protected long generateId(TxnManager txnManager)(Code)(Java Doc) abstract public long getAbortLsn(long nodeId) throws DatabaseException(Code)(Java Doc) public boolean getDefaultNoWait()(Code)(Java Doc) public long getId()(Code)(Java Doc) public synchronized long getLockTimeout()(Code)(Java Doc) abstract public Txn getTxnLocker()(Code)(Java Doc) long getTxnStartMillis()(Code)(Java Doc) public long getTxnTimeOut()(Code)(Java Doc) Lock getWaitingFor()(Code)(Java Doc) abstract public WriteLockInfo getWriteLockInfo(long nodeId) throws DatabaseException(Code)(Java Doc) public boolean isHandleLockTransferrable()(Code)(Java Doc) abstract public boolean isReadCommittedIsolation()(Code)(Java Doc) public boolean isReadUncommittedDefault()(Code)(Java Doc) abstract public boolean isSerializableIsolation()(Code)(Java Doc) public boolean isTimedOut() throws DatabaseException(Code)(Java Doc) abstract public boolean isTransactional()(Code)(Java Doc) public LockResult lock(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws LockNotGrantedException, DeadlockException, DatabaseException(Code)(Java Doc) abstract LockResult lockInternal(long nodeId, LockType lockType, boolean noWait, DatabaseImpl database) throws DeadlockException, DatabaseException(Code)(Java Doc) abstract public void markDeleteAtTxnEnd(DatabaseImpl db, boolean deleteAtCommit) throws DatabaseException(Code)(Java Doc) abstract void moveWriteToReadLock(long nodeId, Lock lock)(Code)(Java Doc) abstract public Locker newNonTxnLocker() throws DatabaseException(Code)(Java Doc) public LockResult nonBlockingLock(long nodeId, LockType lockType, DatabaseImpl database) throws DatabaseException(Code)(Java Doc) abstract public void operationEnd() throws DatabaseException(Code)(Java Doc) abstract public void operationEnd(boolean operationOK) throws DatabaseException(Code)(Java Doc) public void operationEnd(OperationStatus status) throws DatabaseException(Code)(Java Doc) abstract public void registerCursor(CursorImpl cursor) throws DatabaseException(Code)(Java Doc) public void releaseLock(long nodeId) throws DatabaseException(Code)(Java Doc) abstract public void releaseNonTxnLocks() throws DatabaseException(Code)(Java Doc) abstract void removeLock(long nodeId) throws DatabaseException(Code)(Java Doc) abstract public void setHandleLockOwner(boolean operationOK, Database dbHandle, boolean dbIsClosing) throws DatabaseException(Code)(Java Doc) public synchronized void setLockTimeout(long timeout)(Code)(Java Doc) void setOnlyAbortable()(Code)(Java Doc) public synchronized void setTxnTimeout(long timeout)(Code)(Java Doc) void setWaitingFor(Lock lock)(Code)(Java Doc) public boolean sharesLocksWith(Locker other)(Code)(Java Doc) public String toString()(Code)(Java Doc) public void transferHandleLock(Database dbHandle, Locker destLocker, boolean demoteToRead) throws DatabaseException(Code)(Java Doc) void transferHandleLockToHandle(Database dbHandle) throws DatabaseException(Code)(Java Doc) abstract public void unRegisterCursor(CursorImpl cursor) throws DatabaseException(Code)(Java Doc) void unregisterHandle(Database dbHandle)(Code)(Java Doc)
|
|
|