|
MediaWiki master
|
Public Member Functions | |
| __construct (?LoggerInterface $logger=null, ?TransactionProfiler $profiler=null) | |
| addPostCommitOrIdleCallback (callable $callback, string $fname) | |
| addPreCommitOrIdleCallback (callable $callback, string $fname) | |
| addToAtomicLevels (string $fname, AtomicSectionIdentifier $sectionId, ?string $savepointId) | |
| assertSessionStatus (IDatabase $db, string $fname) | |
| assertTransactionStatus (IDatabase $db, $deprecationLogger, $fname) | |
| cancelAtomic (?int $pos) | |
| clearEndCallbacks () | |
| clearPreEndCallbacks () | |
| clearSessionError () | |
| Unflag the session as needing a reset due to an error. | |
| consumeEndCallbacks () | |
| countPostCommitOrIdleCallbacks () | |
| currentAtomicSectionId () | |
| explicitTrxActive () | |
| getPositionFromSectionId (?AtomicSectionIdentifier $sectionId=null) | |
| getRecurringCallbacks () | |
| getTrxId () | |
| Get the application-side transaction identifier instance. | |
| isEndCallbacksSuppressed () | |
| modifyCallbacksForCancel (array $excisedSectionsId, ?AtomicSectionIdentifier $newSectionId=null) | |
| Update callbacks that were owned by cancelled atomic sections. | |
| nextSavePointId (IDatabase $db, string $fname) | |
| onBegin (IDatabase $db, string $fname) | |
| onBeginInCriticalSection ( $mode, $fname, $rtt) | |
| onCancelAtomicBeforeCriticalSection (IDatabase $db, string $fname) | |
| onCommit (IDatabase $db, $fname, $flush) | |
| onCommitInCriticalSection (IDatabase $db) | |
| onDestruct () | |
| onEndAtomic (IDatabase $db, string $fname) | |
| onEndAtomicInCriticalSection (AtomicSectionIdentifier $sectionId) | |
| onFlushSnapshot (IDatabase $db, string $fname, string $flush, ?string $trxRoundFname) | |
| onGetScopedLockAndFlush (IDatabase $db, string $fname) | |
| onRollbackInCriticalSection (IDatabase $db) | |
| onSessionLoss (IDatabase $db) | |
| onTransactionResolution (IDatabase $db, callable $callback, string $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 (string $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 () | |
| runOnTransactionPreCommitCallbacks () | |
| 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 (bool $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 (string $name, ?callable $callback=null) | |
| setTrxEndCallbackSuppression (bool $suppress) | |
| Whether to disable running of post-COMMIT/ROLLBACK callbacks. | |
| setTrxStatusIgnoredCause (?array $trxStatusIgnoredCause) | |
| setTrxStatusToNone () | |
| setTrxStatusToOk () | |
| transactionWritingIn (string $serverName, ?string $domainId, float $startTime) | |
| transactionWritingOut (IDatabase $db, string $oldId) | |
| trxCheckBeforeClose (IDatabaseForOwner $db, string $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. | |
| const | STATUS_TRX_ERROR = 1 |
| Transaction is in a error state requiring a full or savepoint rollback. | |
| const | STATUS_TRX_NONE = 3 |
| No transaction is active. | |
| const | STATUS_TRX_OK = 2 |
| Transaction is active and in a normal state. | |
Definition at line 18 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::__construct | ( | ?LoggerInterface | $logger = null, |
| ?TransactionProfiler | $profiler = null ) |
Definition at line 107 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::addPostCommitOrIdleCallback | ( | callable | $callback, |
| string | $fname ) |
Definition at line 588 of file TransactionManager.php.
|
final |
Definition at line 596 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::addToAtomicLevels | ( | string | $fname, |
| AtomicSectionIdentifier | $sectionId, | ||
| ?string | $savepointId ) |
Definition at line 363 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::assertSessionStatus | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 183 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::assertTransactionStatus | ( | IDatabase | $db, |
| $deprecationLogger, | |||
| $fname ) |
| IDatabase | $db | |
| callable | $deprecationLogger | |
| string | $fname |
Definition at line 165 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::cancelAtomic | ( | ?int | $pos | ) |
Definition at line 465 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::clearEndCallbacks | ( | ) |
Definition at line 740 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::clearPreEndCallbacks | ( | ) |
Definition at line 735 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::clearSessionError | ( | ) |
Unflag the session as needing a reset due to an error.
Definition at line 228 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::consumeEndCallbacks | ( | ) |
Definition at line 696 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::countPostCommitOrIdleCallbacks | ( | ) |
Definition at line 795 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::currentAtomicSectionId | ( | ) |
Definition at line 353 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::explicitTrxActive | ( | ) |
Definition at line 314 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::getPositionFromSectionId | ( | ?AtomicSectionIdentifier | $sectionId = null | ) |
Definition at line 449 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::getRecurringCallbacks | ( | ) |
Definition at line 791 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::getTrxId | ( | ) |
Get the application-side transaction identifier instance.
Definition at line 121 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::isEndCallbacksSuppressed | ( | ) |
Definition at line 787 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::modifyCallbacksForCancel | ( | array | $excisedSectionsId, |
| ?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.
| AtomicSectionIdentifier[] | $excisedSectionsId | Cancelled section IDs |
| AtomicSectionIdentifier | null | $newSectionId | New top section ID |
| UnexpectedValueException |
Definition at line 666 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::nextSavePointId | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 515 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onBegin | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 369 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onBeginInCriticalSection | ( | $mode, | |
| $fname, | |||
| $rtt ) |
| string | $mode | One of IDatabase::TRANSACTION_* values |
| string | $fname | method name |
| float | $rtt | Trivial query round-trip-delay |
Definition at line 804 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onCancelAtomicBeforeCriticalSection | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 344 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 392 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onCommitInCriticalSection | ( | IDatabase | $db | ) |
Definition at line 833 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onDestruct | ( | ) |
Definition at line 534 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onEndAtomic | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 430 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onEndAtomicInCriticalSection | ( | AtomicSectionIdentifier | $sectionId | ) |
Definition at line 852 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onFlushSnapshot | ( | IDatabase | $db, |
| string | $fname, | ||
| string | $flush, | ||
| ?string | $trxRoundFname ) |
Definition at line 861 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onGetScopedLockAndFlush | ( | IDatabase | $db, |
| string | $fname ) |
Definition at line 894 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onRollbackInCriticalSection | ( | IDatabase | $db | ) |
Definition at line 825 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onSessionLoss | ( | IDatabase | $db | ) |
Definition at line 846 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::onTransactionResolution | ( | IDatabase | $db, |
| callable | $callback, | ||
| string | $fname ) |
Definition at line 581 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::pendingPreCommitCallbackCallers | ( | ) |
List the methods that have precommit callbacks for the current transaction.
Definition at line 778 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::pendingWriteAndCallbackCallers | ( | ) |
List the methods that have write queries or callbacks for the current transaction.
Definition at line 758 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::pendingWriteCallers | ( | ) |
Definition at line 246 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::pendingWriteQueryDuration | ( | string | $type = IDatabase::ESTIMATE_TOTAL | ) |
Definition at line 286 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::popAtomicLevel | ( | ) |
Definition at line 501 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 626 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::recordQueryCompletion | ( | $sql, | |
| $startTime, | |||
| $isPermWrite, | |||
| $rowCount, | |||
| $serverName ) |
| string | GeneralizedSql | $sql | |
| float | $startTime | |
| bool | $isPermWrite | |
| int | null | $rowCount | |
| string | null | $serverName |
Definition at line 570 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::resetTrxAtomicLevels | ( | ) |
Definition at line 309 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::runOnTransactionPreCommitCallbacks | ( | ) |
Consume and run any "on transaction pre-commit" callbacks.
| Throwable | Any exception thrown by a callback |
Definition at line 713 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 213 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setAutomaticAtomic | ( | bool | $value | ) |
Definition at line 507 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.
Definition at line 221 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTransactionError | ( | Throwable | $trxError | ) |
Mark the transaction as requiring rollback (STATUS_TRX_ERROR) due to an error.
Definition at line 197 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTransactionListener | ( | string | $name, |
| ?callable | $callback = null ) |
Definition at line 604 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTrxEndCallbackSuppression | ( | bool | $suppress | ) |
Whether to disable running of post-COMMIT/ROLLBACK callbacks.
| bool | $suppress |
Definition at line 616 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTrxStatusIgnoredCause | ( | ?array | $trxStatusIgnoredCause | ) |
Definition at line 204 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTrxStatusToNone | ( | ) |
Definition at line 154 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::setTrxStatusToOk | ( | ) |
Definition at line 148 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::transactionWritingIn | ( | string | $serverName, |
| ?string | $domainId, | ||
| float | $startTime ) |
Definition at line 540 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::transactionWritingOut | ( | IDatabase | $db, |
| string | $oldId ) |
Definition at line 551 of file TransactionManager.php.
References Wikimedia\Rdbms\IReadableDatabase\getDomainID(), and Wikimedia\Rdbms\IReadableDatabase\getServerName().
| Wikimedia\Rdbms\TransactionManager::trxCheckBeforeClose | ( | IDatabaseForOwner | $db, |
| string | $fname ) |
Definition at line 318 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::trxLevel | ( | ) |
Definition at line 112 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::trxStatus | ( | ) |
Definition at line 144 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::trxTimestamp | ( | ) |
Definition at line 137 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::turnOnAutomatic | ( | ) |
Definition at line 511 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 263 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::writesOrCallbacksPending | ( | ) |
Definition at line 744 of file TransactionManager.php.
| Wikimedia\Rdbms\TransactionManager::writesPending | ( | ) |
Definition at line 530 of file TransactionManager.php.
| const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_ERROR = 1 |
Session is in a error state requiring a reset.
Definition at line 27 of file TransactionManager.php.
| const Wikimedia\Rdbms\TransactionManager::STATUS_SESS_OK = 2 |
Session is in a normal state.
Definition at line 29 of file TransactionManager.php.
| const Wikimedia\Rdbms\TransactionManager::STATUS_TRX_ERROR = 1 |
Transaction is in a error state requiring a full or savepoint rollback.
Definition at line 20 of file TransactionManager.php.
| const Wikimedia\Rdbms\TransactionManager::STATUS_TRX_NONE = 3 |
No transaction is active.
Definition at line 24 of file TransactionManager.php.
| const Wikimedia\Rdbms\TransactionManager::STATUS_TRX_OK = 2 |
Transaction is active and in a normal state.
Definition at line 22 of file TransactionManager.php.