public class MasterTxn extends Txn
| Modifier and Type | Class and Description |
|---|---|
static interface |
MasterTxn.MasterTxnFactory |
ACCUMULATED_LIMIT, commitLsn, dbCleanupSet, firstLoggedLsn, lastLoggedLsn, openedDatabaseHandles, repContext, undoDatabasesafterWaiterHook, envImpl, id, lockManager, thread| Constructor and Description |
|---|
MasterTxn(EnvironmentImpl envImpl,
TransactionConfig config,
NameIdPair nameIdPair) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkIfFrozen(boolean isCommit)
Used to hold the transaction stable while it is being cloned as a
ReplayTxn, during master->replica transitions.
|
ReplayTxn |
convertToReplayTxnAndClose(Logger logger,
Replay replay)
Convert a MasterTxn that has any write locks into a ReplayTxn, and close
the MasterTxn after it is disemboweled.
|
static MasterTxn |
create(EnvironmentImpl envImpl,
TransactionConfig config,
NameIdPair nameIdPair) |
static MasterTxn |
createNullTxn(EnvironmentImpl envImpl,
TransactionConfig config,
NameIdPair nameIdPair) |
void |
freeze() |
protected long |
generateId(TxnManager txnManager,
long ignore)
MasterTxns use txn ids from a reserved negative space.
|
boolean |
getArbiterAck() |
CommitToken |
getCommitToken()
Returns the transaction commit token used to identify the transaction.
|
VLSN |
getCommitVLSN() |
protected long |
getDTVLSN()
This method is overridden by replication txn subclasses and returns the
DTVLSN associated with the Txn.
|
protected int |
getReplicatorNodeId()
A masterTxn always writes its own id into the commit or abort.
|
int |
getRequiredAckCount() |
long |
getStartMs() |
boolean |
isLocalWrite()
Returns true if writes may only be to non-replicated DBs using this
locker, or false if writes may only be to replicated DBs.
|
boolean |
isMasterTxn() |
LockResult |
lockInternal(long lsn,
LockType lockType,
boolean noWait,
boolean jumpAheadOfWaiters,
DatabaseImpl database)
Prevent this MasterTxn from taking locks if the node becomes a
replica.
|
boolean |
lockOnce()
Determines whether we should lock the block-latch lock.
|
long |
messageTransferMs()
Returns the amount of time it took to copy the commit record from the
log buffer to the rep stream.
|
protected void |
postLogAbortHook() |
protected void |
postLogCommitAbortHook()
Invoked if the transaction associated with the preLogCommitHook was
subsequently aborted, for example due to a lack of disk space.
|
protected void |
postLogCommitHook(LogItem commitItem)
This hook is invoked after the commit record has been written to the
log, but before write locks have been released, so that other
application cannot see the changes made by the transaction.
|
protected void |
preLogAbortHook() |
protected void |
preLogCommitHook()
This hook is invoked before the commit of a transaction that made
changes to a replicated environment.
|
void |
preLogWithoutLock(DatabaseImpl database)
If logging occurs before locking, we must screen out write locks here.
|
protected boolean |
propagatePostCommitException(DatabaseException postCommitException)
Identifies exceptions that may be propagated back to the caller during
the postCommit phase of a transaction commit.
|
void |
resetRequiredAckCount() |
void |
setArbiterAck(boolean val) |
void |
setConvertHook(TestHook<Integer> hook) |
static void |
setFactory(MasterTxn.MasterTxnFactory factory)
Method used for unit testing.
|
void |
stampRepWriteTime() |
protected void |
txnBeginHook(TransactionConfig config)
Causes the transaction to wait until we have sufficient replicas to
acknowledge the commit.
|
boolean |
unlockOnce()
Determines whether we should unlock the block-latch lock.
|
abort, abort, abort, addDbCleanup, addLock, addLogInfo, addOpenedDatabase, checkPreempted, checkState, cleanupDatabaseImpls, clearReadLocks, clearWriteLocks, close, collectStats, commit, commit, commit, createAutoTxn, createLocalAutoTxn, createLocalTxn, dumpLog, getCommitDurability, getDbCleanupSet, getDefaultDurability, getEmbeddedLoggables, getEnvironmentImpl, getExplicitDurabilityConfigured, getExplicitSyncConfigured, getFirstActiveLsn, getImportunate, getLastFormatChange, getLastLsn, getLogSize, getLogSize, getPrepared, getReadLockIds, getState, getTransaction, getTransactionId, getTriggerDbs, getTxnLocker, getUndoDatabases, getWriteLockIds, getWriteLockInfo, hasReplicationFormat, isAutoTxn, isClosed, isOnlyAbortable, isReadCommittedIsolation, isReadOnly, isReplicationFormatWorthwhile, isRolledBack, isSerializableIsolation, isSuspended, isTransactional, isValid, lockingRequired, logicalEquals, newNonTxnLocker, nonTxnOperationEnd, noteTriggerDb, operationEnd, prepare, readFromLog, registerCursor, registerImmediately, releaseNonTxnLocks, releaseWriteLocks, removeLock, setDbCleanupState, setImportunate, setOnlyAbortable, setPrepared, setRollback, setSuspended, setTransaction, undo, unRegisterCursor, updateLoggedForTxn, writeToLog, writeToLogaddDeleteInfo, allowReleaseLockAfterLsnChange, demoteLock, disallowReplicaWrite, dumpLockTable, getDefaultNoWait, getEnvironment, getId, getInitialLockTimeout, getLockTimeout, getPreemptable, getTxnTimeout, isReadUncommittedDefault, isReplicated, isTimedOut, lock, lockAfterLsnChange, nonBlockingLock, openCursorHook, operationEnd, operationEnd, releaseLock, setClosingLocker, setDefaultNoWait, setLockTimeout, setPreemptable, setPreempted, setTxnTimeout, sharesLocksWith, toStringpublic MasterTxn(EnvironmentImpl envImpl, TransactionConfig config, NameIdPair nameIdPair) throws DatabaseException
DatabaseExceptionpublic boolean isLocalWrite()
LockerisLocalWrite in class Lockerpublic CommitToken getCommitToken()
getCommitToken in class TxnTxn.getCommitToken()public VLSN getCommitVLSN()
protected long generateId(TxnManager txnManager, long ignore)
generateId in class Txnprotected void txnBeginHook(TransactionConfig config) throws DatabaseException
txnBeginHook in class Txnconfig - the transaction config that applies to the txnDatabaseException - if there is a failureprotected void preLogCommitHook()
throws DatabaseException
TxnpreLogCommitHook in class TxnDatabaseException - if there was a problem and that the
transaction should be aborted.protected void postLogCommitHook(LogItem commitItem) throws DatabaseException
TxnpostLogCommitHook in class TxncommitItem - the commit item that was just loggedDatabaseException - to indicate that there was a replication
related problem that needs to be communicated back to the application.protected void preLogAbortHook()
throws DatabaseException
preLogAbortHook in class TxnDatabaseExceptionprotected void postLogCommitAbortHook()
TxnpostLogCommitAbortHook in class Txnprotected void postLogAbortHook()
postLogAbortHook in class Txnpublic LockResult lockInternal(long lsn, LockType lockType, boolean noWait, boolean jumpAheadOfWaiters, DatabaseImpl database) throws LockNotAvailableException, LockConflictException, DatabaseException
lockInternal in class Txnlsn - is the node to lock.lockType - is the type of lock to request.noWait - is true to override the defaultNoWait setting. If true,
or if defaultNoWait is true, throws LockNotAvailableException if the
lock cannot be granted without waiting.jumpAheadOfWaiters - grant the lock before other waiters, if any.database - is the database containing lsn.LockConflictException - if a blocking lock could not be acquired.LockNotAvailableExceptionDatabaseExceptionLocker.lockInternal(long, com.sleepycat.je.txn.LockType, boolean, boolean, com.sleepycat.je.dbi.DatabaseImpl)public void preLogWithoutLock(DatabaseImpl database)
preLogWithoutLock in class Txnpublic boolean lockOnce()
We acquire the lock during pre-log hook, and release it during post-log hook. Specifically, there are the following cases:
preLogCommitHook() and
release it in postLogCommitHook()
Txn.abort() API), we acquire the lock in preLogAbortHook() and
release it in postLogAbortHook().
Txn.throwPreCommitException(), we go through the abort path as well.
In this case:
preLogCommitHook();
preLogAbortHook() and postLogAbortHook() as always;
postLogCommitAbortHook()
See additional javadoc at RepImpl.blockLatchLock
public boolean unlockOnce()
lockOnce()public int getRequiredAckCount()
public void resetRequiredAckCount()
protected int getReplicatorNodeId()
getReplicatorNodeId in class Txnprotected long getDTVLSN()
Txnpublic long getStartMs()
public void stampRepWriteTime()
public long messageTransferMs()
protected boolean propagatePostCommitException(DatabaseException postCommitException)
TxnpropagatePostCommitException in class TxnpostCommitException - the exception being evaluatedpublic static MasterTxn create(EnvironmentImpl envImpl, TransactionConfig config, NameIdPair nameIdPair)
public static MasterTxn createNullTxn(EnvironmentImpl envImpl, TransactionConfig config, NameIdPair nameIdPair)
public static void setFactory(MasterTxn.MasterTxnFactory factory)
public ReplayTxn convertToReplayTxnAndClose(Logger logger, Replay replay)
public void freeze()
protected void checkIfFrozen(boolean isCommit)
checkIfFrozen in class TxnisCommit - true if called by commit.Replica.replicaTransitionCleanup()public boolean isMasterTxn()
isMasterTxn in class Txnpublic void setArbiterAck(boolean val)
public boolean getArbiterAck()
Copyright © 2024. All rights reserved.