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 Wikimedia\ScopedCallback
;
36 * An interface for generating database load balancers
39 abstract class LBFactory
implements ILBFactory
{
40 /** @var ChronologyProtector */
42 /** @var object|string Class name or object With profileIn/profileOut methods */
44 /** @var TransactionProfiler */
46 /** @var LoggerInterface */
48 /** @var LoggerInterface */
50 /** @var LoggerInterface */
52 /** @var LoggerInterface */
54 /** @var callable Error logger */
56 /** @var callable Deprecation logger */
57 private $deprecationLogger;
63 /** @var WANObjectCache */
66 /** @var DatabaseDomain Local domain */
67 protected $localDomain;
69 /** @var string Local hostname of the app server */
71 /** @var array Web request information about the client */
73 /** @var bool Whether this PHP instance is for a CLI script */
75 /** @var string Agent name for query profiling */
78 /** @var array[] $aliases Map of (table => (dbname, schema, prefix) map) */
79 private $tableAliases = [];
80 /** @var string[] Map of (index alias => index) */
81 private $indexAliases = [];
82 /** @var callable[] */
83 private $replicationWaitCallbacks = [];
87 /** @var string|bool String if a requested DBO_TRX transaction round is active */
88 private $trxRoundId = false;
89 /** @var string One of the ROUND_* class constants */
90 private $trxRoundStage = self
::ROUND_CURSORY
;
92 /** @var string|bool Reason all LBs are read-only or false if not */
93 protected $readOnlyReason = false;
95 /** @var string|null */
96 private $defaultGroup = null;
98 const ROUND_CURSORY
= 'cursory';
99 const ROUND_BEGINNING
= 'within-begin';
100 const ROUND_COMMITTING
= 'within-commit';
101 const ROUND_ROLLING_BACK
= 'within-rollback';
102 const ROUND_COMMIT_CALLBACKS
= 'within-commit-callbacks';
103 const ROUND_ROLLBACK_CALLBACKS
= 'within-rollback-callbacks';
105 private static $loggerFields =
106 [ 'replLogger', 'connLogger', 'queryLogger', 'perfLogger' ];
108 public function __construct( array $conf ) {
109 $this->localDomain
= isset( $conf['localDomain'] )
110 ? DatabaseDomain
::newFromId( $conf['localDomain'] )
111 : DatabaseDomain
::newUnspecified();
113 if ( isset( $conf['readOnlyReason'] ) && is_string( $conf['readOnlyReason'] ) ) {
114 $this->readOnlyReason
= $conf['readOnlyReason'];
117 $this->srvCache
= $conf['srvCache'] ??
new EmptyBagOStuff();
118 $this->memStash
= $conf['memStash'] ??
new EmptyBagOStuff();
119 $this->wanCache
= $conf['wanCache'] ?? WANObjectCache
::newEmpty();
121 foreach ( self
::$loggerFields as $key ) {
122 $this->$key = $conf[$key] ??
new \Psr\Log\
NullLogger();
124 $this->errorLogger
= $conf['errorLogger'] ??
function ( Exception
$e ) {
125 trigger_error( get_class( $e ) . ': ' . $e->getMessage(), E_USER_WARNING
);
127 $this->deprecationLogger
= $conf['deprecationLogger'] ??
function ( $msg ) {
128 trigger_error( $msg, E_USER_DEPRECATED
);
131 $this->profiler
= $conf['profiler'] ??
null;
132 $this->trxProfiler
= $conf['trxProfiler'] ??
new TransactionProfiler();
134 $this->requestInfo
= [
135 'IPAddress' => $_SERVER[ 'REMOTE_ADDR' ] ??
'',
136 'UserAgent' => $_SERVER['HTTP_USER_AGENT'] ??
'',
137 // Headers application can inject via LBFactory::setRequestInfo()
138 'ChronologyClientId' => null, // prior $cpClientId value from LBFactory::shutdown()
139 'ChronologyPositionIndex' => null // prior $cpIndex value from LBFactory::shutdown()
142 $this->cliMode
= $conf['cliMode'] ??
( PHP_SAPI
=== 'cli' || PHP_SAPI
=== 'phpdbg' );
143 $this->hostname
= $conf['hostname'] ??
gethostname();
144 $this->agent
= $conf['agent'] ??
'';
145 $this->defaultGroup
= $conf['defaultGroup'] ??
null;
147 $this->ticket
= mt_rand();
150 public function destroy() {
151 $this->shutdown( self
::SHUTDOWN_NO_CHRONPROT
);
152 $this->forEachLBCallMethod( 'disable' );
155 public function getLocalDomainID() {
156 return $this->localDomain
->getId();
159 public function resolveDomainID( $domain ) {
160 return ( $domain !== false ) ?
(string)$domain : $this->getLocalDomainID();
163 public function shutdown(
164 $mode = self
::SHUTDOWN_CHRONPROT_SYNC
,
165 callable
$workCallback = null,
169 $chronProt = $this->getChronologyProtector();
170 if ( $mode === self
::SHUTDOWN_CHRONPROT_SYNC
) {
171 $this->shutdownChronologyProtector( $chronProt, $workCallback, 'sync', $cpIndex );
172 } elseif ( $mode === self
::SHUTDOWN_CHRONPROT_ASYNC
) {
173 $this->shutdownChronologyProtector( $chronProt, null, 'async', $cpIndex );
176 $cpClientId = $chronProt->getClientId();
178 $this->commitMasterChanges( __METHOD__
); // sanity
182 * @see ILBFactory::newMainLB()
183 * @param bool $domain
184 * @return ILoadBalancer
186 abstract public function newMainLB( $domain = false );
189 * @see ILBFactory::getMainLB()
190 * @param bool $domain
191 * @return ILoadBalancer
193 abstract public function getMainLB( $domain = false );
196 * @see ILBFactory::newExternalLB()
197 * @param string $cluster
198 * @return ILoadBalancer
200 abstract public function newExternalLB( $cluster );
203 * @see ILBFactory::getExternalLB()
204 * @param string $cluster
205 * @return ILoadBalancer
207 abstract public function getExternalLB( $cluster );
210 * Call a method of each tracked load balancer
212 * @param string $methodName
215 protected function forEachLBCallMethod( $methodName, array $args = [] ) {
217 function ( ILoadBalancer
$loadBalancer, $methodName, array $args ) {
218 $loadBalancer->$methodName( ...$args );
220 [ $methodName, $args ]
224 public function flushReplicaSnapshots( $fname = __METHOD__
) {
225 $this->forEachLBCallMethod( 'flushReplicaSnapshots', [ $fname ] );
228 final public function commitAll( $fname = __METHOD__
, array $options = [] ) {
229 $this->commitMasterChanges( $fname, $options );
230 $this->forEachLBCallMethod( 'flushMasterSnapshots', [ $fname ] );
231 $this->forEachLBCallMethod( 'flushReplicaSnapshots', [ $fname ] );
234 final public function beginMasterChanges( $fname = __METHOD__
) {
235 $this->assertTransactionRoundStage( self
::ROUND_CURSORY
);
236 $this->trxRoundStage
= self
::ROUND_BEGINNING
;
237 if ( $this->trxRoundId
!== false ) {
238 throw new DBTransactionError(
240 "$fname: transaction round '{$this->trxRoundId}' already started."
243 $this->trxRoundId
= $fname;
244 // Set DBO_TRX flags on all appropriate DBs
245 $this->forEachLBCallMethod( 'beginMasterChanges', [ $fname ] );
246 $this->trxRoundStage
= self
::ROUND_CURSORY
;
249 final public function commitMasterChanges( $fname = __METHOD__
, array $options = [] ) {
250 $this->assertTransactionRoundStage( self
::ROUND_CURSORY
);
251 $this->trxRoundStage
= self
::ROUND_COMMITTING
;
252 if ( $this->trxRoundId
!== false && $this->trxRoundId
!== $fname ) {
253 throw new DBTransactionError(
255 "$fname: transaction round '{$this->trxRoundId}' still running."
258 /** @noinspection PhpUnusedLocalVariableInspection */
259 $scope = $this->getScopedPHPBehaviorForCommit(); // try to ignore client aborts
260 // Run pre-commit callbacks and suppress post-commit callbacks, aborting on failure
262 $count = 0; // number of callbacks executed this iteration
263 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$count ) {
264 $count +
= $lb->finalizeMasterChanges();
266 } while ( $count > 0 );
267 $this->trxRoundId
= false;
268 // Perform pre-commit checks, aborting on failure
269 $this->forEachLBCallMethod( 'approveMasterChanges', [ $options ] );
270 // Log the DBs and methods involved in multi-DB transactions
271 $this->logIfMultiDbTransaction();
272 // Actually perform the commit on all master DB connections and revert DBO_TRX
273 $this->forEachLBCallMethod( 'commitMasterChanges', [ $fname ] );
274 // Run all post-commit callbacks in a separate step
275 $this->trxRoundStage
= self
::ROUND_COMMIT_CALLBACKS
;
276 $e = $this->executePostTransactionCallbacks();
277 $this->trxRoundStage
= self
::ROUND_CURSORY
;
278 // Throw any last post-commit callback error
279 if ( $e instanceof Exception
) {
284 final public function rollbackMasterChanges( $fname = __METHOD__
) {
285 $this->trxRoundStage
= self
::ROUND_ROLLING_BACK
;
286 $this->trxRoundId
= false;
287 // Actually perform the rollback on all master DB connections and revert DBO_TRX
288 $this->forEachLBCallMethod( 'rollbackMasterChanges', [ $fname ] );
289 // Run all post-commit callbacks in a separate step
290 $this->trxRoundStage
= self
::ROUND_ROLLBACK_CALLBACKS
;
291 $this->executePostTransactionCallbacks();
292 $this->trxRoundStage
= self
::ROUND_CURSORY
;
296 * @return Exception|null
298 private function executePostTransactionCallbacks() {
299 // Run all post-commit callbacks until new ones stop getting added
300 $e = null; // first callback exception
302 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$e ) {
303 $ex = $lb->runMasterTransactionIdleCallbacks();
306 } while ( $this->hasMasterChanges() );
307 // Run all listener callbacks once
308 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$e ) {
309 $ex = $lb->runMasterTransactionListenerCallbacks();
316 public function hasTransactionRound() {
317 return ( $this->trxRoundId
!== false );
320 public function isReadyForRoundOperations() {
321 return ( $this->trxRoundStage
=== self
::ROUND_CURSORY
);
325 * Log query info if multi DB transactions are going to be committed now
327 private function logIfMultiDbTransaction() {
329 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$callersByDB ) {
330 $masterName = $lb->getServerName( $lb->getWriterIndex() );
331 $callers = $lb->pendingMasterChangeCallers();
333 $callersByDB[$masterName] = $callers;
337 if ( count( $callersByDB ) >= 2 ) {
338 $dbs = implode( ', ', array_keys( $callersByDB ) );
339 $msg = "Multi-DB transaction [{$dbs}]:\n";
340 foreach ( $callersByDB as $db => $callers ) {
341 $msg .= "$db: " . implode( '; ', $callers ) . "\n";
343 $this->queryLogger
->info( $msg );
347 public function hasMasterChanges() {
349 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$ret ) {
350 $ret = $ret ||
$lb->hasMasterChanges();
356 public function laggedReplicaUsed() {
358 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$ret ) {
359 $ret = $ret ||
$lb->laggedReplicaUsed();
365 public function hasOrMadeRecentMasterChanges( $age = null ) {
367 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $age, &$ret ) {
368 $ret = $ret ||
$lb->hasOrMadeRecentMasterChanges( $age );
373 public function waitForReplication( array $opts = [] ) {
377 'timeout' => $this->cliMode ?
60 : 10,
378 'ifWritesSince' => null
381 if ( $opts['domain'] === false && isset( $opts['wiki'] ) ) {
382 $opts['domain'] = $opts['wiki']; // b/c
385 // Figure out which clusters need to be checked
386 /** @var ILoadBalancer[] $lbs */
388 if ( $opts['cluster'] !== false ) {
389 $lbs[] = $this->getExternalLB( $opts['cluster'] );
390 } elseif ( $opts['domain'] !== false ) {
391 $lbs[] = $this->getMainLB( $opts['domain'] );
393 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$lbs ) {
397 return; // nothing actually used
401 // Get all the master positions of applicable DBs right now.
402 // This can be faster since waiting on one cluster reduces the
403 // time needed to wait on the next clusters.
404 $masterPositions = array_fill( 0, count( $lbs ), false );
405 foreach ( $lbs as $i => $lb ) {
406 if ( $lb->getServerCount() <= 1 ) {
407 // T29975 - Don't try to wait for replica DBs if there are none
408 // Prevents permission error when getting master position
410 } elseif ( $opts['ifWritesSince']
411 && $lb->lastMasterChangeTimestamp() < $opts['ifWritesSince']
413 continue; // no writes since the last wait
415 $masterPositions[$i] = $lb->getMasterPos();
418 // Run any listener callbacks *after* getting the DB positions. The more
419 // time spent in the callbacks, the less time is spent in waitForAll().
420 foreach ( $this->replicationWaitCallbacks
as $callback ) {
425 foreach ( $lbs as $i => $lb ) {
426 if ( $masterPositions[$i] ) {
427 // The RDBMS may not support getMasterPos()
428 if ( !$lb->waitForAll( $masterPositions[$i], $opts['timeout'] ) ) {
429 $failed[] = $lb->getServerName( $lb->getWriterIndex() );
435 throw new DBReplicationWaitError(
437 "Could not wait for replica DBs to catch up to " .
438 implode( ', ', $failed )
443 public function setWaitForReplicationListener( $name, callable
$callback = null ) {
445 $this->replicationWaitCallbacks
[$name] = $callback;
447 unset( $this->replicationWaitCallbacks
[$name] );
451 public function getEmptyTransactionTicket( $fname ) {
452 if ( $this->hasMasterChanges() ) {
453 $this->queryLogger
->error( __METHOD__
. ": $fname does not have outer scope.\n" .
454 ( new RuntimeException() )->getTraceAsString() );
459 return $this->ticket
;
462 final public function commitAndWaitForReplication( $fname, $ticket, array $opts = [] ) {
463 if ( $ticket !== $this->ticket
) {
464 $this->perfLogger
->error( __METHOD__
. ": $fname does not have outer scope.\n" .
465 ( new RuntimeException() )->getTraceAsString() );
470 // The transaction owner and any caller with the empty transaction ticket can commit
471 // so that getEmptyTransactionTicket() callers don't risk seeing DBTransactionError.
472 if ( $this->trxRoundId
!== false && $fname !== $this->trxRoundId
) {
473 $this->queryLogger
->info( "$fname: committing on behalf of {$this->trxRoundId}." );
474 $fnameEffective = $this->trxRoundId
;
476 $fnameEffective = $fname;
479 $this->commitMasterChanges( $fnameEffective );
480 $this->waitForReplication( $opts );
481 // If a nested caller committed on behalf of $fname, start another empty $fname
482 // transaction, leaving the caller with the same empty transaction state as before.
483 if ( $fnameEffective !== $fname ) {
484 $this->beginMasterChanges( $fnameEffective );
488 public function getChronologyProtectorTouched( $dbName ) {
489 return $this->getChronologyProtector()->getTouched( $dbName );
492 public function disableChronologyProtection() {
493 $this->getChronologyProtector()->setEnabled( false );
497 * @return ChronologyProtector
499 protected function getChronologyProtector() {
500 if ( $this->chronProt
) {
501 return $this->chronProt
;
504 $this->chronProt
= new ChronologyProtector(
507 'ip' => $this->requestInfo
['IPAddress'],
508 'agent' => $this->requestInfo
['UserAgent'],
509 'clientId' => $this->requestInfo
['ChronologyClientId']
511 $this->requestInfo
['ChronologyPositionIndex']
513 $this->chronProt
->setLogger( $this->replLogger
);
515 if ( $this->cliMode
) {
516 $this->chronProt
->setEnabled( false );
517 } elseif ( $this->requestInfo
['ChronologyProtection'] === 'false' ) {
518 // Request opted out of using position wait logic. This is useful for requests
519 // done by the job queue or background ETL that do not have a meaningful session.
520 $this->chronProt
->setWaitEnabled( false );
521 } elseif ( $this->memStash
instanceof EmptyBagOStuff
) {
522 // No where to store any DB positions and wait for them to appear
523 $this->chronProt
->setEnabled( false );
524 $this->replLogger
->info( 'Cannot use ChronologyProtector with EmptyBagOStuff.' );
527 $this->replLogger
->debug( __METHOD__
. ': using request info ' .
528 json_encode( $this->requestInfo
, JSON_PRETTY_PRINT
) );
530 return $this->chronProt
;
534 * Get and record all of the staged DB positions into persistent memory storage
536 * @param ChronologyProtector $cp
537 * @param callable|null $workCallback Work to do instead of waiting on syncing positions
538 * @param string $mode One of (sync, async); whether to wait on remote datacenters
539 * @param int|null &$cpIndex DB position key write counter; incremented on update
541 protected function shutdownChronologyProtector(
542 ChronologyProtector
$cp, $workCallback, $mode, &$cpIndex = null
544 // Record all the master positions needed
545 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $cp ) {
546 $cp->shutdownLB( $lb );
548 // Write them to the persistent stash. Try to do something useful by running $work
549 // while ChronologyProtector waits for the stash write to replicate to all DCs.
550 $unsavedPositions = $cp->shutdown( $workCallback, $mode, $cpIndex );
551 if ( $unsavedPositions && $workCallback ) {
552 // Invoke callback in case it did not cache the result yet
553 $workCallback(); // work now to block for less time in waitForAll()
555 // If the positions failed to write to the stash, at least wait on local datacenter
556 // replica DBs to catch up before responding. Even if there are several DCs, this increases
557 // the chance that the user will see their own changes immediately afterwards. As long
558 // as the sticky DC cookie applies (same domain), this is not even an issue.
559 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $unsavedPositions ) {
560 $masterName = $lb->getServerName( $lb->getWriterIndex() );
561 if ( isset( $unsavedPositions[$masterName] ) ) {
562 $lb->waitForAll( $unsavedPositions[$masterName] );
568 * Base parameters to ILoadBalancer::__construct()
571 final protected function baseLoadBalancerParams() {
572 if ( $this->trxRoundStage
=== self
::ROUND_COMMIT_CALLBACKS
) {
573 $initStage = ILoadBalancer
::STAGE_POSTCOMMIT_CALLBACKS
;
574 } elseif ( $this->trxRoundStage
=== self
::ROUND_ROLLBACK_CALLBACKS
) {
575 $initStage = ILoadBalancer
::STAGE_POSTROLLBACK_CALLBACKS
;
581 'localDomain' => $this->localDomain
,
582 'readOnlyReason' => $this->readOnlyReason
,
583 'srvCache' => $this->srvCache
,
584 'wanCache' => $this->wanCache
,
585 'profiler' => $this->profiler
,
586 'trxProfiler' => $this->trxProfiler
,
587 'queryLogger' => $this->queryLogger
,
588 'connLogger' => $this->connLogger
,
589 'replLogger' => $this->replLogger
,
590 'errorLogger' => $this->errorLogger
,
591 'deprecationLogger' => $this->deprecationLogger
,
592 'hostname' => $this->hostname
,
593 'cliMode' => $this->cliMode
,
594 'agent' => $this->agent
,
595 'defaultGroup' => $this->defaultGroup
,
596 'chronologyCallback' => function ( ILoadBalancer
$lb ) {
597 // Defer ChronologyProtector construction in case setRequestInfo() ends up
598 // being called later (but before the first connection attempt) (T192611)
599 $this->getChronologyProtector()->initLB( $lb );
601 'roundStage' => $initStage
606 * @param ILoadBalancer $lb
608 protected function initLoadBalancer( ILoadBalancer
$lb ) {
609 if ( $this->trxRoundId
!== false ) {
610 $lb->beginMasterChanges( $this->trxRoundId
); // set DBO_TRX
613 $lb->setTableAliases( $this->tableAliases
);
614 $lb->setIndexAliases( $this->indexAliases
);
617 public function setTableAliases( array $aliases ) {
618 $this->tableAliases
= $aliases;
621 public function setIndexAliases( array $aliases ) {
622 $this->indexAliases
= $aliases;
625 public function setDomainPrefix( $prefix ) {
626 $this->localDomain
= new DatabaseDomain(
627 $this->localDomain
->getDatabase(),
632 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( $prefix ) {
633 $lb->setDomainPrefix( $prefix );
637 public function closeAll() {
638 $this->forEachLBCallMethod( 'closeAll', [] );
641 public function setAgentName( $agent ) {
642 $this->agent
= $agent;
645 public function appendShutdownCPIndexAsQuery( $url, $index ) {
647 $this->forEachLB( function ( ILoadBalancer
$lb ) use ( &$usedCluster ) {
648 $usedCluster |
= ( $lb->getServerCount() > 1 );
651 if ( !$usedCluster ) {
652 return $url; // no master/replica clusters touched
655 return strpos( $url, '?' ) === false ?
"$url?cpPosIndex=$index" : "$url&cpPosIndex=$index";
659 * @param int $index Write index
660 * @param int $time UNIX timestamp; can be used to detect stale cookies (T190082)
661 * @param string $clientId Agent ID hash from ILBFactory::shutdown()
662 * @return string Timestamp-qualified write index of the form "<index>@<timestamp>#<hash>"
665 public static function makeCookieValueFromCPIndex( $index, $time, $clientId ) {
666 return "$index@$time#$clientId";
670 * @param string $value Possible result of LBFactory::makeCookieValueFromCPIndex()
671 * @param int $minTimestamp Lowest UNIX timestamp that a non-expired value can have
672 * @return array (index: int or null, clientId: string or null)
675 public static function getCPInfoFromCookieValue( $value, $minTimestamp ) {
676 static $placeholder = [ 'index' => null, 'clientId' => null ];
678 if ( !preg_match( '/^(\d+)@(\d+)#([0-9a-f]{32})$/', $value, $m ) ) {
679 return $placeholder; // invalid
684 return $placeholder; // invalid
685 } elseif ( isset( $m[2] ) && $m[2] !== '' && (int)$m[2] < $minTimestamp ) {
686 return $placeholder; // expired
689 $clientId = ( isset( $m[3] ) && $m[3] !== '' ) ?
$m[3] : null;
691 return [ 'index' => $index, 'clientId' => $clientId ];
694 public function setRequestInfo( array $info ) {
695 if ( $this->chronProt
) {
696 throw new LogicException( 'ChronologyProtector already initialized.' );
699 $this->requestInfo
= $info +
$this->requestInfo
;
703 * @param string $stage
705 private function assertTransactionRoundStage( $stage ) {
706 if ( $this->trxRoundStage
!== $stage ) {
707 throw new DBTransactionError(
709 "Transaction round stage must be '$stage' (not '{$this->trxRoundStage}')"
715 * Make PHP ignore user aborts/disconnects until the returned
716 * value leaves scope. This returns null and does nothing in CLI mode.
718 * @return ScopedCallback|null
720 final protected function getScopedPHPBehaviorForCommit() {
721 if ( PHP_SAPI
!= 'cli' ) { // https://bugs.php.net/bug.php?id=47540
722 $old = ignore_user_abort( true ); // avoid half-finished operations
723 return new ScopedCallback( function () use ( $old ) {
724 ignore_user_abort( $old );
731 function __destruct() {
737 * @deprecated since 1.29
739 class_alias( LBFactory
::class, 'LBFactory' );