Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/305946

Change subject: Use newer transaction methods in BatchRowWriter
......................................................................

Use newer transaction methods in BatchRowWriter

Change-Id: I9f8c2576f511419e77e9b6f10c96a43e5d69704e
---
M includes/utils/BatchRowWriter.php
1 file changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/46/305946/1

diff --git a/includes/utils/BatchRowWriter.php 
b/includes/utils/BatchRowWriter.php
index ffb7053..a6e47c8 100644
--- a/includes/utils/BatchRowWriter.php
+++ b/includes/utils/BatchRowWriter.php
@@ -20,6 +20,8 @@
  * @file
  * @ingroup Maintenance
  */
+use \MediaWiki\MediaWikiServices;
+
 class BatchRowWriter {
        /**
         * @var IDatabase $db The database to write to
@@ -54,7 +56,8 @@
         *  names to update values to apply to the row.
         */
        public function write( array $updates ) {
-               $this->db->begin();
+               $lbFactory = 
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+               $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
 
                foreach ( $updates as $update ) {
                        $this->db->update(
@@ -65,7 +68,6 @@
                        );
                }
 
-               $this->db->commit();
-               wfGetLBFactory()->waitForReplication();
+               $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
        }
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9f8c2576f511419e77e9b6f10c96a43e5d69704e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to