MessageCache: replace should actually replace, not reload
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 26 Sep 2018 16:56:58 +0000 (12:56 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Thu, 11 Oct 2018 15:20:51 +0000 (11:20 -0400)
commit08e9eb1fef635a00a738e8785b24f3d4ae385390
tree4219fc54b573b994adb8be8aea19d31ce079288f
parent9f60798508052a90b5c20c35d4af1450c5e7b17e
MessageCache: replace should actually replace, not reload

Prior to I462554b30, MessageCache::replace() did just that: it took the
existing cache and updated the one entry.

In I462554b30, the rearrangement of work into a DeferredUpdate
introduced a bug: the in-process cache was updated, but when the shared
cache was loaded later the entry was never updated in there so the
shared caches kept the old value. This was found in code review and
worked around by reloading all the messages from the database instead of
updating the existing cache.

But all that extra work reloading everything from the database causes
major slowness saving any MediaWiki-namespace page when the wiki has
many such small pages. Let's go back and fix the bug so replace() can
again replace instead of reloading everything.

Bug: T203925
Change-Id: Ife8e1bd6f143f480eb8da09b817c85aadf33a923
includes/cache/MessageCache.php
tests/phpunit/includes/cache/MessageCacheTest.php