Page MenuHomePhabricator

Error running `extensions/Wikibase/lib/maintenance/populateSitesTable.php --force-protocol https` on jbowiki
Closed, DeclinedPublicPRODUCTION ERROR

Description

jbowiki:  A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
jbowiki:  Query: INSERT  INTO `site_identifiers` (si_site,si_type,si_key) VALUES ('203','equivalent','fa')
jbowiki:  Function: DBSiteStore::saveSites
jbowiki:  Error: 1062 Duplicate entry 'equivalent-fa' for key 'site_ids_type' (10.64.16.27)
jbowiki:  done.
[bbcd38dd] [no req]   DBUnexpectedError from line 3534 of /srv/mediawiki/php-1.27.0-wmf.9/includes/db/Database.php: Got COMMIT while atomic sections DBSiteStore::saveSites are still open
Backtrace:
#0 /srv/mediawiki/php-1.27.0-wmf.9/includes/db/loadbalancer/LoadBalancer.php(1050): DatabaseBase->commit(string, string)
#1 [internal function]: LoadBalancer->commitMasterChanges()
#2 /srv/mediawiki/php-1.27.0-wmf.9/includes/db/loadbalancer/LBFactory.php(194): call_user_func_array(array, array)
#3 [internal function]: {closure}(LoadBalancer, string, array)
#4 /srv/mediawiki/php-1.27.0-wmf.9/includes/db/loadbalancer/LBFactoryMulti.php(394): call_user_func_array(Closure, array)
#5 /srv/mediawiki/php-1.27.0-wmf.9/includes/db/loadbalancer/LBFactory.php(195): LBFactoryMulti->forEachLB(Closure, array)
#6 /srv/mediawiki/php-1.27.0-wmf.9/includes/db/loadbalancer/LBFactory.php(212): LBFactory->forEachLBCallMethod(string)
#7 /srv/mediawiki/php-1.27.0-wmf.9/maintenance/doMaintenance.php(116): LBFactory->commitMasterChanges()
#8 /srv/mediawiki/php-1.27.0-wmf.9/extensions/Wikidata/extensions/Wikibase/lib/maintenance/populateSitesTable.php(125): require_once(string)
#9 /srv/mediawiki/multiversion/MWScript.php(97): require_once(string)
#10 {main}

Event Timeline

Krenair raised the priority of this task from to Needs Triage.
Krenair updated the task description. (Show Details)
Krenair added a project: Wikidata.
Krenair subscribed.

Maybe this is actually a addWiki.php bug?

I just found the following on the (freshly setup) inhwiki:

wikiadmin@db1077(inhwiki)>SELECT * FROM sites;
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+
| site_id | site_global_key | site_type | site_group | site_source | site_language | site_protocol | site_domain             | site_data                                                                                                                                         | site_forward | site_config |
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+
|       1 | advisorswiki    | mediawiki | advisors   | local       | en            | https         | gro.aidemikiw.srosivda. | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:35:"https://advisors.wikimedia.org/w/$1";s:9:"page_path";s:38:"https://advisors.wikimedia.org/wiki/$1";}} |            0 | a:0:{}      |
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+
1 row in set (0.00 sec)

wikiadmin@db1077(inhwiki)>SELECT COUNT(*) FROM site_identifiers;
+----------+
| COUNT(*) |
+----------+
|      697 |
+----------+
1 row in set (0.00 sec)

So the populateSitesTable.php call in addWiki is not working as expected, it seems…

I saw similar things on all the newly-created wikis. For example on euwikisource:

wikiadmin@db1075(euwikisource)>SELECT COUNT(*) FROM site_identifiers;
+----------+
| COUNT(*) |
+----------+
|      233 |
+----------+
1 row in set (0.01 sec)

wikiadmin@db1075(euwikisource)>SELECT * FROM sites;
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+
| site_id | site_global_key | site_type | site_group | site_source | site_language | site_protocol | site_domain             | site_data                                                                                                                                         | site_forward | site_config |
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+
|       1 | advisorswiki    | mediawiki | advisors   | local       | en            | https         | gro.aidemikiw.srosivda. | a:1:{s:5:"paths";a:2:{s:9:"file_path";s:35:"https://advisors.wikimedia.org/w/$1";s:9:"page_path";s:38:"https://advisors.wikimedia.org/wiki/$1";}} |            0 | a:0:{}      |                                                                                                
+---------+-----------------+-----------+------------+-------------+---------------+---------------+-------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------+--------------+-------------+                                                                                                
1 row in set (0.00 sec)

Mentioned in SAL (#wikimedia-operations) [2018-06-07T15:23:59Z] <hoo> Emptied out the sites and site_identifiers tables on pswikivoyage, pmswikisource, bnwikivoyage and sahwikiquote for T122520,

Addshore lowered the priority of this task from High to Medium.Nov 13 2018, 1:52 PM
Addshore moved this task from incoming to needs discussion or investigation on the Wikidata board.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:11 PM

Still an issue?

I have been running this script in the past couple of years and never encountered this issue. I guess we can close and then reopen if it occurs again?