Page MenuHomePhabricator

updateSearchIndex.php fails with Error: 1100 Table 'slots' was not locked with LOCK TABLES
Open, NormalPublic

Description

After upgrading to mediawiki 1.32.0, running updateSearchIndex.php results in:

Updating searchindex between 20190116040016 and 20190117171125
   --- Waiting for lock ---
<MyPageName>...[664e1ee17e4f2336e1e73f58] [no req]   Wikimedia\Rdbms\DBQueryError from line 1496 of /opt/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: SELECT  slot_revision_id,slot_content_id,slot_origin,slot_role_id,content_size,content_sha1,content_address,content_model  FROM `slots` INNER JOIN `content` ON ((slot_content_id = content_id))   WHERE slot_revision_id = '46171'
Function: MediaWiki\Revision\RevisionStore::loadSlotRecords
Error: 1100 Table 'slots' was not locked with LOCK TABLES (MyDBServerHostname)

Fix is to add 'slots' and 'content' to Maintenance.php lockSearchindex()

Event Timeline

Sten27 created this task.Jan 17 2019, 5:25 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 17 2019, 5:25 PM
CCicalese_WMF added a subscriber: CCicalese_WMF.

Please provide a stack trace and any additional helpful information to diagnose this further.

daniel added a subscriber: daniel.Jan 22 2019, 3:20 PM

Does this mean something is trying to write to the slots table? That seems odd...

Here's the stacktrace:

#0 /opt/mediawiki/includes/libs/rdbms/database/Database.php(1466): Wikimedia\Rdbms\Database->makeQueryException(string, integer, string, string)
#1 /opt/mediawiki/includes/libs/rdbms/database/Database.php(1226): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#2 /opt/mediawiki/includes/libs/rdbms/database/Database.php(1693): Wikimedia\Rdbms\Database->query(string, string)
#3 /opt/mediawiki/includes/libs/rdbms/database/DBConnRef.php(49): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#4 /opt/mediawiki/includes/libs/rdbms/database/DBConnRef.php(261): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#5 /opt/mediawiki/includes/Revision/RevisionStore.php(1617): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#6 /opt/mediawiki/includes/Revision/RevisionStore.php(1671): MediaWiki\Revision\RevisionStore->loadSlotRecords(string, integer)
#7 [internal function]: MediaWiki\Revision\RevisionStore->MediaWiki\Revision\{closure}()
#8 /opt/mediawiki/includes/Revision/RevisionSlots.php(165): call_user_func(Closure)
#9 /opt/mediawiki/includes/Revision/RevisionSlots.php(107): MediaWiki\Revision\RevisionSlots->getSlots()
#10 /opt/mediawiki/includes/Revision/RevisionRecord.php(192): MediaWiki\Revision\RevisionSlots->getSlot(string)
#11 /opt/mediawiki/includes/Revision/RevisionRecord.php(175): MediaWiki\Revision\RevisionRecord->getSlot(string, integer, NULL)
#12 /opt/mediawiki/includes/Revision.php(932): MediaWiki\Revision\RevisionRecord->getContent(string, integer, NULL)
#13 /opt/mediawiki/maintenance/Maintenance.php(1506): Revision->getContent()
#14 /opt/mediawiki/maintenance/updateSearchIndex.php(120): Maintenance->updateSearchIndexForPage(Wikimedia\Rdbms\DatabaseMysqli, string)
#15 /opt/mediawiki/maintenance/Maintenance.php(1480): UpdateSearchIndex->searchIndexUpdateCallback(Wikimedia\Rdbms\DatabaseMysqli, stdClass)
#16 /opt/mediawiki/maintenance/updateSearchIndex.php(114): Maintenance->updateSearchIndex(integer, array, Wikimedia\Rdbms\DatabaseMysqli, Wikimedia\Rdbms\ResultWrapper)
#17 /opt/mediawiki/maintenance/updateSearchIndex.php(80): UpdateSearchIndex->doUpdateSearchIndex(string, string, integer)
#18 /opt/mediawiki/maintenance/doMaintenance.php(94): UpdateSearchIndex->execute()
#19 /opt/mediawiki/maintenance/updateSearchIndex.php(125): require_once(string)
#20 {main}

The error is triggered simply by running

php updateSearchIndex.php
EBjune triaged this task as Normal priority.Jan 24 2019, 6:08 PM
EBjune moved this task from needs triage to watching / waiting on the Discovery-Search board.