3 * Generator and manager of database load balancing objects
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
24 namespace Wikimedia\Rdbms
;
26 use Psr\Log\LoggerInterface
;
27 use Psr\Log\NullLogger
;
28 use Wikimedia\ScopedCallback
;
37 * An interface for generating database load balancers
40 abstract class LBFactory
implements ILBFactory
{
41 /** @var ChronologyProtector */
43 /** @var object|string Class name or object With profileIn/profileOut methods */
45 /** @var TransactionProfiler */
47 /** @var LoggerInterface */
49 /** @var LoggerInterface */
51 /** @var LoggerInterface */
53 /** @var LoggerInterface */
55 /** @var callable Error logger */
57 /** @var callable Deprecation logger */
58 private $deprecationLogger;
64 /** @var WANObjectCache */
67 /** @var DatabaseDomain Local domain */
68 protected $localDomain;
70 /** @var string Local hostname of the app server */
72 /** @var array Web request information about the client */
74 /** @var bool Whether this PHP instance is for a CLI script */
76 /** @var string Agent name for query profiling */
78 /** @var string Secret string for HMAC hashing */
81 /** @var array[] $aliases Map of (table => (dbname, schema, prefix) map) */
82 private $tableAliases = [];
83 /** @var string[] Map of (index alias => index) */
84 private $indexAliases = [];
85 /** @var callable[] */
86 private $replicationWaitCallbacks = [];
90 /** @var string|bool String if a requested DBO_TRX transaction round is active */
91 private $trxRoundId = false;
92 /** @var string One of the ROUND_* class constants */
93 private $trxRoundStage = self
::ROUND_CURSORY
;
95 /** @var string|bool Reason all LBs are read-only or false if not */
96 protected $readOnlyReason = false;
98 /** @var string|null */
99 private $defaultGroup = null;
104 const ROUND_CURSORY
= 'cursory';
105 const ROUND_BEGINNING
= 'within-begin';
106 const ROUND_COMMITTING
= 'within-commit';
107 const ROUND_ROLLING_BACK
= 'within-rollback';
108 const ROUND_COMMIT_CALLBACKS
= 'within-commit-callbacks';
109 const ROUND_ROLLBACK_CALLBACKS
= 'within-rollback-callbacks';
111 private static $loggerFields =
112 [ 'replLogger', 'connLogger', 'queryLogger', 'perfLogger' ];
114 public function __construct( array $conf ) {
115 $this->localDomain
= isset( $conf['localDomain'] )
116 ? DatabaseDomain
::newFromId( $conf['localDomain'] )
117 : DatabaseDomain
::newUnspecified();
119 $this->maxLag
= $conf['maxLag'] ??
null;
120 if ( isset( $conf['readOnlyReason'] ) && is_string( $conf['readOnlyReason'] ) ) {
121 $this->readOnlyReason
= $conf['readOnlyReason'];
124 $this->srvCache
= $conf['srvCache'] ??
new EmptyBagOStuff();
125 $this->memStash
= $conf['memStash'] ??
new EmptyBagOStuff();
126 $this->wanCache
= $conf['wanCache'] ?? WANObjectCache
::newEmpty();
128 foreach ( self
::$loggerFields as $key ) {
129 $this->$key = $conf[$key] ??
new NullLogger();
131 $this->errorLogger
= $conf['errorLogger'] ??
function ( Exception
$e ) {
132 trigger_error( get_class( $e ) . ': ' . $e->getMessage(), E_USER_WARNING
);
134 $this->deprecationLogger
= $conf['deprecationLogger'] ??
function ( $msg ) {
135 trigger_error( $msg, E_USER_DEPRECATED
);
138 $this->profiler
= $conf['profiler'] ??
null;
139 $this->trxProfiler
= $conf['trxProfiler'] ??
new TransactionProfiler();
141 $this->requestInfo
= [
142 'IPAddress' => $_SERVER[ 'REMOTE_ADDR' ] ??
'',
143 'UserAgent' => $_SERVER['HTTP_USER_AGENT'] ??
'',
144 // Headers application can inject via LBFactory::setRequestInfo()
145 'ChronologyProtection' => null,
146 'ChronologyClientId' => null, // prior $cpClientId value from LBFactory::shutdown()
147 'ChronologyPositionIndex' => null // prior $cpIndex value from LBFactory::shutdown()
150 $this->cliMode
= $conf['cliMode'] ??
( PHP_SAPI
=== 'cli' || PHP_SAPI
=== 'phpdbg' );
151 $this->hostname
= $conf['hostname'] ??
gethostname();
152 $this->agent
= $conf['agent'] ??
'';
153 $this->defaultGroup
= $conf['defaultGroup'] ??
null;
154 $this->secret
= $conf['secret'] ??
'';
156 $this->ticket
= mt_rand();
159 public function destroy() {
160 $this->shutdown( self
::SHUTDOWN_NO_CHRONPROT
);
161 $this->forEachLBCallMethod( 'disable' );
164 public function getLocalDomainID() {
165 return $this->localDomain
->getId();
168 public function resolveDomainID( $domain ) {
169 return ( $domain !== false ) ?
(string)$domain : $this->getLocalDomainID();
172 public function shutdown(
173 $mode = self
::SHUTDOWN_CHRONPROT_SYNC
,
174 callable
$workCallback = null,
178 $chronProt = $this->getChronologyProtector();
179 if ( $mode === self
::SHUTDOWN_CHRONPROT_SYNC
) {
180 $this->shutdownChronologyProtector( $chronProt, $workCallback, 'sync', $cpIndex );
181 } elseif ( $mode === self
::SHUTDOWN_CHRONPROT_ASYNC
) {
182 $this->shutdownChronologyProtector( $chronProt, null, 'async', $cpIndex );
185 $cpClientId = $chronProt->getClientId();
187 $this->commitMasterChanges( __METHOD__
); // sanity
191 * @see ILBFactory::newMainLB()
192 * @param bool $domain
193 * @return ILoadBalancer
195 abstract public function newMainLB( $domain = false );
198 * @see ILBFactory::getMainLB()
199 * @param bool $domain
200 * @return ILoadBalancer
202 abstract public function getMainLB( $domain = false );
205 * @see ILBFactory::newExternalLB()
206 * @param string $cluster
207 * @return ILoadBalancer
209 abstract public function newExternalLB( $cluster );
212 * @see ILBFactory::getExternalLB()
213 * @param string $cluster
214 * @return ILoadBalancer
216 abstract public function getExternalLB( $cluster );
219 * Call a method of each tracked load balancer
221 * @param string $methodName
224 protected function forEachLBCallMethod( $methodName, array $args = [] ) {
226 function ( ILoadBalancer
$loadBalancer, $methodName, array $args ) {
227 $loadBalancer->$methodName( ...$args );
229 [ $methodName, $args ]
233 public function flushReplicaSnapshots( $fname = __METHOD__
) {
234 $this->forEachLBCallMethod( 'flushReplicaSnapshots', [ $fname ] );
237 final public function commitAll( $fname = __METHOD__
, array $options = [] ) {
238 $this->commitMasterChanges( $fname, $options );
239 $this->forEachLBCallMethod( 'flushMasterSnapshots', [ $fname ] );
240 $this->forEachLBCallMethod( 'flushReplicaSnapshots', [ $fname ] );
243 final public function beginMasterChanges( $fname = __METHOD__
) {
244 $this->assertTransactionRoundStage( self
::ROUND_CURSORY
);
245 $this->trxRoundStage
= self
::ROUND_BEGINNING
;
246 if ( $this->trxRoundId
!== false ) {
247 throw new DBTransactionError(
249 "$fname: transaction round '{$this->trxRoundId}' already started."
252 $this->trxRoundId
= $fname;
253 // Set DBO_TRX flags on all appropriate DBs
254 $this->forEachLBCallMethod( 'beginMasterChanges', [ $fname ] );
255 $this->trxRoundStage
= self
::ROUND_CURSORY
;
258 final public function commitMasterChanges( $fname = __METHOD__
, array $options = [] ) {
259 $this->assertTransactionRoundStage( self
::ROUND_CURSORY
);
260 $this->trxRoundStage
= self
::ROUND_COMMITTING
;
261 if ( $this->trxRoundId
!== false && $this->trxRoundId
!== $fname ) {
262 throw new DBTransactionError(
264 "$fname: transaction round '{$this->trxRoundId}' still running."
267 /** @noinspection PhpUnusedLocalVariableInspection */
268 $scope = ScopedCallback
::newScopedIgnoreUserAbort(); // try to ignore client aborts
269 // Run pre-commit callbacks and suppress post-commit callbacks, aborting on failure
271 $count = 0; // number of callbacks executed this iteration
272 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$count ) {
273 $count +
= $lb->finalizeMasterChanges();
275 } while ( $count > 0 );
276 $this->trxRoundId
= false;
277 // Perform pre-commit checks, aborting on failure
278 $this->forEachLBCallMethod( 'approveMasterChanges', [ $options ] );
279 // Log the DBs and methods involved in multi-DB transactions
280 $this->logIfMultiDbTransaction();
281 // Actually perform the commit on all master DB connections and revert DBO_TRX
282 $this->forEachLBCallMethod( 'commitMasterChanges', [ $fname ] );
283 // Run all post-commit callbacks in a separate step
284 $this->trxRoundStage
= self
::ROUND_COMMIT_CALLBACKS
;
285 $e = $this->executePostTransactionCallbacks();
286 $this->trxRoundStage
= self
::ROUND_CURSORY
;
287 // Throw any last post-commit callback error
288 if ( $e instanceof Exception
) {
293 final public function rollbackMasterChanges( $fname = __METHOD__
) {
294 $this->trxRoundStage
= self
::ROUND_ROLLING_BACK
;
295 $this->trxRoundId
= false;
296 // Actually perform the rollback on all master DB connections and revert DBO_TRX
297 $this->forEachLBCallMethod( 'rollbackMasterChanges', [ $fname ] );
298 // Run all post-commit callbacks in a separate step
299 $this->trxRoundStage
= self
::ROUND_ROLLBACK_CALLBACKS
;
300 $this->executePostTransactionCallbacks();
301 $this->trxRoundStage
= self
::ROUND_CURSORY
;
305 * @return Exception|null
307 private function executePostTransactionCallbacks() {
308 // Run all post-commit callbacks until new ones stop getting added
309 $e = null; // first callback exception
311 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$e ) {
312 $ex = $lb->runMasterTransactionIdleCallbacks();
315 } while ( $this->hasMasterChanges() );
316 // Run all listener callbacks once
317 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$e ) {
318 $ex = $lb->runMasterTransactionListenerCallbacks();
325 public function hasTransactionRound() {
326 return ( $this->trxRoundId
!== false );
329 public function isReadyForRoundOperations() {
330 return ( $this->trxRoundStage
=== self
::ROUND_CURSORY
);
334 * Log query info if multi DB transactions are going to be committed now
336 private function logIfMultiDbTransaction() {
338 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$callersByDB ) {
339 $masterName = $lb->getServerName( $lb->getWriterIndex() );
340 $callers = $lb->pendingMasterChangeCallers();
342 $callersByDB[$masterName] = $callers;
346 if ( count( $callersByDB ) >= 2 ) {
347 $dbs = implode( ', ', array_keys( $callersByDB ) );
348 $msg = "Multi-DB transaction [{$dbs}]:\n";
349 foreach ( $callersByDB as $db => $callers ) {
350 $msg .= "$db: " . implode( '; ', $callers ) . "\n";
352 $this->queryLogger
->info( $msg );
356 public function hasMasterChanges() {
358 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$ret ) {
359 $ret = $ret ||
$lb->hasMasterChanges();
365 public function laggedReplicaUsed() {
367 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$ret ) {
368 $ret = $ret ||
$lb->laggedReplicaUsed();
374 public function hasOrMadeRecentMasterChanges( $age = null ) {
376 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $age, &$ret ) {
377 $ret = $ret ||
$lb->hasOrMadeRecentMasterChanges( $age );
382 public function waitForReplication( array $opts = [] ) {
386 'timeout' => $this->cliMode ?
60 : 1,
387 'ifWritesSince' => null
390 if ( $opts['domain'] === false && isset( $opts['wiki'] ) ) {
391 $opts['domain'] = $opts['wiki']; // b/c
394 // Figure out which clusters need to be checked
395 /** @var ILoadBalancer[] $lbs */
397 if ( $opts['cluster'] !== false ) {
398 $lbs[] = $this->getExternalLB( $opts['cluster'] );
399 } elseif ( $opts['domain'] !== false ) {
400 $lbs[] = $this->getMainLB( $opts['domain'] );
402 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$lbs ) {
406 return true; // nothing actually used
410 // Get all the master positions of applicable DBs right now.
411 // This can be faster since waiting on one cluster reduces the
412 // time needed to wait on the next clusters.
413 $masterPositions = array_fill( 0, count( $lbs ), false );
414 foreach ( $lbs as $i => $lb ) {
415 if ( $lb->getServerCount() <= 1 ) {
416 // T29975 - Don't try to wait for replica DBs if there are none
417 // Prevents permission error when getting master position
419 } elseif ( $opts['ifWritesSince']
420 && $lb->lastMasterChangeTimestamp() < $opts['ifWritesSince']
422 continue; // no writes since the last wait
424 $masterPositions[$i] = $lb->getMasterPos();
427 // Run any listener callbacks *after* getting the DB positions. The more
428 // time spent in the callbacks, the less time is spent in waitForAll().
429 foreach ( $this->replicationWaitCallbacks
as $callback ) {
434 foreach ( $lbs as $i => $lb ) {
435 if ( $masterPositions[$i] ) {
436 // The RDBMS may not support getMasterPos()
437 if ( !$lb->waitForAll( $masterPositions[$i], $opts['timeout'] ) ) {
438 $failed[] = $lb->getServerName( $lb->getWriterIndex() );
446 public function setWaitForReplicationListener( $name, callable
$callback = null ) {
448 $this->replicationWaitCallbacks
[$name] = $callback;
450 unset( $this->replicationWaitCallbacks
[$name] );
454 public function getEmptyTransactionTicket( $fname ) {
455 if ( $this->hasMasterChanges() ) {
456 $this->queryLogger
->error( __METHOD__
. ": $fname does not have outer scope.\n" .
457 ( new RuntimeException() )->getTraceAsString() );
462 return $this->ticket
;
465 final public function commitAndWaitForReplication( $fname, $ticket, array $opts = [] ) {
466 if ( $ticket !== $this->ticket
) {
467 $this->perfLogger
->error( __METHOD__
. ": $fname does not have outer scope.\n" .
468 ( new RuntimeException() )->getTraceAsString() );
473 // The transaction owner and any caller with the empty transaction ticket can commit
474 // so that getEmptyTransactionTicket() callers don't risk seeing DBTransactionError.
475 if ( $this->trxRoundId
!== false && $fname !== $this->trxRoundId
) {
476 $this->queryLogger
->info( "$fname: committing on behalf of {$this->trxRoundId}." );
477 $fnameEffective = $this->trxRoundId
;
479 $fnameEffective = $fname;
482 $this->commitMasterChanges( $fnameEffective );
483 $waitSucceeded = $this->waitForReplication( $opts );
484 // If a nested caller committed on behalf of $fname, start another empty $fname
485 // transaction, leaving the caller with the same empty transaction state as before.
486 if ( $fnameEffective !== $fname ) {
487 $this->beginMasterChanges( $fnameEffective );
490 return $waitSucceeded;
493 public function getChronologyProtectorTouched( $dbName ) {
494 return $this->getChronologyProtector()->getTouched( $dbName );
497 public function disableChronologyProtection() {
498 $this->getChronologyProtector()->setEnabled( false );
502 * @return ChronologyProtector
504 protected function getChronologyProtector() {
505 if ( $this->chronProt
) {
506 return $this->chronProt
;
509 $this->chronProt
= new ChronologyProtector(
512 'ip' => $this->requestInfo
['IPAddress'],
513 'agent' => $this->requestInfo
['UserAgent'],
514 'clientId' => $this->requestInfo
['ChronologyClientId']
516 $this->requestInfo
['ChronologyPositionIndex'],
519 $this->chronProt
->setLogger( $this->replLogger
);
521 if ( $this->cliMode
) {
522 $this->chronProt
->setEnabled( false );
523 } elseif ( $this->requestInfo
['ChronologyProtection'] === 'false' ) {
524 // Request opted out of using position wait logic. This is useful for requests
525 // done by the job queue or background ETL that do not have a meaningful session.
526 $this->chronProt
->setWaitEnabled( false );
527 } elseif ( $this->memStash
instanceof EmptyBagOStuff
) {
528 // No where to store any DB positions and wait for them to appear
529 $this->chronProt
->setEnabled( false );
530 $this->replLogger
->info( 'Cannot use ChronologyProtector with EmptyBagOStuff.' );
533 $this->replLogger
->debug( __METHOD__
. ': using request info ' .
534 json_encode( $this->requestInfo
, JSON_PRETTY_PRINT
) );
536 return $this->chronProt
;
540 * Get and record all of the staged DB positions into persistent memory storage
542 * @param ChronologyProtector $cp
543 * @param callable|null $workCallback Work to do instead of waiting on syncing positions
544 * @param string $mode One of (sync, async); whether to wait on remote datacenters
545 * @param int|null &$cpIndex DB position key write counter; incremented on update
547 protected function shutdownChronologyProtector(
548 ChronologyProtector
$cp, $workCallback, $mode, &$cpIndex = null
550 // Record all the master positions needed
551 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $cp ) {
552 $cp->shutdownLB( $lb );
554 // Write them to the persistent stash. Try to do something useful by running $work
555 // while ChronologyProtector waits for the stash write to replicate to all DCs.
556 $unsavedPositions = $cp->shutdown( $workCallback, $mode, $cpIndex );
557 if ( $unsavedPositions && $workCallback ) {
558 // Invoke callback in case it did not cache the result yet
559 $workCallback(); // work now to block for less time in waitForAll()
561 // If the positions failed to write to the stash, at least wait on local datacenter
562 // replica DBs to catch up before responding. Even if there are several DCs, this increases
563 // the chance that the user will see their own changes immediately afterwards. As long
564 // as the sticky DC cookie applies (same domain), this is not even an issue.
565 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $unsavedPositions ) {
566 $masterName = $lb->getServerName( $lb->getWriterIndex() );
567 if ( isset( $unsavedPositions[$masterName] ) ) {
568 $lb->waitForAll( $unsavedPositions[$masterName] );
574 * Base parameters to ILoadBalancer::__construct()
577 final protected function baseLoadBalancerParams() {
578 if ( $this->trxRoundStage
=== self
::ROUND_COMMIT_CALLBACKS
) {
579 $initStage = ILoadBalancer
::STAGE_POSTCOMMIT_CALLBACKS
;
580 } elseif ( $this->trxRoundStage
=== self
::ROUND_ROLLBACK_CALLBACKS
) {
581 $initStage = ILoadBalancer
::STAGE_POSTROLLBACK_CALLBACKS
;
587 'localDomain' => $this->localDomain
,
588 'readOnlyReason' => $this->readOnlyReason
,
589 'srvCache' => $this->srvCache
,
590 'wanCache' => $this->wanCache
,
591 'profiler' => $this->profiler
,
592 'trxProfiler' => $this->trxProfiler
,
593 'queryLogger' => $this->queryLogger
,
594 'connLogger' => $this->connLogger
,
595 'replLogger' => $this->replLogger
,
596 'errorLogger' => $this->errorLogger
,
597 'deprecationLogger' => $this->deprecationLogger
,
598 'hostname' => $this->hostname
,
599 'cliMode' => $this->cliMode
,
600 'agent' => $this->agent
,
601 'maxLag' => $this->maxLag
,
602 'defaultGroup' => $this->defaultGroup
,
603 'chronologyCallback' => function ( ILoadBalancer
$lb ) {
604 // Defer ChronologyProtector construction in case setRequestInfo() ends up
605 // being called later (but before the first connection attempt) (T192611)
606 $this->getChronologyProtector()->initLB( $lb );
608 'roundStage' => $initStage
613 * @param ILoadBalancer $lb
615 protected function initLoadBalancer( ILoadBalancer
$lb ) {
616 if ( $this->trxRoundId
!== false ) {
617 $lb->beginMasterChanges( $this->trxRoundId
); // set DBO_TRX
620 $lb->setTableAliases( $this->tableAliases
);
621 $lb->setIndexAliases( $this->indexAliases
);
624 public function setTableAliases( array $aliases ) {
625 $this->tableAliases
= $aliases;
628 public function setIndexAliases( array $aliases ) {
629 $this->indexAliases
= $aliases;
633 * @param string $prefix
634 * @deprecated Since 1.33
636 public function setDomainPrefix( $prefix ) {
637 $this->setLocalDomainPrefix( $prefix );
640 public function setLocalDomainPrefix( $prefix ) {
641 $this->localDomain
= new DatabaseDomain(
642 $this->localDomain
->getDatabase(),
643 $this->localDomain
->getSchema(),
647 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $prefix ) {
648 $lb->setLocalDomainPrefix( $prefix );
652 public function redefineLocalDomain( $domain ) {
655 $this->localDomain
= DatabaseDomain
::newFromId( $domain );
657 $this->forEachLB( function ( ILoadBalancer
$lb ) {
658 $lb->redefineLocalDomain( $this->localDomain
);
662 public function closeAll() {
663 $this->forEachLBCallMethod( 'closeAll' );
666 public function setAgentName( $agent ) {
667 $this->agent
= $agent;
670 public function appendShutdownCPIndexAsQuery( $url, $index ) {
672 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$usedCluster ) {
673 $usedCluster |
= ( $lb->getServerCount() > 1 );
676 if ( !$usedCluster ) {
677 return $url; // no master/replica clusters touched
680 return strpos( $url, '?' ) === false ?
"$url?cpPosIndex=$index" : "$url&cpPosIndex=$index";
683 public function getChronologyProtectorClientId() {
684 return $this->getChronologyProtector()->getClientId();
688 * @param int $index Write index
689 * @param int $time UNIX timestamp; can be used to detect stale cookies (T190082)
690 * @param string $clientId Agent ID hash from ILBFactory::shutdown()
691 * @return string Timestamp-qualified write index of the form "<index>@<timestamp>#<hash>"
694 public static function makeCookieValueFromCPIndex( $index, $time, $clientId ) {
695 return "$index@$time#$clientId";
699 * @param string $value Possible result of LBFactory::makeCookieValueFromCPIndex()
700 * @param int $minTimestamp Lowest UNIX timestamp that a non-expired value can have
701 * @return array (index: int or null, clientId: string or null)
704 public static function getCPInfoFromCookieValue( $value, $minTimestamp ) {
705 static $placeholder = [ 'index' => null, 'clientId' => null ];
707 if ( !preg_match( '/^(\d+)@(\d+)#([0-9a-f]{32})$/', $value, $m ) ) {
708 return $placeholder; // invalid
713 return $placeholder; // invalid
714 } elseif ( isset( $m[2] ) && $m[2] !== '' && (int)$m[2] < $minTimestamp ) {
715 return $placeholder; // expired
718 $clientId = ( isset( $m[3] ) && $m[3] !== '' ) ?
$m[3] : null;
720 return [ 'index' => $index, 'clientId' => $clientId ];
723 public function setRequestInfo( array $info ) {
724 if ( $this->chronProt
) {
725 throw new LogicException( 'ChronologyProtector already initialized.' );
728 $this->requestInfo
= $info +
$this->requestInfo
;
732 * @param string $stage
734 private function assertTransactionRoundStage( $stage ) {
735 if ( $this->trxRoundStage
!== $stage ) {
736 throw new DBTransactionError(
738 "Transaction round stage must be '$stage' (not '{$this->trxRoundStage}')"
743 function __destruct() {