aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/db/LBFactoryTest.php
diff options
context:
space:
mode:
authorAmir Sarabadani <ladsgroup@gmail.com>2022-10-13 16:03:27 +0200
committerKrinkle <krinkle@fastmail.com>2022-12-15 00:37:02 +0000
commit9b078129d24bde3e622dd510edcdd532c867a2ff (patch)
treef26887d4786a68cec082ec83a1a66bb0ac18055c /tests/phpunit/includes/db/LBFactoryTest.php
parent06c79bc445b8c2a4dd49acac4350e7de536f355c (diff)
downloadmediawikicore-9b078129d24bde3e622dd510edcdd532c867a2ff.tar.gz
mediawikicore-9b078129d24bde3e622dd510edcdd532c867a2ff.zip
rdbms: Moving replication-related code to its own component
Remove 'insertSelectIsSafe' option, unused. Remove 'topologicalPrimaryConnRef' option, no longer used as of two months ago with I41a57247503 (8c9398f7f94f). Remove unneeded DatabaseSqlite::getTopologyBasedServerId implementation which can inherit null instead of overriding with string of "0". Only caller is SqlBagOStuff::makeTimestampedModificationToken which can be used as MainStash DB, where its important that a given server always has the same unique name within a set of db hosts that may replicate to each other. By inheriting null as topology server ID, it SqlBagOStuff will use IDatabase::getServerName instead. That in turn uses the 'host' connection parameter, which defaults to null in DatabaseFactory, and then falls back to the string "unknown" which is as good as "0" for this purpose. Bug: T299691 Change-Id: Iceb65c28cdd3c4a89b3c8b34c3f95d3285718ec0
Diffstat (limited to 'tests/phpunit/includes/db/LBFactoryTest.php')
-rw-r--r--tests/phpunit/includes/db/LBFactoryTest.php17
1 files changed, 0 insertions, 17 deletions
diff --git a/tests/phpunit/includes/db/LBFactoryTest.php b/tests/phpunit/includes/db/LBFactoryTest.php
index 0fc11ba283eb..0fccdddb23a7 100644
--- a/tests/phpunit/includes/db/LBFactoryTest.php
+++ b/tests/phpunit/includes/db/LBFactoryTest.php
@@ -83,8 +83,6 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
}
public function testLBFactorySimpleServers() {
- global $wgDBserver;
-
$primaryConfig = $this->getPrimaryServerConfig();
$fakeReplica = [ 'load' => 100, ] + $primaryConfig;
@@ -101,30 +99,15 @@ class LBFactoryTest extends MediaWikiIntegrationTestCase {
$dbw = $lb->getConnection( DB_PRIMARY );
$dbw->ensureConnection();
- $wConn = TestingAccessWrapper::newFromObject( $dbw )->conn;
- $wConnWrap = TestingAccessWrapper::newFromObject( $wConn );
$this->assertEquals(
$dbw::ROLE_STREAMING_MASTER, $dbw->getTopologyRole(), 'primary shows as primary' );
- $this->assertInstanceOf( IDatabase::class, $wConnWrap->topologicalPrimaryConnRef );
- $this->assertEquals(
- ( $wgDBserver != '' ) ? $wgDBserver : 'localhost',
- $wConnWrap->topologicalPrimaryConnRef->getServerName(),
- 'cluster primary is set' );
$dbr = $lb->getConnection( DB_REPLICA );
$dbr->ensureConnection();
- $rConn = TestingAccessWrapper::newFromObject( $dbr )->conn;
- $rConnWrap = TestingAccessWrapper::newFromObject( $rConn );
$this->assertEquals(
$dbr::ROLE_STREAMING_REPLICA, $dbr->getTopologyRole(), 'replica shows as replica' );
- $this->assertInstanceOf( IDatabase::class, $rConnWrap->topologicalPrimaryConnRef );
- $this->assertEquals(
- ( $wgDBserver != '' ) ? $wgDBserver : 'localhost',
- $rConnWrap->topologicalPrimaryConnRef->getServerName(),
- 'cluster primary is set'
- );
$factory->shutdown();
}