From: Aaron Schulz Date: Wed, 21 Sep 2016 08:38:45 +0000 (-0700) Subject: Make LBFactory::waitForReplication() use "domain" instead of "wiki" X-Git-Tag: 1.31.0-rc.0~5419^2 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%7B%7B%20url_for%28%27vote%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=commitdiff_plain;h=3b556210a41b97b02533d68e58796fedfa1e30a8;p=lhc%2Fweb%2Fwiklou.git Make LBFactory::waitForReplication() use "domain" instead of "wiki" Change-Id: Id7e55fddb96631b3938ee6ddcfcc3ce13ba942d4 --- diff --git a/includes/libs/rdbms/lbfactory/LBFactory.php b/includes/libs/rdbms/lbfactory/LBFactory.php index cf9a29842b..d75ba931ee 100644 --- a/includes/libs/rdbms/lbfactory/LBFactory.php +++ b/includes/libs/rdbms/lbfactory/LBFactory.php @@ -410,14 +410,14 @@ abstract class LBFactory { * This makes sense when lag being waiting on is caused by the code that does this check. * In that case, setting "ifWritesSince" can avoid the overhead of waiting for clusters * that were not changed since the last wait check. To forcefully wait on a specific cluster - * for a given wiki, use the 'wiki' parameter. To forcefully wait on an "external" cluster, + * for a given domain, use the 'domain' parameter. To forcefully wait on an "external" cluster, * use the "cluster" parameter. * * Never call this function after a large DB write that is *still* in a transaction. * It only makes sense to call this after the possible lag inducing changes were committed. * * @param array $opts Optional fields that include: - * - wiki : wait on the load balancer DBs that handles the given wiki + * - domain : wait on the load balancer DBs that handles the given domain ID * - cluster : wait on the given external load balancer DBs * - timeout : Max wait time. Default: ~60 seconds * - ifWritesSince: Only wait if writes were done since this UNIX timestamp @@ -426,19 +426,23 @@ abstract class LBFactory { */ public function waitForReplication( array $opts = [] ) { $opts += [ - 'wiki' => false, + 'domain' => false, 'cluster' => false, 'timeout' => 60, 'ifWritesSince' => null ]; + if ( $opts['domain'] === false && isset( $opts['wiki'] ) ) { + $opts['domain'] = $opts['wiki']; // b/c + } + // Figure out which clusters need to be checked /** @var ILoadBalancer[] $lbs */ $lbs = []; if ( $opts['cluster'] !== false ) { $lbs[] = $this->getExternalLB( $opts['cluster'] ); - } elseif ( $opts['wiki'] !== false ) { - $lbs[] = $this->getMainLB( $opts['wiki'] ); + } elseif ( $opts['domain'] !== false ) { + $lbs[] = $this->getMainLB( $opts['domain'] ); } else { $this->forEachLB( function ( ILoadBalancer $lb ) use ( &$lbs ) { $lbs[] = $lb;