Page MenuHomePhabricator

updateSearchIndex.php fails due to "Error 1100: Table 'temp_rev_comment' was not locked with LOCK TABLES"
Closed, DuplicatePublic

Description

Setup

  • MediaWiki 1.35.1 (3ff1919) 01:03, 7 February 2021
  • PHP 7.3.19-1~deb10u1 (apache2handler)
  • MariaDB 10.3.27-MariaDB-0+deb10u1
  • ICU 63.1

Issue
When tying to rebuild the search index for recent changes php maintenance/updateSearchIndex.php fails with:

php maintenance/updateSearchIndex.php 
Updating searchindex between 20210212164345 and 20210213164345
   --- Waiting for lock ---
Wikimedia\Rdbms\DBQueryError from line 1699 of /../w/includes/libs/rdbms/database/Database.php: Error 1100: Table 'temp_rev_comment' was not locked with LOCK TABLES (localhost:6363)
Function: MediaWiki\Revision\RevisionStore::fetchRevisionRowFromConds
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  FROM `revision` 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 page_id = 13341 AND (rev_id=page_latest)  LIMIT 1

Backtrace

#0 /../w/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException('Table 'temp_rev...', 1100, 'SELECT  rev_id,...', 'MediaWiki\\Revis...')
#1 /../w/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog('Table 'temp_rev...', 1100, 'SELECT  rev_id,...', 'MediaWiki\\Revis...')
#2 /../w/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError('Table 'temp_rev...', 1100, 'SELECT  rev_id,...', 'MediaWiki\\Revis...', false)
#3 /../w/includes/libs/rdbms/database/Database.php(1907): Wikimedia\Rdbms\Database->query('SELECT  rev_id,...', 'MediaWiki\\Revis...', 32)
#4 /../w/includes/libs/rdbms/database/Database.php(2007): Wikimedia\Rdbms\Database->select(Array, Array, Array, 'MediaWiki\\Revis...', Array, Array)
#5 /../w/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->selectRow(Array, Array, Array, 'MediaWiki\\Revis...', Array, Array)
#6 /../w/includes/libs/rdbms/database/DBConnRef.php(331): Wikimedia\Rdbms\DBConnRef->__call('selectRow', Array)
#7 /../w/includes/Revision/RevisionStore.php(2373): Wikimedia\Rdbms\DBConnRef->selectRow(Array, Array, Array, 'MediaWiki\\Revis...', Array, Array)
#8 /../w/includes/Revision/RevisionStore.php(2315): MediaWiki\Revision\RevisionStore->fetchRevisionRowFromConds(Object(Wikimedia\Rdbms\DBConnRef), Array, 1, Array)
#9 /../w/includes/Revision/RevisionStore.php(1146): MediaWiki\Revision\RevisionStore->loadRevisionFromConds(Object(Wikimedia\Rdbms\DBConnRef), Array, 1)
#10 /../w/maintenance/includes/Maintenance.php(1518): MediaWiki\Revision\RevisionStore->getRevisionByPageId(13341, 0, 1)
#11 /../w/maintenance/updateSearchIndex.php(121): Maintenance->updateSearchIndexForPage(13341)
#12 /../w/maintenance/includes/Maintenance.php(1498): UpdateSearchIndex->searchIndexUpdateCallback(Object(stdClass))
#13 /../w/maintenance/updateSearchIndex.php(115): Maintenance->updateSearchIndex(20, Array, Object(Wikimedia\Rdbms\MaintainableDBConnRef), Object(Wikimedia\Rdbms\ResultWrapper))
#14 /../w/maintenance/updateSearchIndex.php(81): UpdateSearchIndex->doUpdateSearchIndex('20210212164345', '20210213164345', 20)
#15 /../w/maintenance/doMaintenance.php(107): UpdateSearchIndex->execute()
#16 /../w/maintenance/updateSearchIndex.php(126): require_once('/var/www/html/w...')
#17 {main}

Related to T274706? Same wiki.

Event Timeline

Reedy renamed this task from "updateSearchIndex.php " fails due to "Error 1100: Table 'temp_rev_comment' was not locked with LOCK TABLES" to updateSearchIndex.php fails due to "Error 1100: Table 'temp_rev_comment' was not locked with LOCK TABLES".Feb 15 2021, 12:04 AM
Reedy added a project: MediaWiki-Search.
MPhamWMF moved this task from needs triage to making others happy on the Discovery-Search board.