Page MenuHomePhabricator

[unusual] Replace LBFactory with injecting new Db-Service in Client's InjectRCRecordsJob
Closed, ResolvedPublic


InjectRCRecordsJob uses ILBFactory in a way that might be somewhat unanticipated in this endeavour:

$trxToken = $this->lbFactory->getEmptyTransactionTicket( __METHOD__ );
// Wait for all database replicas to be updated, but only for the affected client wiki. The
// "domain" argument is documented at ILBFactory::waitForReplication.
$this->lbFactory->commitAndWaitForReplication( __METHOD__, $trxToken, [ 'domain' => wfWikiID() ] );

We need to figure out if and how to replace this with the new service.

Event Timeline

After talking to @Addshore we decided that this can be refactored to avoid calling the unusual methods on LBFactory. Since this saves recent changes entries for the local wiki, this can simply get a write connection (RecentChanges.php does wfGetDB( DB_PRIMARY ) internally) and replace getEmptyTransactionTicket with a begin() and commitAndWaitForReplication with commit(), and then waiting for replication for the local domain.

Change 699194 had a related patch set uploaded (by Tobias Andersson; author: Tobias Andersson):

[mediawiki/extensions/Wikibase@master] Inject ClientDomainDb into InjectRCRecordsJob

Change 699194 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Inject ClientDomainDb into InjectRCRecordsJob

This should be done with the patch being merged