Last modified: 2012-04-19 21:22:18 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32120, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30120 - Interwiki links error after upgrade
Interwiki links error after upgrade
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
1.17.x
All All
: Normal normal (vote)
: 1.18.0 release
Assigned To: Nobody - You can work on this!
:
: 31898 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-29 22:51 UTC by Hazard-SJ
Modified: 2012-04-19 21:22 UTC (History)
11 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Hazard-SJ 2011-07-29 22:51:17 UTC
On more than one wikis, upgrades to MediaWiki 1.17.0, after running the update script, a database error relating to the table "iwlinks" leaves the following error on pages:

Database error
A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

    (SQL query hidden)

from within function "LinksUpdate::getExistingInterwikis". Database returned error "1146: Table '<prefix>.iwlinks' doesn't exist.
Comment 1 Mark A. Hershberger 2011-08-01 13:55:55 UTC
It sounds like you need to run the update.php script.  If you still have a problem after running that script, please reopen this bug and provide the version you're upgrading from.
Comment 2 Hazard-SJ 2011-08-01 20:47:22 UTC
Please reread the first line: "after running the upgrade script". Thank you.
Comment 3 Dan Collins 2011-08-01 21:08:53 UTC
"and provide the version you're upgrading from."

Thank /you/.
Comment 4 Mark A. Hershberger 2011-08-02 14:19:05 UTC
closing until we find out the version being upgraded.
Comment 5 cyboreal 2011-08-02 16:48:51 UTC
same problem here, upgrading from 1.16b3 to 1.17.0. After upgrading and running the update.php script for each subdomain (wiki farm), I get the same error:

Database returned error "1146: Table 'wikidb.en_iwlinks' doesn't exist (localhost)".
Comment 6 Hazard-SJ 2011-08-02 22:06:02 UTC
I actually reported this from the MW support desk where two users had the problem.
Comment 7 cyboreal 2011-08-03 15:13:02 UTC
Is there some way to check that the update.php script actually ran? Where is the schema for the iwlinks table and would it work to just manually create the table?
Comment 8 Jesper Kristensen 2011-08-14 19:54:36 UTC
I think I have the same problem. I upgraded from 1.16.5 to 1.17. At the last step in the web upgrade process, I got an error page from my browser:

/!\ Content Encoding Error
----
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.
----
* Please contact the website owners to inform them of this problem.
[Try Again]

My wiki displays fine, but whenever I edit a page I get the error message about iwlinks does not exist.

I have tried to restore my backup and repeat the process, and the same thing happens.

If a wiki developer is interested in taking a look, I can provide a dump of parts of my database prior to the upgrade.
Comment 9 Bawolff (Brian Wolff) 2011-08-16 05:00:32 UTC
Please everyone also include which db type you are using (mysql, postgress, etc)


When running the updater did the message:

Creating iwlinks table...
ok


appear?


re: comment 7 - the patch file is in maintenance/archive/patch-iwlinks.sql (for mysql, other db's are elsewhere in maintenance directory. Applying manually is fine, just be careful if you use table prefixes)


for comment 8: Don't know whats happening there, but check your apache and php error logs after the installer fails to upgrade. In your situation I would recommend trying the cli installer if possible.
Comment 10 Joss Winn 2011-08-18 13:08:38 UTC
I have just upgraded to 1.17.0 and am experiencing this, too. I am using MySQL 5.5.15

Running php update.php as root fails to complete with the following message:

Creating iwlinks table...A database query syntax error has occurred.
The last attempted database query was:
"CREATE TABLE `iwlinks` (
 iwl_from int unsigned NOT NULL default 0,
 iwl_prefix varbinary(20) NOT NULL default '',
 iwl_title varchar(255) binary NOT NULL default ''
 ) TYPE=InnoDB
"
from within function "DatabaseBase::sourceFile( /var/www/html/w/maintenance/archives/patch-iwlinks.sql )".
Database returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 5 (localhost)"

When I run the web update from /mw-config/ it seems to run fine, producing the following output from the same point:

Creating iwlinks table...ok
Adding iwl_prefix_title_from key to table iwlinks... ok
...have ul_value field in updatelog table.
...have iw_api field in interwiki table.
...iwl_prefix key doesn't exist.
...iwl_prefix_from_title key doesn't exist.
...have cl_collation field in categorylinks table.
...categorylinks up-to-date.
...collations up-to-date.
Creating msg_resource table...ok
Creating module_deps table...ok
...ar_page_revid key doesn't exist.
...ar_revid key already set on archive table.
...ll_lang is up-to-date.
Purging caches...done.
Checking site_stats row...done.

However, when I next try to delete a page, for example, mediawiki produces this error in the browser, suggesting that the update script didn't work properly.

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

    (SQL query hidden)

from within function "DatabaseBase::delete". Database returned error "1146: Table 'wikidb.iwlinks' doesn't exist (localhost)".

I then executed the patch SQL directly (maintenance/archive/patch-iwlinks.sql) and it created the new table and allowed me to delete the page. 

I then ran the update.php script again and it produced the following:

Creating msg_resource table...A database query syntax error has occurred.
The last attempted database query was:
"CREATE TABLE `msg_resource` (
 mr_resource varbinary(255) NOT NULL,
 mr_lang varbinary(32) NOT NULL,
 mr_blob mediumblob NOT NULL,
 mr_timestamp binary(14) NOT NULL
 ) TYPE=InnoDB
"
from within function "DatabaseBase::sourceFile( /var/www/html/w/maintenance/archives/patch-msg_resource.sql )".
Database returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 6 (localhost)"

So, I executed the patch-msg_resource.sql script directly and it created two new tables. 

I ran update.php again and the same error happened for:

Creating module_deps table...A database query syntax error has occurred.
The last attempted database query was:
"CREATE TABLE `module_deps` (
 md_module varbinary(255) NOT NULL,
 md_skin varbinary(32) NOT NULL,
 md_deps mediumblob NOT NULL
 ) TYPE=InnoDB
"
from within function "DatabaseBase::sourceFile( /var/www/html/w/maintenance/archives/patch-module_deps.sql )".
Database returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TYPE=InnoDB' at line 5 (localhost)"

So I ran patch-module_deps.sql and it created a new table.

Finally, I ran update.php again and everything went fine :-)
Comment 11 Bawolff (Brian Wolff) 2011-08-20 21:54:23 UTC
Adding Chad to cc list since this is possibly new-installer related.
Comment 12 Max Semenik 2011-08-20 22:21:53 UTC
Guys, could you elaborate how you updated: using old LocalSettings or generating a new one?
Comment 13 Joss Winn 2011-08-21 06:13:06 UTC
I used my existing LocalSettings file.
Comment 14 Max Semenik 2011-09-03 17:16:05 UTC
More reports, bumping severity.
Comment 15 Chad H. 2011-09-03 18:36:19 UTC
I've been unable to replicate this thus far.
Comment 16 Andy Nguyen 2011-09-08 03:30:04 UTC
(In reply to comment #10)
> I have just upgraded to 1.17.0 and am experiencing this, too. I am using MySQL
> 5.5.15
>[...]
> I then executed the patch SQL directly (maintenance/archive/patch-iwlinks.sql)
>[...]
> So, I executed the patch-msg_resource.sql script directly
>[...]
> So I ran patch-module_deps.sql and it created a new table.



If you use a prefix for your DB table names, before executing those three .sql files, you will need to edit them and make the following changes:

1.  Change all "/*_*/" to your DB table name prefix.  In my case, my table names are mkvgtiwiki_XXX, so I changed the "/*_*/" to "mkvgtiwiki_".
2. Change all "/*i*/" to "<table name>_".  For example, in patch-iwlinks.sql, change "/*i*/" to "iwlinks_".


Here are the diffs of one of those scripts of mine:

diff -w patch-msg_resource.sql.orig patch-msg_resource.sql
2c2
< CREATE TABLE /*_*/msg_resource (
---
> CREATE TABLE mkvgtiwiki_msg_resource (
12c12
< CREATE UNIQUE INDEX /*i*/mr_resource_lang ON /*_*/msg_resource(mr_resource, mr_lang);
---
> CREATE UNIQUE INDEX msg_resource_mr_resource_lang ON mkvgtiwiki_msg_resource(mr_resource, mr_lang);
15c15
< CREATE TABLE /*_*/msg_resource_links (
---
> CREATE TABLE mkvgtiwiki_msg_resource_links (
20c20
< CREATE UNIQUE INDEX /*i*/mrl_message_resource ON /*_*/msg_resource_links (mrl_message, mrl_resource);
---
> CREATE UNIQUE INDEX msg_resource_mrl_message_resource ON mkvgtiwiki_msg_resource_links (mrl_message, mrl_resource);



Finally, edit maintenance/archives/patch-categorylinks-better-collation.sql and change "/*$wgDBprefix*/" to your DB table name prefix:

diff -w patch-categorylinks-better-collation.sql.orig patch-categorylinks-better-collation.sql
11c11
< ALTER TABLE /*$wgDBprefix*/categorylinks
---
> ALTER TABLE mkvgtiwiki_categorylinks
19c19
< INSERT IGNORE INTO /*$wgDBprefix*/updatelog (ul_key) VALUES ('cl_fields_update');
---
> INSERT IGNORE INTO mkvgtiwiki_updatelog (ul_key) VALUES ('cl_fields_update');
Comment 17 Andy Nguyen 2011-09-08 03:32:03 UTC
(In reply to comment #16)
You need to run the last script (maintenance/archives/patch-categorylinks-better-collation.sql) else uploads will fail.
Comment 18 Emufarmers 2011-09-08 20:31:13 UTC
TYPE no longer works in MySQL 5.5.  Many people's LocalSettings.php files will still have $wgDBTableOptions set to "TYPE=InnoDB", which would produce the 1064 error Joss had (I'm not positive about everybody else's problems).  The updater should probably check for this.

See http://www.mediawiki.org/wiki/Thread:Project:Support_desk/MySQL_5.5_and_MW_17_-_ENGINE_vs_TYPE
Comment 19 Mark A. Hershberger 2011-09-09 22:52:26 UTC
Adding 1.18 blocker per comment 18
Comment 20 Max Semenik 2011-10-24 04:10:23 UTC
*** Bug 31898 has been marked as a duplicate of this bug. ***
Comment 21 Mark A. Hershberger 2011-10-28 01:49:09 UTC
(In reply to comment #18)
> TYPE no longer works in MySQL 5.5.  Many people's LocalSettings.php files will
> still have $wgDBTableOptions set to "TYPE=InnoDB", which would produce the 1064
> error Joss had (I'm not positive about everybody else's problems).  The updater
> should probably check for this.

Tarball release notes should probably mention this if we don't fix the updater.
Comment 22 Hazard-SJ 2011-10-29 23:03:45 UTC
I agree.
Comment 23 Sam Reed (reedy) 2011-11-01 05:41:42 UTC
The hacky fix, I suppose, is to s/TYPE/ENGINE/ on $wgDBTableOptions before usage

Certainly having the updaters report this.. On the CLI one this would be less obvious, unless postponed to the bottom of the list, so people see it

Using the Installer is more obvious...
Comment 24 Sam Reed (reedy) 2011-11-01 06:21:00 UTC
(In reply to comment #23)
> The hacky fix, I suppose, is to s/TYPE/ENGINE/ on $wgDBTableOptions before
> usage
> 
> Certainly having the updaters report this.. On the CLI one this would be less
> obvious, unless postponed to the bottom of the list, so people see it
> 
> Using the Installer is more obvious...

r101451 does this for the moment, pending a better fix.

Should be removed later when we push min version of mysql to >= 5.1

Certainly needs something putting into the updaters somehow...
Comment 25 Mark A. Hershberger 2011-11-02 21:43:06 UTC
Gonna close this since Reedy's fix fixes it and isn't meant to live beyond mysql 5.1 as minimum.  Hopfully it gets back-ported or another fix created.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links