jenkins-bot has submitted this change and it was merged.
Change subject: Remove ConsistentReadConnectionManager and Test
......................................................................
Remove ConsistentReadConnectionManager and Test
Change-Id: I5a8c0fc6e84e7e662452d039d2f921e424c3c5bb
---
D client/includes/Store/Sql/ConsistentReadConnectionManager.php
D
client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
2 files changed, 0 insertions(+), 185 deletions(-)
Approvals:
WMDE-leszek: Looks good to me, approved
Addshore: Looks good to me, approved
jenkins-bot: Verified
diff --git a/client/includes/Store/Sql/ConsistentReadConnectionManager.php
b/client/includes/Store/Sql/ConsistentReadConnectionManager.php
deleted file mode 100644
index 078c17d..0000000
--- a/client/includes/Store/Sql/ConsistentReadConnectionManager.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-namespace Wikibase\Client\Store\Sql;
-
-use Wikimedia\Rdbms\SessionConsistentConnectionManager;
-
-/**
- * Database connection manager.
- *
- * This manages access to master and slave databases. It also manages state
that indicates whether
- * the slave databases are possibly outdated after a write operation, and thus
the master database
- * should be used for subsequent read operations.
- *
- * @note: Services that access overlapping sets of database tables, or
interact with logically
- * related sets of data in the database, should share a
ConsistentReadConnectionManager. Services accessing
- * unrelated sets of information may prefer to not share a
ConsistentReadConnectionManager, so they can still
- * perform read operations against slave databases after a (unrelated, per the
assumption) write
- * operation to the master database. Generally, sharing a
ConsistentReadConnectionManager improves consistency
- * (by avoiding race conditions due to replication lag), but can reduce
performance (by directing
- * more read operations to the master database server).
- *
- * @license GPL-2.0+
- * @author Daniel Kinzler
- *
- * @deprecated Please use SessionConsistentConnectionManager from core
- */
-class ConsistentReadConnectionManager extends
SessionConsistentConnectionManager{
-
- public function forceMaster() {
- $this->prepareForUpdates();
- }
-
-}
diff --git
a/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
b/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
deleted file mode 100644
index 38050ff..0000000
---
a/client/tests/phpunit/includes/Store/Sql/ConsistentReadConnectionManagerTest.php
+++ /dev/null
@@ -1,152 +0,0 @@
-<?php
-
-namespace Wikibase\Client\Tests\Store\Sql;
-
-use IDatabase;
-use LoadBalancer;
-use PHPUnit_Framework_MockObject_MockObject;
-use Wikibase\Client\Store\Sql\ConsistentReadConnectionManager;
-
-/**
- * @covers Wikibase\Client\Store\Sql\ConsistentReadConnectionManager
- *
- * @group Wikibase
- * @group WikibaseClient
- * @group WikibaseClientStore
- *
- * @license GPL-2.0+
- * @author DanielKinzler
- */
-class ConsistentReadConnectionManagerTest extends \PHPUnit_Framework_TestCase {
-
- /**
- * @return IDatabase|PHPUnit_Framework_MockObject_MockObject
- */
- private function getIDatabaseMock() {
- return $this->getMock( IDatabase::class );
- }
-
- /**
- * @return LoadBalancer|PHPUnit_Framework_MockObject_MockObject
- */
- private function getLoadBalancerMock() {
- $lb = $this->getMockBuilder( LoadBalancer::class )
- ->disableOriginalConstructor()
- ->getMock();
-
- return $lb;
- }
-
- public function testGetReadConnection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'getConnection' )
- ->with( DB_SLAVE )
- ->will( $this->returnValue( $database ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $actual = $manager->getReadConnection();
-
- $this->assertSame( $database, $actual );
- }
-
- public function testGetWriteConnection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'getConnection' )
- ->with( DB_MASTER )
- ->will( $this->returnValue( $database ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $actual = $manager->getWriteConnection();
-
- $this->assertSame( $database, $actual );
- }
-
- public function testForceMaster() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'getConnection' )
- ->with( DB_MASTER )
- ->will( $this->returnValue( $database ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $manager->forceMaster();
- $manager->getReadConnection();
- }
-
- public function testReleaseConnection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'reuseConnection' )
- ->with( $database )
- ->will( $this->returnValue( null ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $manager->releaseConnection( $database );
- }
-
- public function testBeginAtomicSection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->exactly( 2 ) )
- ->method( 'getConnection' )
- ->with( DB_MASTER )
- ->will( $this->returnValue( $database ) );
-
- $database->expects( $this->once() )
- ->method( 'startAtomic' )
- ->will( $this->returnValue( null ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $manager->beginAtomicSection( 'TEST' );
-
- // Should also ask for a DB_MASTER connection.
- // This is asserted by the $lb mock.
- $manager->getReadConnection();
- }
-
- public function testCommitAtomicSection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'reuseConnection' )
- ->with( $database )
- ->will( $this->returnValue( null ) );
-
- $database->expects( $this->once() )
- ->method( 'endAtomic' )
- ->will( $this->returnValue( null ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $manager->commitAtomicSection( $database, 'TEST' );
- }
-
- public function testRollbackAtomicSection() {
- $database = $this->getIDatabaseMock();
- $lb = $this->getLoadBalancerMock();
-
- $lb->expects( $this->once() )
- ->method( 'reuseConnection' )
- ->with( $database )
- ->will( $this->returnValue( null ) );
-
- $database->expects( $this->once() )
- ->method( 'rollback' )
- ->will( $this->returnValue( null ) );
-
- $manager = new ConsistentReadConnectionManager( $lb );
- $manager->rollbackAtomicSection( $database, 'TEST' );
- }
-
-}
--
To view, visit https://gerrit.wikimedia.org/r/322682
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I5a8c0fc6e84e7e662452d039d2f921e424c3c5bb
Gerrit-PatchSet: 10
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Addshore <[email protected]>
Gerrit-Reviewer: Addshore <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits