]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/db/LoadBalancer.php
MediaWiki 1.16.0
[autoinstallsdev/mediawiki.git] / includes / db / LoadBalancer.php
index 0b8ef05a08177ae92a23546c31d61dbe39e85bc9..083b70b3614d5c8b6446850c7a68de7418c6be44 100644 (file)
@@ -809,7 +809,7 @@ class LoadBalancer {
                foreach ( $this->mConns as $conns2 ) {
                        foreach ( $conns2 as $conns3 ) {
                                foreach ( $conns3 as $conn ) {
-                                       $conn->immediateCommit();
+                                       $conn->commit();
                                }
                        }
                }
@@ -831,7 +831,7 @@ class LoadBalancer {
                }
        }
 
-       function waitTimeout( $value = NULL ) {
+       function waitTimeout( $value = null ) {
                return wfSetVar( $this->mWaitTimeout, $value );
        }
 
@@ -878,14 +878,18 @@ class LoadBalancer {
         * Get the hostname and lag time of the most-lagged slave.
         * This is useful for maintenance scripts that need to throttle their updates.
         * May attempt to open connections to slaves on the default DB.
+        * @param $wiki string Wiki ID, or false for the default database
         */
-       function getMaxLag() {
+       function getMaxLag( $wiki = false ) {
                $maxLag = -1;
                $host = '';
                foreach ( $this->mServers as $i => $conn ) {
-                       $conn = $this->getAnyOpenConnection( $i );
+                       $conn = false;
+                       if ( $wiki === false ) {
+                               $conn = $this->getAnyOpenConnection( $i );
+                       }
                        if ( !$conn ) {
-                               $conn = $this->openConnection( $i );
+                               $conn = $this->openConnection( $i, $wiki );
                        }
                        if ( !$conn ) {
                                continue;
@@ -912,4 +916,11 @@ class LoadBalancer {
                $this->mLagTimes = $this->getLoadMonitor()->getLagTimes( array_keys( $this->mServers ), $wiki );
                return $this->mLagTimes;
        }
+
+       /**
+        * Clear the cache for getLagTimes
+        */
+       function clearLagTimeCache() {
+               $this->mLagTimes = null;
+       }
 }