Page MenuHomePhabricator

SiteConfiguration.php - Error "no such wiki" when running runJobs.php
Closed, ResolvedPublic


Using MediaWiki 1.31.3, PostgreSQL 9.6.15 and PHP 7.3.0 I get the following error when running runJobs.php:

sudo -u www-data php maintenance/runJobs.php

[54b6866197614c7fdd8d6760] [no req] MWException from line 547 of /dev/disk2/mediawiki/mediawiki-1.31.3/includes/SiteConfiguration.php: No such wiki 'wiki-wiki'.
#0 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(453): SiteConfiguration->getConfig(string, array)
#1 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/libs/objectcache/WANObjectCache.php(1243): JobQueueGroup->{closure}(boolean, integer, array, NULL)
#2 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/libs/objectcache/WANObjectCache.php(1117): WANObjectCache->doGetWithSetCallback(string, integer, Closure, array)
#3 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(455): WANObjectCache->getWithSetCallback(string, integer, Closure, array)
#4 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(324): JobQueueGroup->getCachedConfigVar(string)
#5 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(425): JobQueueGroup->getQueueTypes()
#6 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(369): JobQueueGroup->getCoalescedQueues()
#7 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobQueueGroup.php(254): JobQueueGroup->getQueuesWithJobs()
#8 /dev/disk2/mediawiki/mediawiki-1.31.3/includes/jobqueue/JobRunner.php(165): JobQueueGroup->pop(integer, integer, array)
#9 /dev/disk2/mediawiki/mediawiki-1.31.3/maintenance/runJobs.php(89): JobRunner->run(array)
#10 /dev/disk2/mediawiki/mediawiki-1.31.3/maintenance/doMaintenance.php(94): RunJobs->execute()
#11 /dev/disk2/mediawiki/mediawiki-1.31.3/maintenance/runJobs.php(122): require_once(string)
#12 {main}

Does work when using mySQL.

I'm not sure, but it seems, $wiki is construced using $wgDBname and $wgDBmwschema which results in a wrong wiki-/db-name.

In my case:

$wgDBname = "wiki"
$wgDBmwschema = "wiki"

The database is called wiki, the tables are without a prefix (archive, bot_passwords, etc.)

Event Timeline

Just installed a new wiki to test my assumption:

$wgDBname = "wikidb"
$wgDBmwschema = "wikischema"


No such wiki 'wikidb-wikischema'

This does not occur if you use the latest 1.33, so it looks like Change ID Ia3c5855b18b98d9fc5bc02fe68358cfa52ccbce1 didn't cherry pick enough...

I found the missing change. It's the last one in, file includes/libs/rdbms/database/DatabaseDomain.php:

@@ -150,7 +192,12 @@ private function convertToString() {
 		if ( $this->schema !== null ) {
 			$parts[] = $this->schema;
-		if ( $this->prefix != '' ) {
+		if ( $this->prefix != '' || $this->schema !== null ) {
+			// If there is a schema, then we need the prefix to disambiguate.
+			// For engines like Postgres that use schemas, this awkwardness is hopefully
+			// avoided since it is easy to have one DB per server (to avoid having many users)
+			// and use schema/prefix to have wiki farms. For example, a domain schemes could be
+			// wiki-<project>-<language>, e.g. "wiki-fitness-es"/"wiki-sports-fr"/"wiki-news-en".
 			$parts[] = $this->prefix;

Successfully tested against MW 1.31.6.

@Hschletz: Thanks for taking a look at the code!

You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

Change 571108 had a related patch set uploaded (by saper; owner: Aaron Schulz):
[mediawiki/core@REL1_31] rdbms: re-add DB domain sanity checks to LoadBalancer

Krinkle moved this task from Untriaged to Rdbms library on the Wikimedia-Rdbms board.
Krinkle added a subscriber: Krinkle.

Looks like some sort of backport of custom patch for fixing an rdbms problem on MW 1.31.

Yes, that's what my patch is about.

@thcipriani We wanted to check on who decides whether this should be back ported into 1.31, we weren't sure if it was for us to review and merge the change.

@thcipriani We wanted to check on who decides whether this should be back ported into 1.31, we weren't sure if it was for us to review and merge the change.

I'd defer to @CCicalese_WMF on those questions given all her work on the past few releases.

Anomie added a subscriber: Anomie.

The question was more "who is responsible for reviewing and merging backports" than "who decides". But at this point I'm just going to do it to get this done already.

Change 571108 merged by jenkins-bot:
[mediawiki/core@REL1_31] rdbms: re-add DB domain sanity checks to LoadBalancer

Thank you @Anomie for having this one un-stuck! Much appreciated.