* (bug 29441) Expose CapitalLinks config in JS to allow modules to properly
handle titles on case-sensitive wikis.
* (bug 29397) Implement mw.Title module in core.
-* In MySQL 4.1.9+ with replication enabled, the slave lag should come from
- SHOW SLAVE STATUS instead of SHOW PROCESSLIST.
+* In MySQL 4.1.9+ with replication enabled, fetch the slave lag from SHOW SLAVE
+ STATUS instead of SHOW PROCESSLIST. This ensures that lag is reported
+ correctly in the case where there are no write events occurring. Note that
+ the DB user now needs to have the REPLICATION CLIENT privilege if you are
+ using replication.
* Language codes in $wgDummyLanguageCodes are now excluded on localization
statistics (maintenance/language/transstat.php)
* (bug 29586) Make the (next 200) links on categories link directly to
/**
* 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.
+ * May attempt to open connections to slaves on the default DB. If there is
+ * no lag, the maximum lag will be reported as -1.
+ *
* @param $wiki string Wiki ID, or false for the default database
*
* @return array ( host, max lag, index of max lagged host )
$maxLag = -1;
$host = '';
$maxIndex = 0;
- foreach ( $this->mServers as $i => $conn ) {
- $conn = false;
- if ( $wiki === false ) {
- $conn = $this->getAnyOpenConnection( $i );
- }
- if ( !$conn ) {
- $conn = $this->openConnection( $i, $wiki );
- }
- if ( !$conn ) {
- continue;
- }
- $lag = $conn->getLag();
- if ( $lag > $maxLag ) {
- $maxLag = $lag;
- $host = $this->mServers[$i]['host'];
- $maxIndex = $i;
+ if ( $this->getServerCount() > 1 ) { // no replication = no lag
+ foreach ( $this->mServers as $i => $conn ) {
+ $conn = false;
+ if ( $wiki === false ) {
+ $conn = $this->getAnyOpenConnection( $i );
+ }
+ if ( !$conn ) {
+ $conn = $this->openConnection( $i, $wiki );
+ }
+ if ( !$conn ) {
+ continue;
+ }
+ $lag = $conn->getLag();
+ if ( $lag > $maxLag ) {
+ $maxLag = $lag;
+ $host = $this->mServers[$i]['host'];
+ $maxIndex = $i;
+ }
}
}
return array( $host, $maxLag, $maxIndex );
if ( isset( $this->mLagTimes ) ) {
return $this->mLagTimes;
}
- # No, send the request to the load monitor
- $this->mLagTimes = $this->getLoadMonitor()->getLagTimes( array_keys( $this->mServers ), $wiki );
+ if ( $this->getServerCount() == 1 ) {
+ # No replication
+ $this->mLagTimes = array( 0 => 0 );
+ } else {
+ # Send the request to the load monitor
+ $this->mLagTimes = $this->getLoadMonitor()->getLagTimes(
+ array_keys( $this->mServers ), $wiki );
+ }
return $this->mLagTimes;
}