function wfWaitForSlaves(
$ifWritesSince = null, $wiki = false, $cluster = false, $timeout = null
) {
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
if ( $cluster === '*' ) {
$cluster = false;
- $wiki = false;
+ $domain = false;
} elseif ( $wiki === false ) {
- $wiki = wfWikiID();
+ $domain = $lbFactory->getLocalDomainID();
+ } else {
+ $domain = $wiki;
}
$opts = [
- 'wiki' => $wiki,
+ 'domain' => $domain,
'cluster' => $cluster,
// B/C: first argument used to be "max seconds of lag"; ignore such values
'ifWritesSince' => ( $ifWritesSince > 1e9 ) ? $ifWritesSince : null
$opts['timeout'] = $timeout;
}
- $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
return $lbFactory->waitForReplication( $opts );
}
$dbw = wfGetDB( DB_MASTER );
$dbw->onTransactionPreCommitOrIdle(
- function () {
- ResourceLoaderWikiModule::invalidateModuleCache( $this, null, null, wfWikiID() );
+ function () use ( $dbw ) {
+ ResourceLoaderWikiModule::invalidateModuleCache(
+ $this, null, null, $dbw->getDomainId() );
},
__METHOD__
);
if ( $count == 0 ) {
$lbFactory = $services->getDBLoadBalancerFactory();
$lbFactory->waitForReplication( [
- 'wiki' => wfWikiID(), 'timeout' => self::REPLICATION_WAIT_TIMEOUT ] );
+ 'domain' => $lbFactory->getLocalDomainID(),
+ 'timeout' => self::REPLICATION_WAIT_TIMEOUT
+ ] );
}
$this->db->insert( 'templatelinks',
[
}
// Bail out if there is too much DB lag.
// This check should not block as we want to try other wiki queues.
- list( , $maxLag ) = $lbFactory->getMainLB( wfWikiID() )->getMaxLag();
+ list( , $maxLag ) = $lbFactory->getMainLB()->getMaxLag();
if ( $maxLag >= self::MAX_ALLOWED_LAG ) {
$response['reached'] = 'replica-lag-limit';
return $response;
$syncThreshold = $this->config->get( 'JobSerialCommitThreshold' );
$time = false;
- $lb = $lbFactory->getMainLB( wfWikiID() );
+ $lb = $lbFactory->getMainLB();
if ( $syncThreshold !== false && $lb->getServerCount() > 1 ) {
// Generally, there is one master connection to the local DB
$dbwSerial = $lb->getAnyOpenConnection( $lb->getWriterIndex() );
if ( !isset( $this->params['range'] ) ) {
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
if ( !$lbFactory->waitForReplication( [
- 'wiki' => wfWikiID(),
+ 'domain' => $lbFactory->getLocalDomainID(),
'timeout' => self::LAG_WAIT_TIMEOUT
] ) ) { // only try so hard
$stats = MediaWikiServices::getInstance()->getStatsdDataFactory();
* @param int $userId
*/
public static function purge( $wikiId, $userId ) {
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
$key = $cache->makeGlobalKey( 'user', 'id', $wikiId, $userId );
$cache->delete( $key );
}
* @return string
*/
protected function getCacheKey( WANObjectCache $cache ) {
- return $cache->makeGlobalKey( 'user', 'id', wfWikiID(), $this->mId );
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
+ return $cache->makeGlobalKey( 'user', 'id', $lbFactory->getLocalDomainID(), $this->mId );
}
/**
}
public function testActorId() {
+ $domain = MediaWikiServices::getInstance()->getDBLoadBalancer()->getLocalDomainID();
$this->hideDeprecated( 'User::selectFields' );
// Newly-created user has an actor ID
'Actor ID can be retrieved for user loaded with User::selectFields()' );
$this->db->delete( 'actor', [ 'actor_user' => $id ], __METHOD__ );
- User::purge( wfWikiId(), $id );
+ User::purge( $domain, $id );
// Because WANObjectCache->delete() stupidly doesn't delete from the process cache.
ObjectCache::getMainWANInstance()->clearProcessCache();