MediaWiki  master
LoadBalancerTest.php
Go to the documentation of this file.
1 <?php
2 
29 
35  private function makeServerConfig( $flags = DBO_DEFAULT ) {
37 
38  return [
39  'host' => $wgDBserver,
40  'dbname' => $wgDBname,
41  'tablePrefix' => $this->dbPrefix(),
42  'user' => $wgDBuser,
43  'password' => $wgDBpassword,
44  'type' => $wgDBtype,
45  'dbDirectory' => $wgSQLiteDataDir,
46  'load' => 0,
47  'flags' => $flags
48  ];
49  }
50 
55  public function testWithoutReplica() {
56  global $wgDBname;
57 
58  $called = false;
59  $lb = new LoadBalancer( [
60  // Simulate web request with DBO_TRX
61  'servers' => [ $this->makeServerConfig( DBO_TRX ) ],
62  'queryLogger' => MediaWiki\Logger\LoggerFactory::getInstance( 'DBQuery' ),
63  'localDomain' => new DatabaseDomain( $wgDBname, null, $this->dbPrefix() ),
64  'chronologyCallback' => function () use ( &$called ) {
65  $called = true;
66  }
67  ] );
68 
69  $ld = DatabaseDomain::newFromId( $lb->getLocalDomainID() );
70  $this->assertEquals( $wgDBname, $ld->getDatabase(), 'local domain DB set' );
71  $this->assertEquals( $this->dbPrefix(), $ld->getTablePrefix(), 'local domain prefix set' );
72  $this->assertSame( 'my_test_wiki', $lb->resolveDomainID( 'my_test_wiki' ) );
73  $this->assertSame( $ld->getId(), $lb->resolveDomainID( false ) );
74  $this->assertSame( $ld->getId(), $lb->resolveDomainID( $ld ) );
75  $this->assertFalse( $called );
76 
77  $dbw = $lb->getConnection( DB_MASTER );
78  $this->assertTrue( $called );
79  $this->assertTrue( $dbw->getLBInfo( 'master' ), 'master shows as master' );
80  $this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on master" );
81  $this->assertWriteAllowed( $dbw );
82 
83  $dbr = $lb->getConnection( DB_REPLICA );
84  $this->assertTrue( $dbr->getLBInfo( 'master' ), 'DB_REPLICA also gets the master' );
85  $this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on replica" );
86 
87  if ( !$lb->getServerAttributes( $lb->getWriterIndex() )[$dbw::ATTR_DB_LEVEL_LOCKING] ) {
88  $dbwAuto = $lb->getConnection( DB_MASTER, [], false, $lb::CONN_TRX_AUTOCOMMIT );
89  $this->assertFalse(
90  $dbwAuto->getFlag( $dbw::DBO_TRX ), "No DBO_TRX with CONN_TRX_AUTOCOMMIT" );
91  $this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX still set on master" );
92  $this->assertNotEquals(
93  $dbw, $dbwAuto, "CONN_TRX_AUTOCOMMIT uses separate connection" );
94 
95  $dbrAuto = $lb->getConnection( DB_REPLICA, [], false, $lb::CONN_TRX_AUTOCOMMIT );
96  $this->assertFalse(
97  $dbrAuto->getFlag( $dbw::DBO_TRX ), "No DBO_TRX with CONN_TRX_AUTOCOMMIT" );
98  $this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX still set on replica" );
99  $this->assertNotEquals(
100  $dbr, $dbrAuto, "CONN_TRX_AUTOCOMMIT uses separate connection" );
101 
102  $dbwAuto2 = $lb->getConnection( DB_MASTER, [], false, $lb::CONN_TRX_AUTOCOMMIT );
103  $this->assertEquals( $dbwAuto2, $dbwAuto, "CONN_TRX_AUTOCOMMIT reuses connections" );
104  }
105 
106  $lb->closeAll();
107  }
108 
109  public function testWithReplica() {
110  global $wgDBserver;
111 
112  // Simulate web request with DBO_TRX
114 
115  $dbw = $lb->getConnection( DB_MASTER );
116  $this->assertTrue( $dbw->getLBInfo( 'master' ), 'master shows as master' );
117  $this->assertEquals(
118  ( $wgDBserver != '' ) ? $wgDBserver : 'localhost',
119  $dbw->getLBInfo( 'clusterMasterHost' ),
120  'cluster master set' );
121  $this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on master" );
122  $this->assertWriteAllowed( $dbw );
123 
124  $dbr = $lb->getConnection( DB_REPLICA );
125  $this->assertTrue( $dbr->getLBInfo( 'replica' ), 'replica shows as replica' );
126  $this->assertEquals(
127  ( $wgDBserver != '' ) ? $wgDBserver : 'localhost',
128  $dbr->getLBInfo( 'clusterMasterHost' ),
129  'cluster master set' );
130  $this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX set on replica" );
131  $this->assertWriteForbidden( $dbr );
132 
133  if ( !$lb->getServerAttributes( $lb->getWriterIndex() )[$dbw::ATTR_DB_LEVEL_LOCKING] ) {
134  $dbwAuto = $lb->getConnection( DB_MASTER, [], false, $lb::CONN_TRX_AUTOCOMMIT );
135  $this->assertFalse(
136  $dbwAuto->getFlag( $dbw::DBO_TRX ), "No DBO_TRX with CONN_TRX_AUTOCOMMIT" );
137  $this->assertTrue( $dbw->getFlag( $dbw::DBO_TRX ), "DBO_TRX still set on master" );
138  $this->assertNotEquals(
139  $dbw, $dbwAuto, "CONN_TRX_AUTOCOMMIT uses separate connection" );
140 
141  $dbrAuto = $lb->getConnection( DB_REPLICA, [], false, $lb::CONN_TRX_AUTOCOMMIT );
142  $this->assertFalse(
143  $dbrAuto->getFlag( $dbw::DBO_TRX ), "No DBO_TRX with CONN_TRX_AUTOCOMMIT" );
144  $this->assertTrue( $dbr->getFlag( $dbw::DBO_TRX ), "DBO_TRX still set on replica" );
145  $this->assertNotEquals(
146  $dbr, $dbrAuto, "CONN_TRX_AUTOCOMMIT uses separate connection" );
147 
148  $dbwAuto2 = $lb->getConnection( DB_MASTER, [], false, $lb::CONN_TRX_AUTOCOMMIT );
149  $this->assertEquals( $dbwAuto2, $dbwAuto, "CONN_TRX_AUTOCOMMIT reuses connections" );
150  }
151 
152  $lb->closeAll();
153  }
154 
155  private function newSingleServerLocalLoadBalancer() {
156  global $wgDBname;
157 
158  return new LoadBalancer( [
159  'servers' => [ $this->makeServerConfig() ],
160  'localDomain' => new DatabaseDomain( $wgDBname, null, $this->dbPrefix() )
161  ] );
162  }
163 
164  private function newMultiServerLocalLoadBalancer( $flags = DBO_DEFAULT ) {
166 
167  $servers = [
168  [ // master
169  'host' => $wgDBserver,
170  'dbname' => $wgDBname,
171  'tablePrefix' => $this->dbPrefix(),
172  'user' => $wgDBuser,
173  'password' => $wgDBpassword,
174  'type' => $wgDBtype,
175  'dbDirectory' => $wgSQLiteDataDir,
176  'load' => 0,
177  'flags' => $flags
178  ],
179  [ // emulated replica
180  'host' => $wgDBserver,
181  'dbname' => $wgDBname,
182  'tablePrefix' => $this->dbPrefix(),
183  'user' => $wgDBuser,
184  'password' => $wgDBpassword,
185  'type' => $wgDBtype,
186  'dbDirectory' => $wgSQLiteDataDir,
187  'load' => 100,
188  'flags' => $flags
189  ]
190  ];
191 
192  return new LoadBalancer( [
193  'servers' => $servers,
194  'localDomain' => new DatabaseDomain( $wgDBname, null, $this->dbPrefix() ),
195  'queryLogger' => MediaWiki\Logger\LoggerFactory::getInstance( 'DBQuery' ),
196  'loadMonitorClass' => LoadMonitorNull::class
197  ] );
198  }
199 
200  private function assertWriteForbidden( Database $db ) {
201  try {
202  $db->delete( 'some_table', [ 'id' => 57634126 ], __METHOD__ );
203  $this->fail( 'Write operation should have failed!' );
204  } catch ( DBError $ex ) {
205  // check that the exception message contains "Write operation"
206  $constraint = new PHPUnit_Framework_Constraint_StringContains( 'Write operation' );
207 
208  if ( !$constraint->evaluate( $ex->getMessage(), '', true ) ) {
209  // re-throw original error, to preserve stack trace
210  throw $ex;
211  }
212  }
213  }
214 
215  private function assertWriteAllowed( Database $db ) {
216  $table = $db->tableName( 'some_table' );
217  // Trigger a transaction so that rollback() will remove all the tables.
218  // Don't do this for MySQL/Oracle as they auto-commit transactions for DDL
219  // statements such as CREATE TABLE.
220  $useAtomicSection = in_array( $db->getType(), [ 'sqlite', 'postgres', 'mssql' ], true );
221  try {
222  $db->dropTable( 'some_table' ); // clear for sanity
223  $this->assertNotEquals( $db::STATUS_TRX_ERROR, $db->trxStatus() );
224 
225  if ( $useAtomicSection ) {
226  $db->startAtomic( __METHOD__ );
227  }
228  // Use only basic SQL and trivial types for these queries for compatibility
229  $this->assertNotSame(
230  false,
231  $db->query( "CREATE TABLE $table (id INT, time INT)", __METHOD__ ),
232  "table created"
233  );
234  $this->assertNotEquals( $db::STATUS_TRX_ERROR, $db->trxStatus() );
235  $this->assertNotSame(
236  false,
237  $db->query( "DELETE FROM $table WHERE id=57634126", __METHOD__ ),
238  "delete query"
239  );
240  $this->assertNotEquals( $db::STATUS_TRX_ERROR, $db->trxStatus() );
241  } finally {
242  if ( !$useAtomicSection ) {
243  // Drop the table to clean up, ignoring any error.
244  $db->dropTable( 'some_table' );
245  }
246  // Rollback the atomic section for sqlite's benefit.
247  $db->rollback( __METHOD__, 'flush' );
248  $this->assertNotEquals( $db::STATUS_TRX_ERROR, $db->trxStatus() );
249  }
250  }
251 
252  public function testServerAttributes() {
253  $servers = [
254  [ // master
255  'dbname' => 'my_unittest_wiki',
256  'tablePrefix' => 'unittest_',
257  'type' => 'sqlite',
258  'dbDirectory' => "some_directory",
259  'load' => 0
260  ]
261  ];
262 
263  $lb = new LoadBalancer( [
264  'servers' => $servers,
265  'localDomain' => new DatabaseDomain( 'my_unittest_wiki', null, 'unittest_' ),
266  'loadMonitorClass' => LoadMonitorNull::class
267  ] );
268 
269  $this->assertTrue( $lb->getServerAttributes( 0 )[Database::ATTR_DB_LEVEL_LOCKING] );
270 
271  $servers = [
272  [ // master
273  'host' => 'db1001',
274  'user' => 'wikiuser',
275  'password' => 'none',
276  'dbname' => 'my_unittest_wiki',
277  'tablePrefix' => 'unittest_',
278  'type' => 'mysql',
279  'load' => 100
280  ],
281  [ // emulated replica
282  'host' => 'db1002',
283  'user' => 'wikiuser',
284  'password' => 'none',
285  'dbname' => 'my_unittest_wiki',
286  'tablePrefix' => 'unittest_',
287  'type' => 'mysql',
288  'load' => 100
289  ]
290  ];
291 
292  $lb = new LoadBalancer( [
293  'servers' => $servers,
294  'localDomain' => new DatabaseDomain( 'my_unittest_wiki', null, 'unittest_' ),
295  'loadMonitorClass' => LoadMonitorNull::class
296  ] );
297 
298  $this->assertFalse( $lb->getServerAttributes( 1 )[Database::ATTR_DB_LEVEL_LOCKING] );
299  }
300 
305  function testOpenConnection() {
306  $lb = $this->newSingleServerLocalLoadBalancer();
307 
308  $i = $lb->getWriterIndex();
309  $this->assertEquals( null, $lb->getAnyOpenConnection( $i ) );
310 
311  $conn1 = $lb->getConnection( $i );
312  $this->assertNotEquals( null, $conn1 );
313  $this->assertEquals( $conn1, $lb->getAnyOpenConnection( $i ) );
314  $this->assertFalse( $conn1->getFlag( DBO_TRX ) );
315 
316  $conn2 = $lb->getConnection( $i, [], false, $lb::CONN_TRX_AUTOCOMMIT );
317  $this->assertNotEquals( null, $conn2 );
318  $this->assertFalse( $conn2->getFlag( DBO_TRX ) );
319 
320  if ( $lb->getServerAttributes( $i )[Database::ATTR_DB_LEVEL_LOCKING] ) {
321  $this->assertEquals( null,
322  $lb->getAnyOpenConnection( $i, $lb::CONN_TRX_AUTOCOMMIT ) );
323  $this->assertEquals( $conn1,
324  $lb->getConnection(
325  $i, [], false, $lb::CONN_TRX_AUTOCOMMIT ), $lb::CONN_TRX_AUTOCOMMIT );
326  } else {
327  $this->assertEquals( $conn2,
328  $lb->getAnyOpenConnection( $i, $lb::CONN_TRX_AUTOCOMMIT ) );
329  $this->assertEquals( $conn2,
330  $lb->getConnection( $i, [], false, $lb::CONN_TRX_AUTOCOMMIT ) );
331 
332  $conn2->startAtomic( __METHOD__ );
333  try {
334  $lb->getConnection( $i, [], false, $lb::CONN_TRX_AUTOCOMMIT );
335  $conn2->endAtomic( __METHOD__ );
336  $this->fail( "No exception thrown." );
337  } catch ( DBUnexpectedError $e ) {
338  $this->assertEquals(
339  'Wikimedia\Rdbms\LoadBalancer::openConnection: ' .
340  'CONN_TRX_AUTOCOMMIT handle has a transaction.',
341  $e->getMessage()
342  );
343  }
344  $conn2->endAtomic( __METHOD__ );
345  }
346 
347  $lb->closeAll();
348  }
349 
350  public function testTransactionCallbackChains() {
352 
353  $servers = [
354  [
355  'host' => $wgDBserver,
356  'dbname' => $wgDBname,
357  'tablePrefix' => $this->dbPrefix(),
358  'user' => $wgDBuser,
359  'password' => $wgDBpassword,
360  'type' => $wgDBtype,
361  'dbDirectory' => $wgSQLiteDataDir,
362  'load' => 0,
363  'flags' => DBO_TRX // simulate a web request with DBO_TRX
364  ],
365  ];
366 
367  $lb = new LoadBalancer( [
368  'servers' => $servers,
369  'localDomain' => new DatabaseDomain( $wgDBname, null, $this->dbPrefix() )
370  ] );
371 
372  $conn1 = $lb->openConnection( $lb->getWriterIndex(), false );
373  $conn2 = $lb->openConnection( $lb->getWriterIndex(), '' );
374 
375  $count = 0;
376  $lb->forEachOpenMasterConnection( function () use ( &$count ) {
377  ++$count;
378  } );
379  $this->assertEquals( 2, $count, 'Connection handle count' );
380 
381  $tlCalls = 0;
382  $lb->setTransactionListener( 'test-listener', function () use ( &$tlCalls ) {
383  ++$tlCalls;
384  } );
385 
386  $lb->beginMasterChanges( __METHOD__ );
387  $bc = array_fill_keys( [ 'a', 'b', 'c', 'd' ], 0 );
388  $conn1->onTransactionPreCommitOrIdle( function () use ( &$bc, $conn1, $conn2 ) {
389  $bc['a'] = 1;
390  $conn2->onTransactionPreCommitOrIdle( function () use ( &$bc, $conn1, $conn2 ) {
391  $bc['b'] = 1;
392  $conn1->onTransactionPreCommitOrIdle( function () use ( &$bc, $conn1, $conn2 ) {
393  $bc['c'] = 1;
394  $conn1->onTransactionPreCommitOrIdle( function () use ( &$bc, $conn1, $conn2 ) {
395  $bc['d'] = 1;
396  } );
397  } );
398  } );
399  } );
400  $lb->finalizeMasterChanges();
401  $lb->approveMasterChanges( [] );
402  $lb->commitMasterChanges( __METHOD__ );
403  $lb->runMasterTransactionIdleCallbacks();
404  $lb->runMasterTransactionListenerCallbacks();
405 
406  $this->assertEquals( array_fill_keys( [ 'a', 'b', 'c', 'd' ], 1 ), $bc );
407  $this->assertEquals( 2, $tlCalls );
408 
409  $tlCalls = 0;
410  $lb->beginMasterChanges( __METHOD__ );
411  $ac = array_fill_keys( [ 'a', 'b', 'c', 'd' ], 0 );
412  $conn1->onTransactionCommitOrIdle( function () use ( &$ac, $conn1, $conn2 ) {
413  $ac['a'] = 1;
414  $conn2->onTransactionCommitOrIdle( function () use ( &$ac, $conn1, $conn2 ) {
415  $ac['b'] = 1;
416  $conn1->onTransactionCommitOrIdle( function () use ( &$ac, $conn1, $conn2 ) {
417  $ac['c'] = 1;
418  $conn1->onTransactionCommitOrIdle( function () use ( &$ac, $conn1, $conn2 ) {
419  $ac['d'] = 1;
420  } );
421  } );
422  } );
423  } );
424  $lb->finalizeMasterChanges();
425  $lb->approveMasterChanges( [] );
426  $lb->commitMasterChanges( __METHOD__ );
427  $lb->runMasterTransactionIdleCallbacks();
428  $lb->runMasterTransactionListenerCallbacks();
429 
430  $this->assertEquals( array_fill_keys( [ 'a', 'b', 'c', 'd' ], 1 ), $ac );
431  $this->assertEquals( 2, $tlCalls );
432 
433  $conn1->close();
434  $conn2->close();
435  }
436 
438  $lb = $this->newSingleServerLocalLoadBalancer();
439 
440  $rConn = $lb->getConnectionRef( DB_REPLICA );
441  $wConn = $lb->getConnectionRef( DB_MASTER );
442  $wConn2 = $lb->getConnectionRef( 0 );
443 
444  $v = [ 'value' => '1', '1' ];
445  $sql = 'SELECT MAX(1) AS value';
446  foreach ( [ $rConn, $wConn, $wConn2 ] as $conn ) {
447  $conn->clearFlag( $conn::DBO_TRX );
448 
449  $res = $conn->query( $sql, __METHOD__ );
450  $this->assertEquals( $v, $conn->fetchRow( $res ) );
451 
452  $res = $conn->query( $sql, __METHOD__, $conn::QUERY_REPLICA_ROLE );
453  $this->assertEquals( $v, $conn->fetchRow( $res ) );
454  }
455 
456  $wConn->getScopedLockAndFlush( 'key', __METHOD__, 1 );
457  $wConn2->getScopedLockAndFlush( 'key2', __METHOD__, 1 );
458  }
459 
463  public function testDBConnRefWritesReplicaRole() {
464  $lb = $this->newSingleServerLocalLoadBalancer();
465 
466  $rConn = $lb->getConnectionRef( DB_REPLICA );
467 
468  $rConn->query( 'DELETE FROM sometesttable WHERE 1=0' );
469  }
470 
475  $lb = $this->newMultiServerLocalLoadBalancer();
476 
477  $rConn = $lb->getConnectionRef( 1 );
478 
479  $rConn->query( 'DELETE FROM sometesttable WHERE 1=0' );
480  }
481 
486  $lb = $this->newMultiServerLocalLoadBalancer();
487 
488  $rConn = $lb->getConnectionRef( DB_REPLICA );
489 
490  $rConn->insert( 'test', [ 't' => 1 ], __METHOD__ );
491  }
492 }
$wgSQLiteDataDir
To override default SQLite data directory ($docroot/../data)
$called
$called tracks whether the setUp and tearDown method has been called.
processing should stop and the error should be shown to the user * false
Definition: hooks.txt:187
assertWriteForbidden(Database $db)
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
assertWriteAllowed(Database $db)
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2159
makeServerConfig( $flags=DBO_DEFAULT)
$wgDBpassword
Database user&#39;s password.
$wgDBtype
Database type.
$wgDBserver
Database host name or IP address.
startAtomic( $fname=__METHOD__, $cancelable=self::ATOMIC_NOT_CANCELABLE)
Begin an atomic section of SQL statements.
Definition: Database.php:3723
$wgDBuser
Database username.
A helper class for throttling authentication attempts.
query( $sql, $fname=__METHOD__, $flags=0)
Run an SQL query and return the result.
Definition: Database.php:1191
testOpenConnection()
LoadBalancer::openConnection() LoadBalancer::getAnyOpenConnection()
const DB_MASTER
Definition: defines.php:26
testDBConnRefWritesReplicaRoleInsert()
\Wikimedia\Rdbms\DBReadOnlyRoleError
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1982
testDBConnRefWritesReplicaRole()
\Wikimedia\Rdbms\DBReadOnlyRoleError
testWithoutReplica()
LoadBalancer::getLocalDomainID() LoadBalancer::resolveDomainID()
$res
Definition: database.txt:21
tableName( $name, $format='quoted')
Format a table name ready for use in constructing an SQL query.
Definition: Database.php:2410
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:780
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
testDBConnRefWritesReplicaRoleIndex()
\Wikimedia\Rdbms\DBReadOnlyRoleError
const DBO_TRX
Definition: defines.php:12
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
const DBO_DEFAULT
Definition: defines.php:13
getType()
Get the type of the DBMS, as it appears in $wgDBtype.
Class to handle database/prefix specification for IDatabase domains.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:52
Relational database abstraction object.
Definition: Database.php:48
rollback( $fname=__METHOD__, $flush='')
Rollback a transaction previously started using begin().
Definition: Database.php:4013
controlled by the following MediaWiki still creates a BagOStuff but calls it to it are no ops If the cache daemon can t be it should also disable itself fairly $wgDBname
Definition: memcached.txt:93
Database \Wikimedia\Rdbms\LoadBalancer.
dropTable( $tableName, $fName=__METHOD__)
Delete a table.
Definition: Database.php:4643
newMultiServerLocalLoadBalancer( $flags=DBO_DEFAULT)
delete( $table, $conds, $fname=__METHOD__)
DELETE query wrapper.
Definition: Database.php:3015
Database $db
Primary database.
const DB_REPLICA
Definition: defines.php:25
Database connection, tracking, load balancing, and transaction manager for a cluster.
Database error base class.
Definition: DBError.php:30