Page MenuHomePhabricator

Duplicate database query from DatabaseMessageIndex::get() done lots of times in one request
Closed, ResolvedPublic

Description

DatabaseMessageIndex::get() does the exact same query tens of times in one request. For example, after deleting a translation unit, it just did the same query 44 times. This seems to happen for several actions (not just deleting). Will do some more debugging later and report the details here.

Event Timeline

Glaisher created this task.May 25 2016, 4:50 PM
Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptMay 25 2016, 4:50 PM

Some of the callers:

Title->getPageLanguage/ContentHandler->getPageLanguage/Hooks::run/call_user_func_array/PageTranslationHooks::onPageContentLanguage/TranslatablePage::isTranslationPage/MessageHandle->getKey/MessageHandle->figureMessage/MessageIndex::getGroupIds/DatabaseMessageIndex->get

ContentHandler->getPageViewLanguage/ContentHandler->getPageLanguage/Hooks::run/call_user_func_array/TranslateHooks::onPageContentLanguage/MessageHandle->getEffectiveLanguage/MessageHandle->getCode/MessageHandle->figureMessage/MessageIndex::getGroupIds/DatabaseMessageIndex->get

Parser->transformMsg/Parser->preprocess/Hooks::run/call_user_func_array/PageTranslationHooks::renderTagPage/TranslatablePage::isTranslationPage/MessageHandle->getKey/MessageHandle->figureMessage/MessageIndex::getGroupIds/DatabaseMessageIndex->get

Hooks::run/call_user_func_array/TranslateToolbox::toolboxAllTranslations/MessageHandle->isValid/MessageHandle->getGroupIds/MessageIndex::getGroupIds/MessageHandle->getKey/MessageHandle->figureMessage/MessageIndex::getGroupIds/DatabaseMessageIndex->get

VectorTemplate->execute/VectorTemplate->renderPortals/VectorTemplate->renderPortal/Hooks::run/call_user_func_array/TranslateToolbox::toolboxAllTranslations/MessageHandle->isValid/MessageHandle->getGroupIds/MessageIndex::getGroupIds/DatabaseMessageIndex->get

MessageCache->parse/Parser->parse/Hooks::run/call_user_func_array/PageTranslationHooks::renderTagPage/TranslatablePage::isTranslationPage/MessageHandle->getKey/MessageHandle->figureMessage/MessageIndex::getGroupIds/DatabaseMessageIndex->get

Looks like the vast majority of these are from PageTranslationHooks::renderTagPage() (called from Parser::transformMsg()). This should probably have some sort of caching or something like that.

Change 291271 had a related patch set uploaded (by Glaisher):
Cache MessageIndex key values

https://gerrit.wikimedia.org/r/291271

Nikerabbit triaged this task as Normal priority.May 30 2016, 12:40 PM

Change 291271 merged by jenkins-bot:
Cache MessageIndex key values

https://gerrit.wikimedia.org/r/291271

Nikerabbit closed this task as Resolved.May 30 2016, 2:13 PM
Nikerabbit assigned this task to Glaisher.
Nikerabbit edited projects, added Language-Q4-2016-Sprint 3; removed Patch-For-Review.
Nikerabbit moved this task from Backlog to Done on the Language-Q4-2016-Sprint 3 board.