Page MenuHomePhabricator

WikiPageEntityMetaDataLookup querying DB master on HTTP GET
Closed, DuplicatePublic

Description

This affects page parses and some special pages. Requiring the master DB just for parsing is bad for HA and blocks active/active multi-DC use.

[GET] Expectation (masterConns <= 0) by MediaWiki::main not met:
[connect to 10.64.32.28 (wikidatawiki)]
TransactionProfiler.php line 307 calls wfBacktrace()
TransactionProfiler.php line 146 calls TransactionProfiler->reportExpectationViolated()
LoadBalancer.php line 545 calls TransactionProfiler->recordConnection()
DBAccessBase.php line 61 calls LoadBalancer->getConnection()
WikiPageEntityMetaDataLookup.php line 161 calls DBAccessBase->getConnection()
WikiPageEntityMetaDataLookup.php line 70 calls Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup->selectRevisionInformationMultiple()
PrefetchingWikiPageEntityMetaDataAccessor.php line 148 calls Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup->loadRevisionInformation()
WikiPageEntityRevisionLookup.php line 78 calls Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor->loadRevisionInformation()
SpecialWikibaseRepoPage.php line 163 calls Wikibase\Lib\Store\WikiPageEntityRevisionLookup->getEntityRevision()
SpecialModifyEntity.php line 127 calls Wikibase\Repo\Specials\SpecialWikibaseRepoPage->loadEntity()
SpecialSetSiteLink.php line 103 calls Wikibase\Repo\Specials\SpecialModifyEntity->prepareArguments()
SpecialModifyEntity.php line 76 calls Wikibase\Repo\Specials\SpecialSetSiteLink->prepareArguments()
SpecialPage.php line 384 calls Wikibase\Repo\Specials\SpecialModifyEntity->execute()
SpecialPageFactory.php line 553 calls SpecialPage->run()
MediaWiki.php line 249 calls SpecialPageFactory::executePath()
MediaWiki.php line 683 calls MediaWiki->performRequest()
MediaWiki.php line 474 calls MediaWiki->main()
index.php line 41 calls MediaWiki->run()
index.php line 3 calls include()
Expectation (masterConns <= 0) by MediaWiki::main not met:
[connect to 10.64.16.144 (wikidatawiki)]
TransactionProfiler.php line 311 calls wfBacktrace()
TransactionProfiler.php line 146 calls TransactionProfiler->reportExpectationViolated()
LoadBalancer.php line 576 calls TransactionProfiler->recordConnection()
DBAccessBase.php line 61 calls LoadBalancer->getConnection()
WikiPageEntityMetaDataLookup.php line 160 calls DBAccessBase->getConnection()
WikiPageEntityMetaDataLookup.php line 69 calls Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup->selectRevisionInformationMultiple()
PrefetchingWikiPageEntityMetaDataAccessor.php line 193 calls Wikibase\Lib\Store\Sql\WikiPageEntityMetaDataLookup->loadRevisionInformation()
PrefetchingWikiPageEntityMetaDataAccessor.php line 162 calls Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor->doFetch()
WikiPageEntityRevisionLookup.php line 81 calls Wikibase\Lib\Store\Sql\PrefetchingWikiPageEntityMetaDataAccessor->loadRevisionInformation()
CachingEntityRevisionLookup.php line 149 calls Wikibase\Lib\Store\WikiPageEntityRevisionLookup->getEntityRevision()
CachingEntityRevisionLookup.php line 132 calls Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision()
CachingEntityRevisionLookup.php line 149 calls Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision()
CachingEntityRevisionLookup.php line 132 calls Wikibase\Lib\Store\CachingEntityRevisionLookup->fetchEntityRevision()
RevisionBasedEntityLookup.php line 44 calls Wikibase\Lib\Store\CachingEntityRevisionLookup->getEntityRevision()
RedirectResolvingEntityLookup.php line 51 calls Wikibase\Lib\Store\RevisionBasedEntityLookup->getEntity()
EntityRetrievingTermLookup.php line 131 calls Wikibase\DataModel\Services\Lookup\RedirectResolvingEntityLookup->getEntity()
EntityRetrievingTermLookup.php line 116 calls Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup->fetchFingerprint()
EntityRetrievingTermLookup.php line 64 calls Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup->getFingerprint()
UsageTrackingTermLookup.php line 64 calls Wikibase\DataModel\Services\Lookup\EntityRetrievingTermLookup->getLabels()
LanguageFallbackLabelDescriptionLookup.php line 55 calls Wikibase\Client\Usage\UsageTrackingTermLookup->getLabels()
WikibaseLuaBindings.php line 138 calls Wikibase\Lib\Store\LanguageFallbackLabelDescriptionLookup->getLabel()
Scribunto_LuaWikibaseLibrary.php line 364 calls Wikibase\Client\DataAccess\Scribunto\WikibaseLuaBindings->getLabel()
Engine.php line 407 calls Wikibase\Client\DataAccess\Scribunto\Scribunto_LuaWikibaseLibrary->getLabel()
- line - calls Scribunto_LuaSandboxCallback->__call()
Engine.php line 319 calls LuaSandboxFunction->call()
LuaCommon.php line 243 calls Scribunto_LuaSandboxInterpreter->callFunction()
LuaCommon.php line 887 calls Scribunto_LuaEngine->executeModule()
Hooks.php line 121 calls Scribunto_LuaModule->invoke()
Parser.php line 3347 calls ScribuntoHooks::invokeHook()
Parser.php line 3082 calls Parser->callParserFunction()
Preprocessor_Hash.php line 1075 calls Parser->braceSubstitution()
Parser.php line 3224 calls PPFrame_Hash->expand()
Preprocessor_Hash.php line 1075 calls Parser->braceSubstitution()
Parser.php line 2896 calls PPFrame_Hash->expand()
Parser.php line 1259 calls Parser->replaceVariables()
Parser.php line 439 calls Parser->internalParse()
WikitextContent.php line 331 calls Parser->parse()
AbstractContent.php line 497 calls WikitextContent->fillParserOutput()
PoolWorkArticleView.php line 140 calls AbstractContent->getParserOutput()
PoolCounterWork.php line 123 calls PoolWorkArticleView->doWork()
Article.php line 666 calls PoolCounterWork->execute()
ViewAction.php line 44 calls Article->view()
MediaWiki.php line 504 calls ViewAction->show()
MediaWiki.php line 288 calls MediaWiki->performAction()
MediaWiki.php line 746 calls MediaWiki->performRequest()
MediaWiki.php line 520 calls MediaWiki->main()
index.php line 43 calls MediaWiki->run()
index.php line 3 calls include()

Entries in kibana are found via <<+channel:DBPerformance +message:*WikiPageEntityMetaDataLookup*>>

Event Timeline

aaron claimed this task.
aaron raised the priority of this task from to Medium.
aaron updated the task description. (Show Details)
aaron added projects: Sustainability, Wikidata.
aaron added subscribers: Glaisher, MZMcBride, Nemo_bis and 8 others.

This is probably related to T108841 and T108929 is the specific task to fix WikiPageEntityMetaDataLookup.

aaron removed aaron as the assignee of this task.Sep 24 2015, 6:03 AM
aaron set Security to None.

This is now one of the two main remaining causes of warnings in this log.

We load data for editing there, so I'm not entirely sure we want to do that from slaves… :/

aaron renamed this task from SpecialModifyEntity querying DB master on GET to WikiPageEntityMetaDataLookup querying DB master on GET.Jun 9 2016, 8:43 PM
aaron renamed this task from WikiPageEntityMetaDataLookup querying DB master on GET to WikiPageEntityMetaDataLookup querying DB master on HTTP GET.
aaron updated the task description. (Show Details)

@aaron As Hoo sais, the Special page is for editing the entity. That should not be done based on stale data. Do you have an alternative suggestion? Usually, the data from the slave would be fine, but there is no way to know if it is stale or not, until we ask the master DB. How is this handled for action=edit?

The second case (access from Lua) should only happen as a fallback, when the entity isn't found in the slave DB. This is probably rare... except when the entity actually doesn't exist, but we can't be sure until we hit the master DB.

But I guess for the second case, it would be OK to fail if the data isn't on the slave DB yet. What do you think, @hoo?

Editing needs to do conflict detection anyway, since fresh data sent to the client becomes stale while they wait anyway, which has to be solved with conflict detection.

The second case should use slaves too, just like templates/files use slaves, which works fine.