Topic on Project:Support desk

Jump to navigation Jump to search

[RESOLVED] upgrade problems: 1.11 --> 1.21 (batch conversion of user_options: Unknown column 'rev_sha1')

19
Summary by Ciencia Al Poder

Bug reported at bugzilla:48820. See the full thread for a solution until a fix for 1.21 is released.

Twisted86 (talkcontribs)

I'm trying to upgrade from MW 1.11 to 1.21.0rc5, using PHP 5.3.13 and MySQL 5.0.96-log. I get the following error during the upgrade:

...batch conversion of user_options: A database query syntax error has occurred. The last attempted database query was: "SELECT rev_id,rev_page,rev_text_id,rev_timestamp,rev_comment,rev_user_text,rev_user,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name FROM `revision` INNER JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((rev_user != 0) AND (user_id = rev_user)) WHERE page_id = '9' AND rev_id = '3494' LIMIT 1 " from within function "Revision::fetchFromConds". Database returned error "1054: Unknown column 'rev_sha1' in 'field list' (foobar.barfoo.com)"

The wiki in question is at: http://wikihawk.heggen.net

I am kinda stumped, so any help would be appreciated.

AKlapper (WMF) (talkcontribs)
Ciencia Al Poder (talkcontribs)
Twisted86 (talkcontribs)

My thanks to both of your for the replies.

I get the same error when I run upgrade.php from the command line, by the way....

MarkAHershberger (talkcontribs)

Could you share your LocalSettings.php file with the passwords removed? Maybe put it on http://pastebin.com/ or the like?

Since people seem to be running into this problem, I'd like to make sure that I can reproduce it.

Twisted86 (talkcontribs)
MarkAHershberger (talkcontribs)

I just installed 1.11 and upgraded to 1.21 without a problem.

A couple of ideas:

  • Did you get new versions for every extension?
  • Try disabling all the extensions and then running the upgrade.
Twisted86 (talkcontribs)

Good ideas, Mark.

I commented out all of the extensions, but I still get the same errors with update.php and mw-config.

Would you like for me to try updating all of the extensions, re-enabling them, and then trying the upgrade again, or is that a Bad Idea?

Ciencia Al Poder (talkcontribs)

It doesn't seem to be a problem of an extension. rev_sha1 field is missing from revision table. It was added on 1.19.

It's failing in the batch conversion of user_options process. We should identify if it's running that before creating the missing field and why it's trying to access to that field.

I'll try to investigate when I go home.

Twisted86 (talkcontribs)

Thanks!

MarkAHershberger (talkcontribs)

Right. I asked him to disable the extensions because that is the sort of problem that extensions can cause.

It looks like the extensions weren't causing it, though, so carry on!

Ciencia Al Poder (talkcontribs)

I think I've identified the bug. See bugzilla:49039

The solution may be upgradin to an intermediate version, and then to latest, but I'm not shure what version would fit for "intermediate".

Ciencia Al Poder (talkcontribs)

or just add the missing rev_sha1 field manually executing ./maintenance/archives/patch-rev_sha1.sql:

ALTER TABLE /*$wgDBprefix*/revision
  ADD rev_sha1 varbinary(32) NOT NULL default ;
208.89.206.26 (talkcontribs)

Do you need to add that as a separate file?

Ciencia Al Poder (talkcontribs)

No, you need to open a mysql command prompt and execute that statement on the database for the wiki.

Example:

user@host> mysql -u root -p
  <type password>

mysql> use wikidb;
Database changed.

mysql> ALTER TABLE /*$wgDBprefix*/revision
> ADD rev_sha1 varbinary(32) NOT NULL default ;

If you're using phpMyAdmin you can also execute if from there.

Twisted86 (talkcontribs)

Thank you very much, Ciencia and Mark!

I ran the SQL code above in phpMyAdmin and that solved the problem. Yay!

145.50.39.8 (talkcontribs)

The answer is correct but not complete

it should be

 user@host> mysql -u root -p
 <type password>
 mysql> use wikidb;
 Database changed.
 mysql> ALTER TABLE /*$wgDBprefix*/revision
 ADD rev_sha1 varbinary(32) NOT NULL default ''; <-- two ''
Reply to "[RESOLVED] upgrade problems: 1.11 --> 1.21 (batch conversion of user_options: Unknown column 'rev_sha1')"