MediaWiki
master
ILBFactory.php
Go to the documentation of this file.
1
<?php
20
namespace
Wikimedia\Rdbms
;
21
22
use Generator;
23
use InvalidArgumentException;
24
46
interface
ILBFactory
extends
IConnectionProvider
{
48
public
const
SHUTDOWN_NORMAL
= 0;
50
public
const
SHUTDOWN_NO_CHRONPROT
= 1;
51
53
public
const
CLUSTER_MAIN_DEFAULT =
'DEFAULT'
;
54
87
public
function
__construct
( array $conf );
88
96
public
function
destroy
();
97
102
public
function
autoReconfigure
(): void;
103
111
public
function
getLocalDomainID
(): string;
112
123
public
function
redefineLocalDomain
( $domain );
124
137
public
function
getLoadBalancer
( $domain =
false
):
ILoadBalancer
;
138
157
public
function
newMainLB
( $domain =
false
):
ILoadBalancerForOwner
;
158
170
public
function
getMainLB
( $domain =
false
):
ILoadBalancer
;
171
187
public
function
newExternalLB
( $cluster ):
ILoadBalancerForOwner
;
188
198
public
function
getExternalLB
( $cluster ):
ILoadBalancer
;
199
210
public
function
getAllMainLBs
(): array;
211
220
public
function
getAllExternalLBs
(): array;
221
228
public
function
getAllLBs
();
229
238
public
function
shutdown
(
239
$flags = self::SHUTDOWN_NORMAL,
240
?callable $workCallback =
null
,
241
&$cpIndex =
null
,
242
&$cpClientId =
null
243
);
244
255
public
function
flushReplicaSnapshots
( $fname = __METHOD__ );
256
282
public
function
beginPrimaryChanges
( $fname = __METHOD__ );
283
299
public
function
commitPrimaryChanges
( $fname = __METHOD__,
int
$maxWriteDuration = 0 );
300
309
public
function
rollbackPrimaryChanges
( $fname = __METHOD__ );
310
322
public
function
flushPrimarySessions
( $fname = __METHOD__ );
323
330
public
function
hasTransactionRound
();
331
340
public
function
isReadyForRoundOperations
();
341
350
public
function
hasPrimaryChanges
();
351
359
public
function
laggedReplicaUsed
();
360
369
public
function
hasOrMadeRecentPrimaryChanges
( $age =
null
);
370
392
public
function
waitForReplication
( array $opts = [] );
393
403
public
function
setWaitForReplicationListener
( $name, ?callable $callback =
null
);
404
410
public
function
disableChronologyProtection
();
411
418
public
function
setLocalDomainPrefix
( $prefix );
419
425
public
function
closeAll
( $fname = __METHOD__ );
426
430
public
function
setAgentName
( $agent );
431
438
public
function
hasStreamingReplicaServers
();
439
447
public
function
setDefaultReplicationWaitTimeout
( $seconds );
448
462
public
function
setTableAliases
( array $aliases );
463
476
public
function
setIndexAliases
( array $aliases );
477
486
public
function
setDomainAliases
( array $aliases );
487
494
public
function
getTransactionProfiler
():
TransactionProfiler
;
495
}
Wikimedia\Rdbms\TransactionProfiler
Detect high-contention DB queries via profiling calls.
Definition
TransactionProfiler.php:39
Wikimedia\Rdbms\IConnectionProvider
Provide primary and replica IDatabase connections.
Definition
IConnectionProvider.php:35
Wikimedia\Rdbms\ILBFactory
Manager of ILoadBalancer objects and, indirectly, IDatabase connections.
Definition
ILBFactory.php:46
Wikimedia\Rdbms\ILBFactory\getLocalDomainID
getLocalDomainID()
Get the local (and default) database domain ID of connection handles.
Wikimedia\Rdbms\ILBFactory\autoReconfigure
autoReconfigure()
Reload the configuration if necessary.
Wikimedia\Rdbms\ILBFactory\redefineLocalDomain
redefineLocalDomain( $domain)
Close all connections and redefine the local database domain.
Wikimedia\Rdbms\ILBFactory\beginPrimaryChanges
beginPrimaryChanges( $fname=__METHOD__)
Wrap subsequent queries for all transaction round aware primary connections in a transaction.
Wikimedia\Rdbms\ILBFactory\getAllExternalLBs
getAllExternalLBs()
Get the tracked load balancer instances for all external clusters.
Wikimedia\Rdbms\ILBFactory\setTableAliases
setTableAliases(array $aliases)
Make certain table names use their own database, schema, and table prefix when passed into SQL querie...
Wikimedia\Rdbms\ILBFactory\newMainLB
newMainLB( $domain=false)
Create a new load balancer instance for the main cluster that handles the given domain.
Wikimedia\Rdbms\ILBFactory\setLocalDomainPrefix
setLocalDomainPrefix( $prefix)
Set a new table prefix for the existing local domain ID for testing.
Wikimedia\Rdbms\ILBFactory\commitPrimaryChanges
commitPrimaryChanges( $fname=__METHOD__, int $maxWriteDuration=0)
Commit all primary connection transactions and flush all replica connection transactions.
Wikimedia\Rdbms\ILBFactory\hasPrimaryChanges
hasPrimaryChanges()
Determine if any primary connection has pending changes.
Wikimedia\Rdbms\ILBFactory\getLoadBalancer
getLoadBalancer( $domain=false)
Get the tracked load balancer instance for a given domain.
Wikimedia\Rdbms\ILBFactory\waitForReplication
waitForReplication(array $opts=[])
Waits for the replica database server to catch up to the current primary position.
Wikimedia\Rdbms\ILBFactory\rollbackPrimaryChanges
rollbackPrimaryChanges( $fname=__METHOD__)
Rollback all primary connection transactions and flush all replica connection transactions.
Wikimedia\Rdbms\ILBFactory\closeAll
closeAll( $fname=__METHOD__)
Close all connections on instantiated tracked load balancer instances.
Wikimedia\Rdbms\ILBFactory\flushPrimarySessions
flushPrimarySessions( $fname=__METHOD__)
Release important session-level state (named lock, table locks) as post-rollback cleanup.
Wikimedia\Rdbms\ILBFactory\__construct
__construct(array $conf)
Sub-classes may extend the required keys in $conf with additional parameters.
Wikimedia\Rdbms\ILBFactory\destroy
destroy()
Close all connections and make further attempts to open connections result in DBAccessError.
Wikimedia\Rdbms\ILBFactory\laggedReplicaUsed
laggedReplicaUsed()
Determine if any lagged replica database server connection was used.
Wikimedia\Rdbms\ILBFactory\getAllLBs
getAllLBs()
Get all tracked load balancer instances (generator)
Wikimedia\Rdbms\ILBFactory\setDomainAliases
setDomainAliases(array $aliases)
Convert certain database domains to alternative ones.
Wikimedia\Rdbms\ILBFactory\getExternalLB
getExternalLB( $cluster)
Get the tracked load balancer instance for an external cluster.
Wikimedia\Rdbms\ILBFactory\getMainLB
getMainLB( $domain=false)
Get the tracked load balancer instance for the main cluster that handles the given domain.
Wikimedia\Rdbms\ILBFactory\disableChronologyProtection
disableChronologyProtection()
Disable the ChronologyProtector on all instantiated tracked load balancer instances.
Wikimedia\Rdbms\ILBFactory\setDefaultReplicationWaitTimeout
setDefaultReplicationWaitTimeout( $seconds)
Set the default timeout for replication wait checks.
Wikimedia\Rdbms\ILBFactory\SHUTDOWN_NO_CHRONPROT
const SHUTDOWN_NO_CHRONPROT
Do not save "session consistency" DB replication positions.
Definition
ILBFactory.php:50
Wikimedia\Rdbms\ILBFactory\hasTransactionRound
hasTransactionRound()
Check if an explicit transaction round is active.
Wikimedia\Rdbms\ILBFactory\SHUTDOWN_NORMAL
const SHUTDOWN_NORMAL
Idiom for "no special shutdown flags".
Definition
ILBFactory.php:48
Wikimedia\Rdbms\ILBFactory\hasStreamingReplicaServers
hasStreamingReplicaServers()
Whether it has streaming replica servers.
Wikimedia\Rdbms\ILBFactory\getAllMainLBs
getAllMainLBs()
Get the tracked load balancer instances for all main clusters.
Wikimedia\Rdbms\ILBFactory\shutdown
shutdown( $flags=self::SHUTDOWN_NORMAL, ?callable $workCallback=null, &$cpIndex=null, &$cpClientId=null)
Prepare all instantiated tracked load balancer instances for shutdown.
Wikimedia\Rdbms\ILBFactory\setAgentName
setAgentName( $agent)
Wikimedia\Rdbms\ILBFactory\setWaitForReplicationListener
setWaitForReplicationListener( $name, ?callable $callback=null)
Add a callback to be run in every call to waitForReplication() prior to any waiting.
Wikimedia\Rdbms\ILBFactory\getTransactionProfiler
getTransactionProfiler()
Get the TransactionProfiler used by this instance.
Wikimedia\Rdbms\ILBFactory\setIndexAliases
setIndexAliases(array $aliases)
Convert certain index names to alternative names before querying the DB.
Wikimedia\Rdbms\ILBFactory\hasOrMadeRecentPrimaryChanges
hasOrMadeRecentPrimaryChanges( $age=null)
Determine if any primary connection has pending/written changes from this request.
Wikimedia\Rdbms\ILBFactory\newExternalLB
newExternalLB( $cluster)
Create a new load balancer instance for an external cluster.
Wikimedia\Rdbms\ILBFactory\isReadyForRoundOperations
isReadyForRoundOperations()
Check if transaction rounds can be started, committed, or rolled back right now.
Wikimedia\Rdbms\ILBFactory\flushReplicaSnapshots
flushReplicaSnapshots( $fname=__METHOD__)
Commit all replica database server transactions, clearing any point-in-time view snapshots.
Wikimedia\Rdbms\ILoadBalancerForOwner
Internal interface for load balancer instances exposed to their owner.
Definition
ILoadBalancerForOwner.php:34
Wikimedia\Rdbms\ILoadBalancer
This class is a delegate to ILBFactory for a given database cluster.
Definition
ILoadBalancer.php:113
Wikimedia\Rdbms
Definition
ChangedTablesTracker.php:3
includes
libs
rdbms
lbfactory
ILBFactory.php
Generated on Mon Dec 30 2024 13:24:33 for MediaWiki by
1.10.0