Page MenuHomePhabricator

NameTableAccessException.php: Failed to access name from content_models using id = 2
Open, Needs TriagePublic

Description

Setup and configuration

  • MediaWiki 1.33.2 (4d49bc3) 14:30, 19 December 2019
  • PHP | 7.2.24-0ubuntu0.18.04.1 (apache2handler)
  • MariaDB | 10.1.43-MariaDB-0ubuntu0.18.04.1
  • VisualEditor | 0.1.1 (6f1fd3d) 23:13, 30 November 2019
  • Semantic MediaWiki | 3.1.1 (143488d) 10:11, 17 November 2019
  • Abuse Filter – (e054f2e) 18:49, 4 December 2019

Issue

When running "update.php" or "setupStore.php" I get a failure if not using the --skip-import flag. I am not sure why this happens.

Importing from smw.groups.json ...
   ... replacing smw/schema:Group:Schema properties
       importer was last editor ...
[f4fc8747b73543c93b00e612] [no req]   MediaWiki\Storage\NameTableAccessException from line 42 of /../w/includes/Storage/NameTableAccessException.php: Failed to access name from content_models using id = 2

User 2 is Abuse Filter created by the respective extension.

Originally reported for Semantic MediaWiki.

Backtrace

#0 /../w/includes/Storage/NameTableStore.php(308): MediaWiki\Storage\NameTableAccessException::newFromDetails(string, string, integer)
#1 /../w/includes/Revision/RevisionStore.php(1633): MediaWiki\Storage\NameTableStore->getName(integer)
#2 /../w/includes/Revision/RevisionStore.php(1680): MediaWiki\Revision\RevisionStore->loadSlotRecords(string, integer)
#3 [internal function]: MediaWiki\Revision\RevisionStore->MediaWiki\Revision\{closure}()
#4 /../w/includes/Revision/RevisionSlots.php(165): call_user_func(Closure)
#5 /../w/includes/Revision/RevisionSlots.php(136): MediaWiki\Revision\RevisionSlots->getSlots()
#6 /../w/includes/Revision/RevisionRecord.php(219): MediaWiki\Revision\RevisionSlots->getSlotRoles()
#7 /../w/includes/Revision/MutableRevisionRecord.php(57): MediaWiki\Revision\RevisionRecord->getSlotRoles()
#8 /../w/includes/Storage/DerivedPageDataUpdater.php(773): MediaWiki\Revision\MutableRevisionRecord::newFromParentRevision(MediaWiki\Revision\RevisionStoreCacheRecord)
#9 /../w/includes/Storage/PageUpdater.php(694): MediaWiki\Storage\DerivedPageDataUpdater->prepareContent(User, MediaWiki\Storage\RevisionSlotsUpdate, boolean)
#10 /../w/includes/page/WikiPage.php(1915): MediaWiki\Storage\PageUpdater->saveRevision(CommentStoreComment, integer)
#11 /../w/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(124): WikiPage->doEditContent(SMW\MediaWiki\Content\SchemaContent, CommentStoreComment, integer)
#12 /../w/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(110): SMW\Importer\ContentCreators\TextContentCreator->doCreateContent(WikiPage, Title, SMW\Importer\ImportContents)
#13 [internal function]: SMW\Importer\ContentCreators\TextContentCreator->SMW\Importer\ContentCreators\{closure}(integer, Wikimedia\Rdbms\DatabaseMysqli)
#14 /../w/includes/libs/rdbms/database/Database.php(3588): call_user_func(Closure, integer, Wikimedia\Rdbms\DatabaseMysqli)
#15 /../w/includes/libs/rdbms/database/Database.php(3436): Wikimedia\Rdbms\Database->runOnTransactionIdleCallbacks(integer)
#16 /../w/includes/libs/rdbms/database/DBConnRef.php(53): Wikimedia\Rdbms\Database->onTransactionCommitOrIdle(Closure)
#17 /../w/includes/libs/rdbms/database/DBConnRef.php(572): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#18 /../w/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php(764): Wikimedia\Rdbms\DBConnRef->onTransactionCommitOrIdle(Closure)
#19 /../w/extensions/SemanticMediaWiki/src/Importer/ContentCreators/TextContentCreator.php(111): SMW\MediaWiki\Connection\Database->onTransactionIdle(Closure)
#20 /../w/extensions/SemanticMediaWiki/src/Importer/ContentCreators/DispatchingContentCreator.php(75): SMW\Importer\ContentCreators\TextContentCreator->create(SMW\Importer\ImportContents)
#21 /../w/extensions/SemanticMediaWiki/src/Importer/Importer.php(133): SMW\Importer\ContentCreators\DispatchingContentCreator->create(SMW\Importer\ImportContents)
#22 /../w/extensions/SemanticMediaWiki/src/Importer/Importer.php(109): SMW\Importer\Importer->doImportContents(SMW\Importer\ImportContents)
#23 /../w/extensions/SemanticMediaWiki/src/MediaWiki/Hooks.php(1352): SMW\Importer\Importer->doImport()
#24 /../w/includes/Hooks.php(174): SMW\MediaWiki\Hooks->onAfterCreateTablesComplete(SMW\SQLStore\TableBuilder\MySQLTableBuilder, Onoi\MessageReporter\ObservableMessageReporter, SMW\Options)
#25 /../w/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
#26 /../w/extensions/SemanticMediaWiki/src/SQLStore/Installer.php(191): Hooks::run(string, array)
#27 /../w/extensions/SemanticMediaWiki/src/SQLStore/SQLStore.php(437): SMW\SQLStore\Installer->install(SMW\Options)
#28 /../w/extensions/SemanticMediaWiki/src/Elastic/ElasticStore.php(326): SMW\SQLStore\SQLStore->setup(SMW\Options)
#29 /../w/extensions/SemanticMediaWiki/src/Store.php(506): SMW\Elastic\ElasticStore->setup(SMW\Options)
#30 /../w/includes/installer/DatabaseUpdater.php(489): SMW\Store::setupStore(boolean, SMW\Options)
#31 /../w/includes/installer/DatabaseUpdater.php(457): DatabaseUpdater->runUpdates(array, boolean)
#32 /../w/maintenance/update.php(203): DatabaseUpdater->doUpdates(array)
#33 /../w/maintenance/doMaintenance.php(96): UpdateMediaWiki->execute()
#34 /../w/maintenance/update.php(275): require_once(string)
#35 {main}

Event Timeline

Kghbln created this task.Jan 6 2020, 9:47 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 6 2020, 9:47 AM
Kghbln added a comment.Jan 6 2020, 9:48 AM

Running the scripts as suggested on T224949 did not help.

Seb35 added a subscriber: Seb35.Jul 1 2020, 9:35 AM

I have no universal solution, but only a case-by-case solution. I observed this exception on a wiki, specifically on the page MediaWiki:Common.css, and in my case the content model 2 was 'css' because present only for the pages MediaWiki:Common.css and MediaWiki:Print.css, but this mapping depends on the wiki, so it must be determinated on a case-by-case basis. Then I manually introduced this mapping:

INSERT INTO /*_*/content_models VALUES (2, 'css');

Given the description of the task I guess the mapping in this case was 2 ↔ 'smw/schema'.

This mapping is normally managed by MediaWiki itself, perhaps it is improved in recent versions with things like rMW135673b98eccc43528ce0dcc0ef61ed44b932471.