Aaron Schulz has uploaded a new change for review.

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

Change subject: Made wfWaitForSlaves check all master connections for writes
......................................................................

Made wfWaitForSlaves check all master connections for writes

* Previously it just checked the main connection

Change-Id: If63498e4fa2800f8ffbde4c570c556f21b554473
(cherry picked from commit 95cfa54557530551cf8f8052f474f4f2f0b2cc88)
---
M includes/GlobalFunctions.php
1 file changed, 7 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/79/204979/1

diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 3931be3..90460fd 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -3766,20 +3766,14 @@
        // time needed to wait on the next clusters.
        $masterPositions = array_fill( 0, count( $lbs ), false );
        foreach ( $lbs as $i => $lb ) {
-               // bug 27975 - Don't try to wait for slaves if there are none
-               // Prevents permission error when getting master position
-               if ( $lb->getServerCount() > 1 ) {
-                       if ( $ifWritesSince && !$lb->hasMasterConnection() ) {
-                               continue; // assume no writes done
-                       }
-                       // Use the empty string to not trigger selectDB() since 
the connection
-                       // may have been to a server that does not have a DB 
for the current wiki.
-                       $dbw = $lb->getConnection( DB_MASTER, array(), '' );
-                       if ( $ifWritesSince && $dbw->lastDoneWrites() < 
$ifWritesSince ) {
-                               continue; // no writes since the last wait
-                       }
-                       $masterPositions[$i] = $dbw->getMasterPos();
+               if ( $lb->getServerCount() <= 1 ) {
+                       // Bug 27975 - Don't try to wait for slaves if there 
are none
+                       // Prevents permission error when getting master 
position
+                       continue;
+               } elseif ( $ifWritesSince && $lb->lastMasterChangeTimestamp() < 
$ifWritesSince ) {
+                       continue; // no writes since the last wait
                }
+               $masterPositions[$i] = $lb->getMasterPos();
        }
 
        $ok = true;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If63498e4fa2800f8ffbde4c570c556f21b554473
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.26wmf2
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

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

Reply via email to