MediaWiki  master
Wikimedia\Rdbms\TransactionManager Class Reference
Collaboration diagram for Wikimedia\Rdbms\TransactionManager:

Public Member Functions

 __construct (LoggerInterface $logger=null, $profiler=null)
 
 addPostCommitOrIdleCallback (callable $callback, $fname=__METHOD__)
 
 addPreCommitOrIdleCallback (callable $callback, $fname=__METHOD__)
 
 addToAtomicLevels ( $fname, AtomicSectionIdentifier $sectionId, $savepointId)
 
 assertSessionStatus (IDatabase $db, $fname)
 
 assertTransactionStatus (IDatabase $db, $deprecationLogger, $fname)
 
 cancelAtomic ( $pos)
 
 clearEndCallbacks ()
 
 clearPreEndCallbacks ()
 
 clearSessionError ()
 Unflag the session as needing a reset due to an error. More...
 
 consumeEndCallbacks ( $trigger)
 
 consumeTrxId ()
 Reset the application-side transaction identifier instance and return the old one. More...
 
 countPostCommitOrIdleCallbacks ()
 
 currentAtomicSectionId ()
 
 explicitTrxActive ()
 
 getPositionFromSectionId (AtomicSectionIdentifier $sectionId=null)
 
 getRecurringCallbacks ()
 
 getTrxId ()
 Get the application-side transaction identifier instance. More...
 
 isClean ()
 
 isEndCallbacksSuppressed ()
 
 modifyCallbacksForCancel (IDatabase $db, array $sectionIds, AtomicSectionIdentifier $newSectionId=null)
 Update callbacks that were owned by cancelled atomic sections. More...
 
 newTrxId ( $mode, $fname)
 TODO: This should be removed once all usages have been migrated here. More...
 
 nextSavePointId (IDatabase $db, $fname)
 
 onAtomicSectionCancel (IDatabase $db, $callback, $fname)
 
 onBeginTransaction (IDatabase $db, $fname)
 
 onCancelAtomicBeforeCriticalSection (IDatabase $db, $fname)
 
 onCommit (IDatabase $db, $fname, $flush)
 
 onCommitInCriticalSection (IDatabase $db)
 
 onDestruct ()
 
 onEndAtomic (IDatabase $db, $fname)
 
 onEndAtomicInCriticalSection ( $sectionId)
 
 onFlushSnapshot (IDatabase $db, $fname, $flush, $trxRoundId)
 
 onGetScopedLockAndFlush (IDatabase $db, $fname)
 
 onRollback (IDatabase $db)
 
 onTransactionResolution (IDatabase $db, callable $callback, $fname)
 
 pendingPreCommitCallbackCallers ()
 List the methods that have precommit callbacks for the current transaction. More...
 
 pendingWriteAndCallbackCallers ()
 List the methods that have write queries or callbacks for the current transaction. More...
 
 pendingWriteCallers ()
 
 pendingWriteQueryDuration (IDatabase $db, $type=IDatabase::ESTIMATE_TOTAL)
 
 popAtomicLevel ()
 
 reassignCallbacksForSection (AtomicSectionIdentifier $old, AtomicSectionIdentifier $new)
 Hoist callback ownership for callbacks in a section to a parent section. More...
 
 recordQueryCompletion ( $sql, $startTime, $isPermWrite, $rowCount, $serverName)
 
 resetTrxAtomicLevels ()
 
 runOnAtomicSectionCancelCallbacks (IDatabase $db, int $trigger, array $sectionIds)
 Consume and run any relevant "on atomic section cancel" callbacks for the active transaction. More...
 
 runOnTransactionPreCommitCallbacks (IDatabase $db)
 Consume and run any "on transaction pre-commit" callbacks. More...
 
 sessionStatus ()
 Get the status of the current session (ephemeral server-side state tied to the connection) More...
 
 setAutomaticAtomic ( $value)
 
 setSessionError (Throwable $sessionError)
 Flag the session as needing a reset due to an error, if not already flagged. More...
 
 setTransactionError (Throwable $trxError)
 Mark the transaction as requiring rollback (STATUS_TRX_ERROR) due to an error. More...
 
 setTransactionListener ( $name, callable $callback=null)
 
 setTrxEndCallbackSuppression (bool $suppress)
 Whether to disable running of post-COMMIT/ROLLBACK callbacks. More...
 
 setTrxStatusIgnoredCause (?array $trxStatusIgnoredCause)
 
 setTrxStatusToNone ()
 
 setTrxStatusToOk ()
 
 transactionWritingIn ( $serverName, $domainId)
 
 transactionWritingOut (IDatabase $db, $oldId)
 
 trxCheckBeforeClose (IDatabase $db, $fname)
 
 trxLevel ()
 
 trxStatus ()
 
 trxTimestamp ()
 
 turnOnAutomatic ()
 
 updateTrxWriteQueryReport ( $queryVerb, $runtime, $affected, $fname)
 Update the estimated run-time of a query, not counting large row lock times. More...
 
 writesOrCallbacksPending ()
 
 writesPending ()
 

Public Attributes

const STATUS_SESS_ERROR = 1
 Session is in a error state requiring a reset. More...
 
const STATUS_SESS_OK = 2
 Session is in a normal state. More...
 

Private Member Functions

 calculateLastTrxApplyTime (float $rtt)
 
 flatAtomicSectionList ()
 

Private Attributes

LoggerInterface $logger
 
TransactionProfiler $profiler
 
Throwable null $sessionError
 The cause of any unresolved session state loss error, or, null. More...
 
int $trxAtomicCounter = 0
 Counter for atomic savepoint identifiers (reset with each transaction) More...
 
array $trxAtomicLevels = []
 List of (name, unique ID, savepoint ID) for each active atomic section level. More...
 
bool $trxAutomatic = false
 Whether the current transaction was started implicitly due to DBO_TRX. More...
 
bool $trxAutomaticAtomic = false
 Whether the current transaction was started implicitly by startAtomic() More...
 
bool $trxDoneWrites = false
 Whether possible write queries were done in the last transaction started. More...
 
array[] $trxEndCallbacks = []
 List of (callable, method name, atomic section id) More...
 
bool $trxEndCallbacksSuppressed = false
 Whether to suppress triggering of transaction end callbacks. More...
 
string null $trxFname = null
 Name of the function that start the last transaction. More...
 
TransactionIdentifier null $trxId
 Application-side ID of the active transaction; null if none. More...
 
array[] $trxPostCommitOrIdleCallbacks = []
 List of (callable, method name, atomic section id) More...
 
array[] $trxPreCommitOrIdleCallbacks = []
 List of (callable, method name, atomic section id) More...
 
callable[] $trxRecurringCallbacks = []
 Map of (name => callable) More...
 
array[] $trxSectionCancelCallbacks = []
 List of (callable, method name, atomic section id) More...
 
int $trxStatus = self::STATUS_TRX_NONE
 Transaction status. More...
 
Throwable null $trxStatusCause
 The cause of any unresolved transaction state error, or, null. More...
 
array null $trxStatusIgnoredCause
 Details of the last statement-rollback error for the last transaction. More...
 
float null $trxTimestamp = null
 UNIX timestamp at the time of BEGIN for the last transaction. More...
 
float $trxWriteAdjDuration = 0.0
 Like trxWriteQueryCount but excludes lock-bound, easy to replicate, queries. More...
 
int $trxWriteAdjQueryCount = 0
 Number of write queries counted in trxWriteAdjDuration. More...
 
int $trxWriteAffectedRows = 0
 Number of rows affected by write queries for the current transaction. More...
 
string[] $trxWriteCallers = []
 Write query callers of the current transaction. More...
 
float $trxWriteDuration = 0.0
 Seconds spent in write queries for the current transaction. More...
 
int $trxWriteQueryCount = 0
 Number of write queries for the current transaction. More...
 

Detailed Description

Access: internal
This class should not be used outside of Database

Definition at line 35 of file TransactionManager.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\TransactionManager::__construct ( LoggerInterface  $logger = null,
  $profiler = null 
)

Member Function Documentation

◆ addPostCommitOrIdleCallback()

Wikimedia\Rdbms\TransactionManager::addPostCommitOrIdleCallback ( callable  $callback,
  $fname = __METHOD__ 
)

Definition at line 631 of file TransactionManager.php.

◆ addPreCommitOrIdleCallback()

Wikimedia\Rdbms\TransactionManager::addPreCommitOrIdleCallback ( callable  $callback,
  $fname = __METHOD__ 
)
final

Definition at line 639 of file TransactionManager.php.

◆ addToAtomicLevels()

Wikimedia\Rdbms\TransactionManager::addToAtomicLevels (   $fname,
AtomicSectionIdentifier  $sectionId,
  $savepointId 
)

Definition at line 416 of file TransactionManager.php.

◆ assertSessionStatus()

Wikimedia\Rdbms\TransactionManager::assertSessionStatus ( IDatabase  $db,
  $fname 
)

Definition at line 222 of file TransactionManager.php.

◆ assertTransactionStatus()

Wikimedia\Rdbms\TransactionManager::assertTransactionStatus ( IDatabase  $db,
  $deprecationLogger,
  $fname 
)

Definition at line 204 of file TransactionManager.php.

◆ calculateLastTrxApplyTime()

Wikimedia\Rdbms\TransactionManager::calculateLastTrxApplyTime ( float  $rtt)
private
Parameters
float$rtt
Returns
float Time to apply writes to replicas based on trxWrite* fields

Definition at line 282 of file TransactionManager.php.

◆ cancelAtomic()

Wikimedia\Rdbms\TransactionManager::cancelAtomic (   $pos)

Definition at line 516 of file TransactionManager.php.

◆ clearEndCallbacks()

Wikimedia\Rdbms\TransactionManager::clearEndCallbacks ( )

Definition at line 835 of file TransactionManager.php.

◆ clearPreEndCallbacks()

Wikimedia\Rdbms\TransactionManager::clearPreEndCallbacks ( )

Definition at line 830 of file TransactionManager.php.

◆ clearSessionError()

Wikimedia\Rdbms\TransactionManager::clearSessionError ( )

Unflag the session as needing a reset due to an error.

Definition at line 274 of file TransactionManager.php.

◆ consumeEndCallbacks()

Wikimedia\Rdbms\TransactionManager::consumeEndCallbacks (   $trigger)

Definition at line 752 of file TransactionManager.php.

◆ consumeTrxId()

Wikimedia\Rdbms\TransactionManager::consumeTrxId ( )

Reset the application-side transaction identifier instance and return the old one.

This will become private soon.

Returns
TransactionIdentifier|null The old transaction token; null if there wasn't one

Definition at line 173 of file TransactionManager.php.

References Wikimedia\Rdbms\TransactionManager\$trxId.

◆ countPostCommitOrIdleCallbacks()

Wikimedia\Rdbms\TransactionManager::countPostCommitOrIdleCallbacks ( )

Definition at line 893 of file TransactionManager.php.

◆ currentAtomicSectionId()

Wikimedia\Rdbms\TransactionManager::currentAtomicSectionId ( )
Returns
AtomicSectionIdentifier|null ID of the topmost atomic section level

Definition at line 406 of file TransactionManager.php.

◆ explicitTrxActive()

Wikimedia\Rdbms\TransactionManager::explicitTrxActive ( )

Definition at line 360 of file TransactionManager.php.

◆ flatAtomicSectionList()

Wikimedia\Rdbms\TransactionManager::flatAtomicSectionList ( )
private
Returns
string

Definition at line 350 of file TransactionManager.php.

◆ getPositionFromSectionId()

Wikimedia\Rdbms\TransactionManager::getPositionFromSectionId ( AtomicSectionIdentifier  $sectionId = null)

Definition at line 500 of file TransactionManager.php.

◆ getRecurringCallbacks()

Wikimedia\Rdbms\TransactionManager::getRecurringCallbacks ( )

Definition at line 889 of file TransactionManager.php.

◆ getTrxId()

Wikimedia\Rdbms\TransactionManager::getTrxId ( )

Get the application-side transaction identifier instance.

Returns
TransactionIdentifier Token for the active transaction; null if there isn't one

Definition at line 163 of file TransactionManager.php.

References Wikimedia\Rdbms\TransactionManager\$trxId.

◆ isClean()

Wikimedia\Rdbms\TransactionManager::isClean ( )

Definition at line 553 of file TransactionManager.php.

◆ isEndCallbacksSuppressed()

Wikimedia\Rdbms\TransactionManager::isEndCallbacksSuppressed ( )

Definition at line 885 of file TransactionManager.php.

◆ modifyCallbacksForCancel()

Wikimedia\Rdbms\TransactionManager::modifyCallbacksForCancel ( IDatabase  $db,
array  $sectionIds,
AtomicSectionIdentifier  $newSectionId = null 
)

Update callbacks that were owned by cancelled atomic sections.

Callbacks for "on commit" should never be run if they're owned by a section that won't be committed.

Callbacks for "on resolution" need to reflect that the section was rolled back, even if the transaction as a whole commits successfully.

Callbacks for "on section cancel" should already have been consumed, but errors during the cancellation itself can prevent that while still destroying the section. Hoist any such callbacks to the new top section, which we assume will itself have to be cancelled or rolled back to resolve the error.

Parameters
IDatabase$db
AtomicSectionIdentifier[]$sectionIdsID of an actual savepoint
AtomicSectionIdentifier | null$newSectionIdNew top section ID.
Exceptions
UnexpectedValueException

Definition at line 715 of file TransactionManager.php.

◆ newTrxId()

Wikimedia\Rdbms\TransactionManager::newTrxId (   $mode,
  $fname 
)

TODO: This should be removed once all usages have been migrated here.

Parameters
string$modeOne of IDatabase::TRANSACTION_* values
string$fnamemethod name

Definition at line 134 of file TransactionManager.php.

References Wikimedia\Rdbms\TransactionManager\trxStatus(), and Wikimedia\Rdbms\TransactionManager\trxTimestamp().

◆ nextSavePointId()

Wikimedia\Rdbms\TransactionManager::nextSavePointId ( IDatabase  $db,
  $fname 
)

Definition at line 565 of file TransactionManager.php.

◆ onAtomicSectionCancel()

Wikimedia\Rdbms\TransactionManager::onAtomicSectionCancel ( IDatabase  $db,
  $callback,
  $fname 
)

Definition at line 390 of file TransactionManager.php.

◆ onBeginTransaction()

Wikimedia\Rdbms\TransactionManager::onBeginTransaction ( IDatabase  $db,
  $fname 
)

Definition at line 422 of file TransactionManager.php.

◆ onCancelAtomicBeforeCriticalSection()

Wikimedia\Rdbms\TransactionManager::onCancelAtomicBeforeCriticalSection ( IDatabase  $db,
  $fname 
)

Definition at line 397 of file TransactionManager.php.

◆ onCommit()

Wikimedia\Rdbms\TransactionManager::onCommit ( IDatabase  $db,
  $fname,
  $flush 
)
Parameters
IDatabase$db
string$fname
string$flushone of IDatabase::FLUSHING_* values
Returns
bool false if the commit should go aborted, true otherwise.

Definition at line 443 of file TransactionManager.php.

◆ onCommitInCriticalSection()

Wikimedia\Rdbms\TransactionManager::onCommitInCriticalSection ( IDatabase  $db)

Definition at line 905 of file TransactionManager.php.

◆ onDestruct()

Wikimedia\Rdbms\TransactionManager::onDestruct ( )

Definition at line 584 of file TransactionManager.php.

◆ onEndAtomic()

Wikimedia\Rdbms\TransactionManager::onEndAtomic ( IDatabase  $db,
  $fname 
)

Definition at line 481 of file TransactionManager.php.

◆ onEndAtomicInCriticalSection()

Wikimedia\Rdbms\TransactionManager::onEndAtomicInCriticalSection (   $sectionId)

Definition at line 916 of file TransactionManager.php.

◆ onFlushSnapshot()

Wikimedia\Rdbms\TransactionManager::onFlushSnapshot ( IDatabase  $db,
  $fname,
  $flush,
  $trxRoundId 
)

Definition at line 925 of file TransactionManager.php.

◆ onGetScopedLockAndFlush()

Wikimedia\Rdbms\TransactionManager::onGetScopedLockAndFlush ( IDatabase  $db,
  $fname 
)

Definition at line 958 of file TransactionManager.php.

◆ onRollback()

Wikimedia\Rdbms\TransactionManager::onRollback ( IDatabase  $db)

Definition at line 897 of file TransactionManager.php.

◆ onTransactionResolution()

Wikimedia\Rdbms\TransactionManager::onTransactionResolution ( IDatabase  $db,
callable  $callback,
  $fname 
)

Definition at line 624 of file TransactionManager.php.

◆ pendingPreCommitCallbackCallers()

Wikimedia\Rdbms\TransactionManager::pendingPreCommitCallbackCallers ( )

List the methods that have precommit callbacks for the current transaction.

Returns
string[]

Definition at line 876 of file TransactionManager.php.

◆ pendingWriteAndCallbackCallers()

Wikimedia\Rdbms\TransactionManager::pendingWriteAndCallbackCallers ( )

List the methods that have write queries or callbacks for the current transaction.

Returns
string[]

Definition at line 855 of file TransactionManager.php.

◆ pendingWriteCallers()

Wikimedia\Rdbms\TransactionManager::pendingWriteCallers ( )

Definition at line 292 of file TransactionManager.php.

◆ pendingWriteQueryDuration()

Wikimedia\Rdbms\TransactionManager::pendingWriteQueryDuration ( IDatabase  $db,
  $type = IDatabase::ESTIMATE_TOTAL 
)

Definition at line 332 of file TransactionManager.php.

References $type, and Wikimedia\Rdbms\IDatabase\ping().

◆ popAtomicLevel()

Wikimedia\Rdbms\TransactionManager::popAtomicLevel ( )

Definition at line 549 of file TransactionManager.php.

◆ reassignCallbacksForSection()

Wikimedia\Rdbms\TransactionManager::reassignCallbacksForSection ( AtomicSectionIdentifier  $old,
AtomicSectionIdentifier  $new 
)

Hoist callback ownership for callbacks in a section to a parent section.

All callbacks should have an owner that is present in trxAtomicLevels.

Parameters
AtomicSectionIdentifier$old
AtomicSectionIdentifier$new

Definition at line 669 of file TransactionManager.php.

◆ recordQueryCompletion()

Wikimedia\Rdbms\TransactionManager::recordQueryCompletion (   $sql,
  $startTime,
  $isPermWrite,
  $rowCount,
  $serverName 
)

Definition at line 613 of file TransactionManager.php.

◆ resetTrxAtomicLevels()

Wikimedia\Rdbms\TransactionManager::resetTrxAtomicLevels ( )

Definition at line 356 of file TransactionManager.php.

◆ runOnAtomicSectionCancelCallbacks()

Wikimedia\Rdbms\TransactionManager::runOnAtomicSectionCancelCallbacks ( IDatabase  $db,
int  $trigger,
array  $sectionIds 
)

Consume and run any relevant "on atomic section cancel" callbacks for the active transaction.

Parameters
IDatabase$db
int$triggerIDatabase::TRIGGER_* constant
AtomicSectionIdentifier[]$sectionIdsIDs of the sections that where just cancelled
Exceptions
ThrowableAny exception thrown by a callback

Definition at line 775 of file TransactionManager.php.

◆ runOnTransactionPreCommitCallbacks()

Wikimedia\Rdbms\TransactionManager::runOnTransactionPreCommitCallbacks ( IDatabase  $db)

Consume and run any "on transaction pre-commit" callbacks.

Parameters
IDatabase$db
Returns
int Number of callbacks attempted
Exceptions
ThrowableAny exception thrown by a callback

Definition at line 807 of file TransactionManager.php.

◆ sessionStatus()

Wikimedia\Rdbms\TransactionManager::sessionStatus ( )

Get the status of the current session (ephemeral server-side state tied to the connection)

Returns
int One of the STATUS_SESSION_* class constants

Definition at line 257 of file TransactionManager.php.

◆ setAutomaticAtomic()

Wikimedia\Rdbms\TransactionManager::setAutomaticAtomic (   $value)

Definition at line 557 of file TransactionManager.php.

◆ setSessionError()

Wikimedia\Rdbms\TransactionManager::setSessionError ( Throwable  $sessionError)

Flag the session as needing a reset due to an error, if not already flagged.

Parameters
Throwable$sessionError

Definition at line 267 of file TransactionManager.php.

◆ setTransactionError()

Wikimedia\Rdbms\TransactionManager::setTransactionError ( Throwable  $trxError)

Mark the transaction as requiring rollback (STATUS_TRX_ERROR) due to an error.

Parameters
Throwable$trxError

Definition at line 238 of file TransactionManager.php.

◆ setTransactionListener()

Wikimedia\Rdbms\TransactionManager::setTransactionListener (   $name,
callable  $callback = null 
)

Definition at line 647 of file TransactionManager.php.

◆ setTrxEndCallbackSuppression()

Wikimedia\Rdbms\TransactionManager::setTrxEndCallbackSuppression ( bool  $suppress)

Whether to disable running of post-COMMIT/ROLLBACK callbacks.

Parameters
bool$suppress

Definition at line 659 of file TransactionManager.php.

◆ setTrxStatusIgnoredCause()

Wikimedia\Rdbms\TransactionManager::setTrxStatusIgnoredCause ( ?array  $trxStatusIgnoredCause)
Parameters
array | null$trxStatusIgnoredCause

Definition at line 248 of file TransactionManager.php.

◆ setTrxStatusToNone()

Wikimedia\Rdbms\TransactionManager::setTrxStatusToNone ( )

Definition at line 198 of file TransactionManager.php.

◆ setTrxStatusToOk()

Wikimedia\Rdbms\TransactionManager::setTrxStatusToOk ( )

Definition at line 192 of file TransactionManager.php.

◆ transactionWritingIn()

Wikimedia\Rdbms\TransactionManager::transactionWritingIn (   $serverName,
  $domainId 
)

Definition at line 590 of file TransactionManager.php.

◆ transactionWritingOut()

Wikimedia\Rdbms\TransactionManager::transactionWritingOut ( IDatabase  $db,
  $oldId 
)

◆ trxCheckBeforeClose()

Wikimedia\Rdbms\TransactionManager::trxCheckBeforeClose ( IDatabase  $db,
  $fname 
)

◆ trxLevel()

Wikimedia\Rdbms\TransactionManager::trxLevel ( )

Definition at line 125 of file TransactionManager.php.

◆ trxStatus()

Wikimedia\Rdbms\TransactionManager::trxStatus ( )
Returns
int One of the STATUS_TRX_* class constants

Definition at line 188 of file TransactionManager.php.

Referenced by Wikimedia\Rdbms\TransactionManager\newTrxId().

◆ trxTimestamp()

Wikimedia\Rdbms\TransactionManager::trxTimestamp ( )

Definition at line 181 of file TransactionManager.php.

Referenced by Wikimedia\Rdbms\TransactionManager\newTrxId().

◆ turnOnAutomatic()

Wikimedia\Rdbms\TransactionManager::turnOnAutomatic ( )

Definition at line 561 of file TransactionManager.php.

◆ updateTrxWriteQueryReport()

Wikimedia\Rdbms\TransactionManager::updateTrxWriteQueryReport (   $queryVerb,
  $runtime,
  $affected,
  $fname 
)

Update the estimated run-time of a query, not counting large row lock times.

LoadBalancer can be set to rollback transactions that will create huge replication lag. It bases this estimate off of pendingWriteQueryDuration(). Certain simple queries, like inserting a row can take a long time due to row locking. This method uses some simple heuristics to discount those cases.

Parameters
string$queryVerbaction in the write query
float$runtimeTotal runtime, including RTT
int$affectedAffected row count
string$fnamemethod name invoking the action

Definition at line 309 of file TransactionManager.php.

◆ writesOrCallbacksPending()

Wikimedia\Rdbms\TransactionManager::writesOrCallbacksPending ( )

Definition at line 840 of file TransactionManager.php.

◆ writesPending()

Wikimedia\Rdbms\TransactionManager::writesPending ( )

Definition at line 580 of file TransactionManager.php.

Member Data Documentation

◆ $logger

LoggerInterface Wikimedia\Rdbms\TransactionManager::$logger
private

◆ $profiler

TransactionProfiler Wikimedia\Rdbms\TransactionManager::$profiler
private

◆ $sessionError

Throwable null Wikimedia\Rdbms\TransactionManager::$sessionError
private

The cause of any unresolved session state loss error, or, null.

Definition at line 70 of file TransactionManager.php.

◆ $trxAtomicCounter

int Wikimedia\Rdbms\TransactionManager::$trxAtomicCounter = 0
private

Counter for atomic savepoint identifiers (reset with each transaction)

Definition at line 97 of file TransactionManager.php.

◆ $trxAtomicLevels

array Wikimedia\Rdbms\TransactionManager::$trxAtomicLevels = []
private

List of (name, unique ID, savepoint ID) for each active atomic section level.

Definition at line 86 of file TransactionManager.php.

◆ $trxAutomatic

bool Wikimedia\Rdbms\TransactionManager::$trxAutomatic = false
private

Whether the current transaction was started implicitly due to DBO_TRX.

Definition at line 88 of file TransactionManager.php.

◆ $trxAutomaticAtomic

bool Wikimedia\Rdbms\TransactionManager::$trxAutomaticAtomic = false
private

Whether the current transaction was started implicitly by startAtomic()

Definition at line 90 of file TransactionManager.php.

◆ $trxDoneWrites

bool Wikimedia\Rdbms\TransactionManager::$trxDoneWrites = false
private

Whether possible write queries were done in the last transaction started.

Definition at line 95 of file TransactionManager.php.

◆ $trxEndCallbacks

array [] Wikimedia\Rdbms\TransactionManager::$trxEndCallbacks = []
private

List of (callable, method name, atomic section id)

Definition at line 107 of file TransactionManager.php.

◆ $trxEndCallbacksSuppressed

bool Wikimedia\Rdbms\TransactionManager::$trxEndCallbacksSuppressed = false
private

Whether to suppress triggering of transaction end callbacks.

Definition at line 113 of file TransactionManager.php.

◆ $trxFname

string null Wikimedia\Rdbms\TransactionManager::$trxFname = null
private

Name of the function that start the last transaction.

Definition at line 93 of file TransactionManager.php.

◆ $trxId

TransactionIdentifier null Wikimedia\Rdbms\TransactionManager::$trxId
private
Initial value:
=
private const SAVEPOINT_PREFIX 'wikimedia_rdbms_atomic'

Application-side ID of the active transaction; null if none.

Definition at line 59 of file TransactionManager.php.

Referenced by Wikimedia\Rdbms\TransactionManager\consumeTrxId(), and Wikimedia\Rdbms\TransactionManager\getTrxId().

◆ $trxPostCommitOrIdleCallbacks

array [] Wikimedia\Rdbms\TransactionManager::$trxPostCommitOrIdleCallbacks = []
private

List of (callable, method name, atomic section id)

Definition at line 100 of file TransactionManager.php.

◆ $trxPreCommitOrIdleCallbacks

array [] Wikimedia\Rdbms\TransactionManager::$trxPreCommitOrIdleCallbacks = []
private

List of (callable, method name, atomic section id)

Definition at line 102 of file TransactionManager.php.

◆ $trxRecurringCallbacks

callable [] Wikimedia\Rdbms\TransactionManager::$trxRecurringCallbacks = []
private

Map of (name => callable)

Definition at line 111 of file TransactionManager.php.

◆ $trxSectionCancelCallbacks

array [] Wikimedia\Rdbms\TransactionManager::$trxSectionCancelCallbacks = []
private

List of (callable, method name, atomic section id)

Definition at line 109 of file TransactionManager.php.

◆ $trxStatus

int Wikimedia\Rdbms\TransactionManager::$trxStatus = self::STATUS_TRX_NONE
private

Transaction status.

Definition at line 63 of file TransactionManager.php.

◆ $trxStatusCause

Throwable null Wikimedia\Rdbms\TransactionManager::$trxStatusCause
private

The cause of any unresolved transaction state error, or, null.

Definition at line 65 of file TransactionManager.php.

◆ $trxStatusIgnoredCause

array null Wikimedia\Rdbms\TransactionManager::$trxStatusIgnoredCause
private

Details of the last statement-rollback error for the last transaction.

Definition at line 67 of file TransactionManager.php.

◆ $trxTimestamp

float null Wikimedia\Rdbms\TransactionManager::$trxTimestamp = null
private

UNIX timestamp at the time of BEGIN for the last transaction.

Definition at line 61 of file TransactionManager.php.

◆ $trxWriteAdjDuration

float Wikimedia\Rdbms\TransactionManager::$trxWriteAdjDuration = 0.0
private

Like trxWriteQueryCount but excludes lock-bound, easy to replicate, queries.

Definition at line 81 of file TransactionManager.php.

◆ $trxWriteAdjQueryCount

int Wikimedia\Rdbms\TransactionManager::$trxWriteAdjQueryCount = 0
private

Number of write queries counted in trxWriteAdjDuration.

Definition at line 83 of file TransactionManager.php.

◆ $trxWriteAffectedRows

int Wikimedia\Rdbms\TransactionManager::$trxWriteAffectedRows = 0
private

Number of rows affected by write queries for the current transaction.

Definition at line 79 of file TransactionManager.php.

◆ $trxWriteCallers

string [] Wikimedia\Rdbms\TransactionManager::$trxWriteCallers = []
private

Write query callers of the current transaction.

Definition at line 73 of file TransactionManager.php.

◆ $trxWriteDuration

float Wikimedia\Rdbms\TransactionManager::$trxWriteDuration = 0.0
private

Seconds spent in write queries for the current transaction.

Definition at line 75 of file TransactionManager.php.

◆ $trxWriteQueryCount

int Wikimedia\Rdbms\TransactionManager::$trxWriteQueryCount = 0
private

Number of write queries for the current transaction.

Definition at line 77 of file TransactionManager.php.

◆ STATUS_SESS_ERROR

const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_ERROR = 1

Session is in a error state requiring a reset.

Definition at line 44 of file TransactionManager.php.

◆ STATUS_SESS_OK

const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_OK = 2

Session is in a normal state.

Definition at line 46 of file TransactionManager.php.


The documentation for this class was generated from the following file: