Fixed fatal when using fake load balancers.
The error was: Catchable fatal error: Argument 1 passed to DatabaseMysql::masterPosWait() must implement interface DBMasterPos, boolean given, called in /var/www/DevWiki/core/includes/db/LoadBalancer.php on line 419 Change-Id: I230585930c1424b0868f9aa290167c66bc6848bd
This commit is contained in:
parent
36cade5fe8
commit
7fd8d513c4
2 changed files with 8 additions and 4 deletions
|
|
@ -3615,7 +3615,11 @@ function wfWaitForSlaves( $maxLag = false, $wiki = false ) {
|
|||
if ( $lb->getServerCount() > 1 ) {
|
||||
$dbw = $lb->getConnection( DB_MASTER, array(), $wiki );
|
||||
$pos = $dbw->getMasterPos();
|
||||
$lb->waitForAll( $pos );
|
||||
// The DBMS may not support getMasterPos() or the whole
|
||||
// load balancer might be fake (e.g. $wgAllDBsAreLocalhost).
|
||||
if ( $pos !== false ) {
|
||||
$lb->waitForAll( $pos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ class LoadBalancer {
|
|||
* Set the master wait position
|
||||
* If a DB_SLAVE connection has been opened already, waits
|
||||
* Otherwise sets a variable telling it to wait if such a connection is opened
|
||||
* @param $pos int
|
||||
* @param $pos DBMasterPos
|
||||
*/
|
||||
public function waitFor( $pos ) {
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
|
@ -366,7 +366,7 @@ class LoadBalancer {
|
|||
|
||||
/**
|
||||
* Set the master wait position and wait for ALL slaves to catch up to it
|
||||
* @param $pos int
|
||||
* @param $pos DBMasterPos
|
||||
*/
|
||||
public function waitForAll( $pos ) {
|
||||
wfProfileIn( __METHOD__ );
|
||||
|
|
@ -399,7 +399,7 @@ class LoadBalancer {
|
|||
* @param $open bool
|
||||
* @return bool
|
||||
*/
|
||||
function doWait( $index, $open = false ) {
|
||||
protected function doWait( $index, $open = false ) {
|
||||
# Find a connection to wait on
|
||||
$conn = $this->getAnyOpenConnection( $index );
|
||||
if ( !$conn ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue