Aaron Schulz has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/404057 )
Change subject: Fix LoadBalancer::getMasterPos() callers to handle a non-object
being returned
......................................................................
Fix LoadBalancer::getMasterPos() callers to handle a non-object being returned
Change-Id: I3356057f27a051835734329afa339ea76842a389
---
M includes/libs/rdbms/ChronologyProtector.php
M includes/libs/rdbms/lbfactory/LBFactory.php
M includes/objectcache/SqlBagOStuff.php
3 files changed, 8 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/57/404057/1
diff --git a/includes/libs/rdbms/ChronologyProtector.php
b/includes/libs/rdbms/ChronologyProtector.php
index 152ff74..4fcd885 100644
--- a/includes/libs/rdbms/ChronologyProtector.php
+++ b/includes/libs/rdbms/ChronologyProtector.php
@@ -147,8 +147,10 @@
$masterName = $lb->getServerName( $lb->getWriterIndex() );
if ( $lb->getServerCount() > 1 ) {
$pos = $lb->getMasterPos();
- $this->logger->info( __METHOD__ . ": LB for
'$masterName' has pos $pos\n" );
- $this->shutdownPositions[$masterName] = $pos;
+ if ( $pos ) {
+ $this->logger->info( __METHOD__ . ": LB for
'$masterName' has pos $pos\n" );
+ $this->shutdownPositions[$masterName] = $pos;
+ }
} else {
$this->logger->info( __METHOD__ . ": DB '$masterName'
touched\n" );
}
diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php
b/includes/libs/rdbms/lbfactory/LBFactory.php
index 187527e..2324553 100644
--- a/includes/libs/rdbms/lbfactory/LBFactory.php
+++ b/includes/libs/rdbms/lbfactory/LBFactory.php
@@ -358,7 +358,7 @@
$failed = [];
foreach ( $lbs as $i => $lb ) {
if ( $masterPositions[$i] ) {
- // The DBMS may not support getMasterPos()
+ // The RDBMS may not support getMasterPos()
if ( !$lb->waitForAll( $masterPositions[$i],
$opts['timeout'] ) ) {
$failed[] = $lb->getServerName(
$lb->getWriterIndex() );
}
diff --git a/includes/objectcache/SqlBagOStuff.php
b/includes/objectcache/SqlBagOStuff.php
index c286055..6691f73 100644
--- a/includes/objectcache/SqlBagOStuff.php
+++ b/includes/objectcache/SqlBagOStuff.php
@@ -808,6 +808,9 @@
// Main LB is used; wait for any replica DBs to catch up
$masterPos = $lb->getMasterPos();
+ if ( !$masterPos ) {
+ return true; // not applicable
+ }
$loop = new WaitConditionLoop(
function () use ( $lb, $masterPos ) {
--
To view, visit https://gerrit.wikimedia.org/r/404057
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3356057f27a051835734329afa339ea76842a389
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits