Page MenuHomePhabricator

Augment user_touched with an in-memory field
Closed, ResolvedPublic

Description

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 created this task.Mar 2 2015, 6:25 PM
aaron claimed this task.
aaron raised the priority of this task from to Normal.
aaron updated the task description. (Show Details)
aaron added subscribers: PleaseStand, gerritbot, bd808 and 2 others.
bd808 set Security to None.
aaron added a comment.Mar 6 2015, 9:30 PM

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

Krenair added a subscriber: Krenair.Mar 7 2015, 1:03 AM

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

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

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

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

aaron closed this task as Resolved.Apr 2 2015, 5:17 AM
bd808 moved this task from Backlog to Done on the MediaWiki-Core-Team board.Apr 7 2015, 4:41 PM