Page MenuHomePhabricator

gomwiktionary: Error: 1176 Key 'usertext_timestamp' doesn't exist in table 'revision' (10.64.16.7)
Closed, DuplicatePublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.34

message
A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: SELECT  rev_id,rev_page,rev_timestamp,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,comment_rev_comment.comment_text AS `rev_comment_text`,comment_rev_comment.comment_data AS `rev_comment_data`,comment_rev_comment.comment_id AS `rev_comment_cid`,actor_rev_user.actor_user AS `rev_user`,actor_rev_user.actor_name AS `rev_user_text`,temp_rev_user.revactor_actor AS `rev_actor`,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name,page_is_new,(SELECT  GROUP_CONCAT(ctd_name SEPARATOR ',')  FROM `change_tag` JOIN `change_tag_def` ON ((ct_tag_id=ctd_id))   WHERE ct_rev_id=rev_id  ) AS `ts_tags`  FROM `revision` FORCE INDEX (usertext_timestamp) JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) JOIN `revision_actor_temp` `temp_rev_user` ON ((temp_rev_user.revactor_rev = rev_id)) JOIN `actor` `actor_rev_user` ON ((actor_rev_user.actor_id = temp_rev_user.revactor_actor)) JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((actor_rev_user.actor_user != 0) AND (user_id = actor_rev_user.actor_user))   WHERE (1=0)  ORDER BY rev_timestamp DESC,rev_id DESC LIMIT 51  
Function: IndexPager::buildQueryInfo (contributions page unfiltered)
Error: 1176 Key 'usertext_timestamp' doesn't exist in table 'revision' (10.64.16.7)

Impact

Notes

Details

Request ID
c85d2fba-ebdb-42bb-bb36-7286d4a2fdfc
Request URL
https://gom.wiktionary.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%87%E0%A4%B6:Contributions/The_Discover
Stack Trace
exception.trace
#0 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/Database.php(1663): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/Database.php(1640): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/Database.php(1215): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/Database.php(1879): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/php-1.35.0-wmf.34/includes/libs/rdbms/database/DBConnRef.php(313): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.35.0-wmf.34/includes/specials/pagers/ContribsPager.php(213): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.35.0-wmf.34/includes/pager/IndexPager.php(268): ContribsPager->reallyDoQuery(string, integer, boolean)
#8 /srv/mediawiki/php-1.35.0-wmf.34/includes/pager/IndexPager.php(697): IndexPager->doQuery()
#9 /srv/mediawiki/php-1.35.0-wmf.34/includes/specials/SpecialContributions.php(240): IndexPager->getNumRows()
#10 /srv/mediawiki/php-1.35.0-wmf.34/includes/specialpage/SpecialPage.php(582): SpecialContributions->execute(string)
#11 /srv/mediawiki/php-1.35.0-wmf.34/includes/specialpage/SpecialPageFactory.php(623): SpecialPage->run(string)
#12 /srv/mediawiki/php-1.35.0-wmf.34/includes/MediaWiki.php(299): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#13 /srv/mediawiki/php-1.35.0-wmf.34/includes/MediaWiki.php(978): MediaWiki->performRequest()
#14 /srv/mediawiki/php-1.35.0-wmf.34/includes/MediaWiki.php(535): MediaWiki->main()
#15 /srv/mediawiki/php-1.35.0-wmf.34/index.php(47): MediaWiki->run()
#16 /srv/mediawiki/w/index.php(3): require(string)
#17 {main}

Related Objects

Event Timeline

Urbanecm renamed this task from A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? Query: SELECT rev_id,rev_page,rev_timestamp,rev_minor_edit,rev_deleted,rev_len,rev_parent_id,rev_sha1,comment_rev_comment.comment_text AS `rev_comment_text`,comment_rev_comment.comment_data AS `rev_comment_data`,comment_rev_comment.comment_id AS `rev_comment_cid`,actor_rev_user.actor_user AS `rev_user`,actor_rev_user.actor_name AS `rev_user_text`,temp_rev_user.revactor_actor AS `rev_actor`,page_namespace,page_title,page_id,page_latest,page_is_redirect,page_len,user_name,page_is_new,(SELECT GROUP_CONCAT(ctd_name SEPARATOR ',') FROM `change_tag` JOIN `change_tag_def` ON ((ct_tag_id=ctd_id)) WHERE ct_rev_id=rev_id ) AS `ts_tags` FROM `revision` FORCE INDEX (usertext_timestamp) JOIN `revision_comment_temp` `temp_rev_comment` ON ((temp_rev_comment.revcomment_rev = rev_id)) JOIN `comment` `comment_rev_comment` ON ((comment_rev_comment.comment_id = temp_rev_comment.revcomment_comment_id)) JOIN `revision_actor_temp` `temp_rev_user` ON ((temp_rev_user.revactor_rev = rev_id)) JOIN `actor` `actor_rev_user` ON ((actor_rev_user.actor_id = temp_rev_user.revactor_actor)) JOIN `page` ON ((page_id = rev_page)) LEFT JOIN `user` ON ((actor_rev_user.actor_user != 0) AND (user_id = actor_rev_user.actor_user)) WHERE (1=0) ORDER BY rev_timestamp DESC,rev_id DESC LIMIT 51 Function: IndexPager::buildQueryInfo (contributions page unfiltered)Error: 1176 Key 'usertext_timestamp' doesn't exist in table 'revision' (10.64.16.7) to gomwiktionary: Error: 1176 Key 'usertext_timestamp' doesn't exist in table 'revision' (10.64.16.7).May 31 2020, 10:34 AM

The wiki is fairly new, created on 2020-05-20 (cf T249506). When comparing gomwiktionary's and gomwiki's revision table and related indexes (both s3), I see that gomwiktionary has rev_actor, while gomwiki has rev_user{_text}.

wikiadmin@10.64.0.205(gomwiktionary)> explain revision;
+----------------+---------------------+------+-----+----------------+----------------+
| Field          | Type                | Null | Key | Default        | Extra          |
+----------------+---------------------+------+-----+----------------+----------------+
| rev_id         | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page       | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_comment_id | bigint(20) unsigned | NO   |     | 0              |                |
| rev_actor      | bigint(20) unsigned | NO   | MUL | 0              |                |
| rev_timestamp  | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted    | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len        | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id  | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1       | varbinary(32)       | NO   |     |                |                |
+----------------+---------------------+------+-----+----------------+----------------+
10 rows in set (0.00 sec)

wikiadmin@10.64.32.136(gomwiki)> explain revision;
+--------------------+---------------------+------+-----+----------------+----------------+
| Field              | Type                | Null | Key | Default        | Extra          |
+--------------------+---------------------+------+-----+----------------+----------------+
| rev_id             | int(10) unsigned    | NO   | PRI | NULL           | auto_increment |
| rev_page           | int(10) unsigned    | NO   | MUL | NULL           |                |
| rev_text_id        | int(10) unsigned    | NO   |     | 0              |                |
| rev_comment        | varbinary(767)      | NO   |     |                |                |
| rev_user           | int(10) unsigned    | NO   | MUL | 0              |                |
| rev_user_text      | varbinary(255)      | NO   | MUL |                |                |
| rev_timestamp      | binary(14)          | NO   | MUL |                |                |
| rev_minor_edit     | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_deleted        | tinyint(3) unsigned | NO   |     | 0              |                |
| rev_len            | int(10) unsigned    | YES  |     | NULL           |                |
| rev_parent_id      | int(10) unsigned    | YES  |     | NULL           |                |
| rev_sha1           | varbinary(32)       | NO   |     |                |                |
| rev_content_model  | varbinary(32)       | YES  |     | NULL           |                |
| rev_content_format | varbinary(64)       | YES  |     | NULL           |                |
+--------------------+---------------------+------+-----+----------------+----------------+
14 rows in set (0.00 sec)

I also see that gomwiktionary's revision entries are pretty broken:

wikiadmin@10.64.0.205(gomwiktionary)> select rev_id, rev_page, rev_comment_id, rev_actor, rev_timestamp from revision order by rev_id desc limit 10;
+--------+----------+----------------+-----------+----------------+
| rev_id | rev_page | rev_comment_id | rev_actor | rev_timestamp  |
+--------+----------+----------------+-----------+----------------+
|  15472 |     3430 |              0 |         0 | 20200531015847 |
|  15471 |     3429 |              0 |         0 | 20200531015653 |
|  15470 |     3428 |              0 |         0 | 20200531015418 |
|  15469 |     3427 |              0 |         0 | 20200531014309 |
|  15468 |     3426 |              0 |         0 | 20200531014100 |
|  15467 |     3418 |              0 |         0 | 20200528123804 |
|  15466 |     3419 |              0 |         0 | 20200528123748 |
|  15465 |     3420 |              0 |         0 | 20200528123729 |
|  15464 |     3421 |              0 |         0 | 20200528123716 |
|  15463 |     3424 |              0 |         0 | 20200528123706 |
+--------+----------+----------------+-----------+----------------+
10 rows in set (0.00 sec)

The zeros in rev_actor rev_comment_id certainly shouldn't be there.

It seems addWiki.php somehow uses the "new" database structure, with rev_actor and rev_comment_id, while MediaWiki uses the old schema (and tries to write using the old schema).

Not sure about the best solution. It seems MediaWiki sorta knows what revisions were made by which user, given the recentchanges and some special:Contribs works, https://gom.wiktionary.org/wiki/%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%87%E0%A4%B6:Contributions/The_Discoverer, so we might have no data loss, but I'm not sure on that either.