Page MenuHomePhabricator

make addwiki.php use 'CREATE IF NOT EXISTS' consistently
Closed, ResolvedPublic

Description

Today, a new wiki has been created, amwikimedia. So addwiki.php was executed to make that happen.

Later we got this alert:

16:18 < icinga-wm> PROBLEM - MariaDB Slave SQL: s3 on dbstore1001 is CRITICAL: CRITICAL slave_sql_state Slave_SQL_Running: No, Errno: 1061, Errmsg: Error Duplicate key name eu_entity_id on query. Default database: amwikimedia. [Query snipped]

@jcrespo pointed out that this is a Mediawiki bug and that "please change add wiki to do CREATE IF NOT EXISTS".

addwiki.php isn't part of mw core or in puppet, it's in this MW extension: https://www.mediawiki.org/wiki/Extension:WikimediaMaintenance

Event Timeline

Dzahn created this task.Oct 5 2017, 8:46 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 5 2017, 8:46 PM
mmodell added a subscriber: mmodell.Oct 5 2017, 8:49 PM

Submitted a patch: gerrit change

Dzahn added a subscriber: Reedy.Oct 5 2017, 8:50 PM

Change 382572 had a related patch set uploaded (by Jforrester; owner: 20after4):
[mediawiki/extensions/WikimediaMaintenance@master] In addWiki, add "IF NOT EXISTS" to CREATE DATABASE statement.

https://gerrit.wikimedia.org/r/382572

Note that there must be more instances missing the IF NOT EXISTS, my patch just fixes one 'create database' statement.

mmodell triaged this task as Normal priority.Oct 5 2017, 8:54 PM
mmodell added a project: MediaWiki-Rdbms.

What's calling addWiki though?

Reedy added a comment.Oct 5 2017, 9:01 PM

Note that there must be more instances missing the IF NOT EXISTS, my patch just fixes one 'create database' statement.

They're already there for external storage and the echo cluster

Oh, this is just to avoid causing more T177535 issues in future?

Reedy added a comment.Oct 5 2017, 9:05 PM

the IF NOT EXISTS plays a lot more nicely with replication if things go wrong

Don't think it's anything to do with T177535 though

Dzahn updated the task description. (Show Details)Oct 5 2017, 9:59 PM

Change 382572 merged by jenkins-bot:
[mediawiki/extensions/WikimediaMaintenance@master] In addWiki, add "IF NOT EXISTS" to CREATE DATABASE statement.

https://gerrit.wikimedia.org/r/382572

I was wrong- while the IF EXIST is still needed, it was not the cause of replication breakage (at least not this time), apparently amwikimedia was created on s7 first, and then on s3, which lead to dbstores (using multisource) to complain about some duplicates. All of amwikimedia on s7 should have been deleted before continuing the deployment. See https://phabricator.wikimedia.org/T176043#3690781 and following.

I think the patch is still needed, and it did work only because we do not have all data that we should on all hosts.

Reedy added a comment.Oct 17 2017, 3:59 PM

I think the patch is still needed, and it did work only because we do not have all data that we should on all hosts.

It's certainly not going to cause any harm staying around now it has been merged

Oh, was already merged? Then this can be closed?

Reedy closed this task as Resolved.Oct 17 2017, 4:13 PM
Reedy assigned this task to mmodell.

Yip