http://www.mediawiki.org/wiki/Special:Code/MediaWiki/89450
Revision: 89450
Author: reedy
Date: 2011-06-03 22:59:34 +0000 (Fri, 03 Jun 2011)
Log Message:
-----------
* (bug 29267) always give the servername for meta=siteinfo&siprop=dbrepllag
Modified Paths:
--------------
trunk/phase3/RELEASE-NOTES-1.19
trunk/phase3/includes/api/ApiQuerySiteinfo.php
trunk/phase3/includes/db/LoadBalancer.php
Modified: trunk/phase3/RELEASE-NOTES-1.19
===================================================================
--- trunk/phase3/RELEASE-NOTES-1.19 2011-06-03 22:32:12 UTC (rev 89449)
+++ trunk/phase3/RELEASE-NOTES-1.19 2011-06-03 22:59:34 UTC (rev 89450)
@@ -94,6 +94,7 @@
* (bug 20699) API watchlist should list log-events
* (bug 29070) Add token to action=watch
* (bug 29221) Expose oldrevid in watchlist output
+* (bug 29267) always give the servername for meta=siteinfo&siprop=dbrepllag
=== Languages updated in 1.19 ===
Modified: trunk/phase3/includes/api/ApiQuerySiteinfo.php
===================================================================
--- trunk/phase3/includes/api/ApiQuerySiteinfo.php 2011-06-03 22:32:12 UTC
(rev 89449)
+++ trunk/phase3/includes/api/ApiQuerySiteinfo.php 2011-06-03 22:59:34 UTC
(rev 89450)
@@ -298,12 +298,12 @@
protected function appendDbReplLagInfo( $property, $includeAll ) {
global $wgShowHostnames;
$data = array();
+ $lb = wfGetLB();
if ( $includeAll ) {
if ( !$wgShowHostnames ) {
$this->dieUsage( 'Cannot view all servers info
unless $wgShowHostnames is true', 'includeAllDenied' );
}
- $lb = wfGetLB();
$lags = $lb->getLagTimes();
foreach ( $lags as $i => $lag ) {
$data[] = array(
@@ -312,9 +312,11 @@
);
}
} else {
- list( $host, $lag ) = wfGetLB()->getMaxLag();
+ list( $host, $lag, $index ) = $lb->getMaxLag();
$data[] = array(
- 'host' => $wgShowHostnames ? $host : '',
+ 'host' => $wgShowHostnames
+ ? $lb->getServerName( $index )
+ : '',
'lag' => intval( $lag )
);
}
Modified: trunk/phase3/includes/db/LoadBalancer.php
===================================================================
--- trunk/phase3/includes/db/LoadBalancer.php 2011-06-03 22:32:12 UTC (rev
89449)
+++ trunk/phase3/includes/db/LoadBalancer.php 2011-06-03 22:59:34 UTC (rev
89450)
@@ -921,10 +921,13 @@
* 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
+ *
+ * @return array ( host, max lag, index of max lagged host )
*/
function getMaxLag( $wiki = false ) {
$maxLag = -1;
$host = '';
+ $maxIndex = 0;
foreach ( $this->mServers as $i => $conn ) {
$conn = false;
if ( $wiki === false ) {
@@ -940,9 +943,10 @@
if ( $lag > $maxLag ) {
$maxLag = $lag;
$host = $this->mServers[$i]['host'];
+ $maxIndex = $i;
}
}
- return array( $host, $maxLag );
+ return array( $host, $maxLag, $maxIndex );
}
/**
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs