jenkins-bot has submitted this change and it was merged.

Change subject: Remove Atomic methods from ConnectionManagers
......................................................................


Remove Atomic methods from ConnectionManagers

Change-Id: I697f63f45975b13af52bc22fced6e4d07e35115f
Depends-On: I4341a1b4ff6a67e4c1770faae38e9b126f1bf0bf
---
M includes/libs/rdbms/connectionmanager/ConnectionManager.php
M includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php
M 
tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
3 files changed, 0 insertions(+), 116 deletions(-)

Approvals:
  Krinkle: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/rdbms/connectionmanager/ConnectionManager.php 
b/includes/libs/rdbms/connectionmanager/ConnectionManager.php
index 6d5d8ab..4f72f77 100644
--- a/includes/libs/rdbms/connectionmanager/ConnectionManager.php
+++ b/includes/libs/rdbms/connectionmanager/ConnectionManager.php
@@ -138,43 +138,4 @@
                return $this->getConnectionRef( DB_REPLICA, $groups );
        }
 
-       /**
-        * Begins an atomic section and returns a database connection to the 
master DB, for updating.
-        *
-        * @since 1.29
-        *
-        * @param string $fname
-        *
-        * @return Database
-        */
-       public function beginAtomicSection( $fname ) {
-               $db = $this->getWriteConnection();
-               $db->startAtomic( $fname );
-
-               return $db;
-       }
-
-       /**
-        * @since 1.29
-        *
-        * @param IDatabase $db
-        * @param string $fname
-        */
-       public function commitAtomicSection( IDatabase $db, $fname ) {
-               $db->endAtomic( $fname );
-               $this->releaseConnection( $db );
-       }
-
-       /**
-        * @since 1.29
-        *
-        * @param IDatabase $db
-        * @param string $fname
-        */
-       public function rollbackAtomicSection( IDatabase $db, $fname ) {
-               // FIXME: there does not seem to be a clean way to roll back an 
atomic section?!
-               $db->rollback( $fname, 'flush' );
-               $this->releaseConnection( $db );
-       }
-
 }
diff --git 
a/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php 
b/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php
index 02972e5..e183823 100644
--- 
a/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php
+++ 
b/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManager.php
@@ -37,7 +37,6 @@
        /**
         * Forces all future calls to getReadConnection() to return a write 
connection.
         * Use this before performing read operations that are critical for a 
future update.
-        * Calling beginAtomicSection() implies a call to prepareForUpdates().
         *
         * @since 1.29
         */
@@ -93,26 +92,6 @@
        public function getWriteConnectionRef() {
                $this->prepareForUpdates();
                return parent::getWriteConnectionRef();
-       }
-
-       /**
-        * Begins an atomic section and returns a database connection to the 
master DB, for updating.
-        *
-        * @since 1.29
-        *
-        * @note: This causes all future calls to getReadConnection() to return 
a connection
-        * to the master DB, even after commitAtomicSection() or 
rollbackAtomicSection() have
-        * been called.
-        *
-        * @param string $fname
-        *
-        * @return Database
-        */
-       public function beginAtomicSection( $fname ) {
-               // Once we have written to master, do not read from replica.
-               $this->prepareForUpdates();
-
-               return parent::beginAtomicSection( $fname );
        }
 
 }
diff --git 
a/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
 
b/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
index 4dcab82..0d54659 100644
--- 
a/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
+++ 
b/tests/phpunit/includes/libs/rdbms/connectionmanager/SessionConsistentConnectionManagerTest.php
@@ -105,60 +105,4 @@
                $manager = new SessionConsistentConnectionManager( $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 SessionConsistentConnectionManager( $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 SessionConsistentConnectionManager( $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 SessionConsistentConnectionManager( $lb );
-               $manager->rollbackAtomicSection( $database, 'TEST' );
-       }
-
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/324630
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I697f63f45975b13af52bc22fced6e4d07e35115f
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Addshore <addshorew...@gmail.com>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de>
Gerrit-Reviewer: Krinkle <krinklem...@gmail.com>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to