Page MenuHomePhabricator

Upgrade script for MySQL missing table msg_resource_links
Closed, InvalidPublic

Description

Author: puiterwijk

Description:
The upgrade script for MySQL (includes/installer/MysqlUpgrade.php) provided with MediaWiki 1.19.1 is missing the addtable for %{prefix}msg_resource_links.
This makes that an upgraded database trips over the large number of REPLACE INTO's for %{prefix}msg_resource.

This addtable statement IS available in the upgrade scripts for IBM DB2 and Oracle.


Version: 1.19
Severity: critical

Details

Reference
bz39046

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 12:57 AM
bzimport set Reference to bz39046.
bzimport added a subscriber: Unknown Object (MLST).

puiterwijk wrote:

This patch fixes the problem

Attached:

Per comments on gerrit, those additions are files for DB2, not for mysql

patch-msg_resource.sql was added in 1.17

Contents:

  • Table for storing JSON message blobs for the resource loader

CREATE TABLE /*_*/msg_resource (

  • Resource name mr_resource varbinary(255) NOT NULL,
  • Language code mr_lang varbinary(32) NOT NULL,
  • JSON blob. This is an incomplete JSON object, i.e. without the wrapping {} mr_blob mediumblob NOT NULL,
  • Timestamp of last update mr_timestamp binary(14) NOT NULL

) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/mr_resource_lang ON /*_*/msg_resource(mr_resource, mr_lang);

  • Table for administering which message is contained in which resource

CREATE TABLE /*_*/msg_resource_links (

mrl_resource varbinary(255) NOT NULL,
-- Message key
mrl_message varbinary(255) NOT NULL

) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/mrl_message_resource ON /*_*/msg_resource_links (mrl_message, mrl_resource);

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/core.git;a=blob;f=includes/installer/MysqlUpdater.php;h=9e7869ecb51c906deaedf3359a940495f2ace18a;hb=d0c0aabb3c5d40688d2435c0963927da479a47e0

Line 171

array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),

Did you run the updater?

puiterwijk wrote:

Yes, we did run the updater.
msg_resource was created, but apparently the whole problem is that the constraint over this table is NOT added.

This makes it trip because the REPLACE INTO msg_resource will just add a new row instead of replacing the old one.
We have ran into this issue at two different installations, both where missing this constraint.

We found this out because today it restarted tripping again, because the cache had expired.

puiterwijk wrote:

When looking again, the constraint should have been added by the sql script.
I think there have been some issues with the upgrade process.

(In reply to comment #5)

Yes, we did run the updater.
msg_resource was created, but apparently the whole problem is that the
constraint over this table is NOT added.

This makes it trip because the REPLACE INTO msg_resource will just add a new
row instead of replacing the old one.
We have ran into this issue at two different installations, both where missing
this constraint.

We found this out because today it restarted tripping again, because the cache
had expired.

Which constraint?

puiterwijk wrote:

msg_resource_language, the one constraint on msg_resource.