MediaWiki 1.39.10
|
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. | |
consumeEndCallbacks ( $trigger) | |
consumeTrxId () | |
Reset the application-side transaction identifier instance and return the old one. | |
countPostCommitOrIdleCallbacks () | |
currentAtomicSectionId () | |
explicitTrxActive () | |
getPositionFromSectionId (AtomicSectionIdentifier $sectionId=null) | |
getRecurringCallbacks () | |
getTrxId () | |
Get the application-side transaction identifier instance. | |
isClean () | |
isEndCallbacksSuppressed () | |
modifyCallbacksForCancel (IDatabase $db, array $sectionIds, AtomicSectionIdentifier $newSectionId=null) | |
Update callbacks that were owned by cancelled atomic sections. | |
newTrxId ( $mode, $fname) | |
TODO: This should be removed once all usages have been migrated here. | |
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. | |
pendingWriteAndCallbackCallers () | |
List the methods that have write queries or callbacks for the current transaction. | |
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. | |
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. | |
runOnTransactionPreCommitCallbacks (IDatabase $db) | |
Consume and run any "on transaction pre-commit" callbacks. | |
sessionStatus () | |
Get the status of the current session (ephemeral server-side state tied to the connection) | |
setAutomaticAtomic ( $value) | |
setSessionError (Throwable $sessionError) | |
Flag the session as needing a reset due to an error, if not already flagged. | |
setTransactionError (Throwable $trxError) | |
Mark the transaction as requiring rollback (STATUS_TRX_ERROR) due to an error. | |
setTransactionListener ( $name, callable $callback=null) | |
setTrxEndCallbackSuppression (bool $suppress) | |
Whether to disable running of post-COMMIT/ROLLBACK callbacks. | |
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. | |
writesOrCallbacksPending () | |
writesPending () | |
Public Attributes | |
const | STATUS_SESS_ERROR = 1 |
Session is in a error state requiring a reset. | |
const | STATUS_SESS_OK = 2 |
Session is in a normal state. | |
Definition at line 32 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::__construct | ( | LoggerInterface | $logger = null, |
$profiler = null ) |
Definition at line 117 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::addPostCommitOrIdleCallback | ( | callable | $callback, |
$fname = __METHOD__ ) |
Definition at line 628 of file TransactionManager.php.
|
final |
Definition at line 636 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::addToAtomicLevels | ( | $fname, | |
AtomicSectionIdentifier | $sectionId, | ||
$savepointId ) |
Definition at line 413 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::assertSessionStatus | ( | IDatabase | $db, |
$fname ) |
Definition at line 219 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::assertTransactionStatus | ( | IDatabase | $db, |
$deprecationLogger, | |||
$fname ) |
Definition at line 201 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::cancelAtomic | ( | $pos | ) |
Definition at line 513 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::clearEndCallbacks | ( | ) |
Definition at line 832 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::clearPreEndCallbacks | ( | ) |
Definition at line 827 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::clearSessionError | ( | ) |
Unflag the session as needing a reset due to an error.
Definition at line 271 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::consumeEndCallbacks | ( | $trigger | ) |
Definition at line 749 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::consumeTrxId | ( | ) |
Reset the application-side transaction identifier instance and return the old one.
This will become private soon.
Definition at line 170 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::countPostCommitOrIdleCallbacks | ( | ) |
Definition at line 890 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::currentAtomicSectionId | ( | ) |
Definition at line 403 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::explicitTrxActive | ( | ) |
Definition at line 357 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::getPositionFromSectionId | ( | AtomicSectionIdentifier | $sectionId = null | ) |
Definition at line 497 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::getRecurringCallbacks | ( | ) |
Definition at line 886 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::getTrxId | ( | ) |
Get the application-side transaction identifier instance.
Definition at line 160 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::isClean | ( | ) |
Definition at line 550 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::isEndCallbacksSuppressed | ( | ) |
Definition at line 882 of file TransactionManager.php.
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.
IDatabase | $db | |
AtomicSectionIdentifier[] | $sectionIds | ID of an actual savepoint |
AtomicSectionIdentifier | null | $newSectionId | New top section ID. |
UnexpectedValueException |
Definition at line 712 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::newTrxId | ( | $mode, | |
$fname ) |
TODO: This should be removed once all usages have been migrated here.
string | $mode | One of IDatabase::TRANSACTION_* values |
string | $fname | method name |
Definition at line 131 of file TransactionManager.php.
References Wikimedia\Rdbms\TransactionManager\trxStatus(), and Wikimedia\Rdbms\TransactionManager\trxTimestamp().
Wikimedia\Rdbms\TransactionManager::nextSavePointId | ( | IDatabase | $db, |
$fname ) |
Definition at line 562 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onAtomicSectionCancel | ( | IDatabase | $db, |
$callback, | |||
$fname ) |
Definition at line 387 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onBeginTransaction | ( | IDatabase | $db, |
$fname ) |
Definition at line 419 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onCancelAtomicBeforeCriticalSection | ( | IDatabase | $db, |
$fname ) |
Definition at line 394 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onCommit | ( | IDatabase | $db, |
$fname, | |||
$flush ) |
IDatabase | $db | |
string | $fname | |
string | $flush | one of IDatabase::FLUSHING_* values |
Definition at line 440 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onCommitInCriticalSection | ( | IDatabase | $db | ) |
Definition at line 902 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onDestruct | ( | ) |
Definition at line 581 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onEndAtomic | ( | IDatabase | $db, |
$fname ) |
Definition at line 478 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onEndAtomicInCriticalSection | ( | $sectionId | ) |
Definition at line 913 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onFlushSnapshot | ( | IDatabase | $db, |
$fname, | |||
$flush, | |||
$trxRoundId ) |
Definition at line 922 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onGetScopedLockAndFlush | ( | IDatabase | $db, |
$fname ) |
Definition at line 955 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onRollback | ( | IDatabase | $db | ) |
Definition at line 894 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::onTransactionResolution | ( | IDatabase | $db, |
callable | $callback, | ||
$fname ) |
Definition at line 621 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::pendingPreCommitCallbackCallers | ( | ) |
List the methods that have precommit callbacks for the current transaction.
Definition at line 873 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::pendingWriteAndCallbackCallers | ( | ) |
List the methods that have write queries or callbacks for the current transaction.
Definition at line 852 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::pendingWriteCallers | ( | ) |
Definition at line 289 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::pendingWriteQueryDuration | ( | IDatabase | $db, |
$type = IDatabase::ESTIMATE_TOTAL ) |
Definition at line 329 of file TransactionManager.php.
References $type, and Wikimedia\Rdbms\IDatabase\ping().
Wikimedia\Rdbms\TransactionManager::popAtomicLevel | ( | ) |
Definition at line 546 of file TransactionManager.php.
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.
AtomicSectionIdentifier | $old | |
AtomicSectionIdentifier | $new |
Definition at line 666 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::recordQueryCompletion | ( | $sql, | |
$startTime, | |||
$isPermWrite, | |||
$rowCount, | |||
$serverName ) |
Definition at line 610 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::resetTrxAtomicLevels | ( | ) |
Definition at line 353 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::runOnAtomicSectionCancelCallbacks | ( | IDatabase | $db, |
int | $trigger, | ||
array | $sectionIds ) |
Consume and run any relevant "on atomic section cancel" callbacks for the active transaction.
IDatabase | $db | |
int | $trigger | IDatabase::TRIGGER_* constant |
AtomicSectionIdentifier[] | $sectionIds | IDs of the sections that where just cancelled |
Throwable | Any exception thrown by a callback |
Definition at line 772 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::runOnTransactionPreCommitCallbacks | ( | IDatabase | $db | ) |
Consume and run any "on transaction pre-commit" callbacks.
IDatabase | $db |
Throwable | Any exception thrown by a callback |
Definition at line 804 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::sessionStatus | ( | ) |
Get the status of the current session (ephemeral server-side state tied to the connection)
Definition at line 254 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setAutomaticAtomic | ( | $value | ) |
Definition at line 554 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setSessionError | ( | Throwable | $sessionError | ) |
Flag the session as needing a reset due to an error, if not already flagged.
Throwable | $sessionError |
Definition at line 264 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTransactionError | ( | Throwable | $trxError | ) |
Mark the transaction as requiring rollback (STATUS_TRX_ERROR) due to an error.
Throwable | $trxError |
Definition at line 235 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTransactionListener | ( | $name, | |
callable | $callback = null ) |
Definition at line 644 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTrxEndCallbackSuppression | ( | bool | $suppress | ) |
Whether to disable running of post-COMMIT/ROLLBACK callbacks.
bool | $suppress |
Definition at line 656 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTrxStatusIgnoredCause | ( | ?array | $trxStatusIgnoredCause | ) |
array | null | $trxStatusIgnoredCause |
Definition at line 245 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTrxStatusToNone | ( | ) |
Definition at line 195 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::setTrxStatusToOk | ( | ) |
Definition at line 189 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::transactionWritingIn | ( | $serverName, | |
$domainId ) |
Definition at line 587 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::transactionWritingOut | ( | IDatabase | $db, |
$oldId ) |
Definition at line 598 of file TransactionManager.php.
References Wikimedia\Rdbms\IDatabase\getDomainID(), and Wikimedia\Rdbms\IDatabase\getServerName().
Wikimedia\Rdbms\TransactionManager::trxCheckBeforeClose | ( | IDatabase | $db, |
$fname ) |
Definition at line 361 of file TransactionManager.php.
References Wikimedia\Rdbms\IDatabase\writesOrCallbacksPending().
Wikimedia\Rdbms\TransactionManager::trxLevel | ( | ) |
Definition at line 122 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::trxStatus | ( | ) |
Definition at line 185 of file TransactionManager.php.
Referenced by Wikimedia\Rdbms\TransactionManager\newTrxId().
Wikimedia\Rdbms\TransactionManager::trxTimestamp | ( | ) |
Definition at line 178 of file TransactionManager.php.
Referenced by Wikimedia\Rdbms\TransactionManager\newTrxId().
Wikimedia\Rdbms\TransactionManager::turnOnAutomatic | ( | ) |
Definition at line 558 of file TransactionManager.php.
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.
string | $queryVerb | action in the write query |
float | $runtime | Total runtime, including RTT |
int | $affected | Affected row count |
string | $fname | method name invoking the action |
Definition at line 306 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::writesOrCallbacksPending | ( | ) |
Definition at line 837 of file TransactionManager.php.
Wikimedia\Rdbms\TransactionManager::writesPending | ( | ) |
Definition at line 577 of file TransactionManager.php.
const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_ERROR = 1 |
Session is in a error state requiring a reset.
Definition at line 41 of file TransactionManager.php.
const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_OK = 2 |
Session is in a normal state.
Definition at line 43 of file TransactionManager.php.