Page MenuHomePhabricator

Augment user_touched with an in-memory field
Closed, ResolvedPublic


user_touched causes DB master writes on page view sometimes. Maybe another field could also be kept in cache that could be bumped, the HTTP IMS header logic would use the highest of both. If the cached one doesn't exist, it could be re-initialized to the current time. Purges/updates would work via bus (maybe using "set if newer" logic in daemon if really needed).

2015-03-02 17:54:16 mw1188 mediawikiwiki: Expectation (writes <= 0) by MediaWiki::main not met:
query-m: UPDATE user SET user_touched = 'X')
TransactionProfiler.php line 254 calls wfBacktrace()
TransactionProfiler.php line 166 calls TransactionProfiler->reportExpectationViolated()
Database.php line 1153 calls TransactionProfiler->recordQueryCompletion()
Database.php line 2144 calls DatabaseBase->query()
User.php line 2242 calls DatabaseBase->update()
Database.php line 3445 calls {closure}()
Database.php line 3406 calls DatabaseBase->runOnTransactionIdleCallbacks()
User.php line 2244 calls DatabaseBase->onTransactionIdle()
CentralAuthHooks.php line 1013 calls User->invalidateCache()
CentralAuthHooks.php line 834 calls CentralAuthHooks::initSession()
Hooks.php line 209 calls CentralAuthHooks::onUserLoadFromSession()
User.php line 1087 calls Hooks::run()
User.php line 349 calls User->loadFromSession()
User.php line 1956 calls User->load()
TorBlockHooks.php line 41 calls User->getName()
TorBlockHooks.php line 84 calls TorBlockHooks::checkUserCan()
Hooks.php line 209 calls TorBlockHooks::onGetUserPermissionsErrorsExpensive()
Title.php line 2059 calls Hooks::run()
Title.php line 2485 calls Title->checkPermissionHooks()
Title.php line 1922 calls Title->getUserPermissionsErrorsInternal()
MediaWiki.php line 185 calls Title->getUserPermissionsErrors()
MediaWiki.php line 571 calls MediaWiki->performRequest()
MediaWiki.php line 424 calls MediaWiki->main()
index.php line 46 calls MediaWiki->run()
index.php line 3 calls include()

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 subscribers: PleaseStand, gerritbot, bd808 and 2 others.

CentralAuth and friends hit this path a fair amount but not all the time, this is a nice-to-have.

Change 199825 had a related patch set uploaded (by Aaron Schulz):
Introduced User::touch() method to bump the getTouched() value using memcached

Change 199825 merged by jenkins-bot:
Introduced User::touch() method to bump the getTouched() value using memcached