Avoid MessageCache rebuilds if replace() was called recently
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 30 Aug 2015 06:52:14 +0000 (23:52 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 3 Sep 2015 01:06:22 +0000 (01:06 +0000)
commit2be60e777a091796220246df9469778b11ec4eca
tree6885be0713e0a7850c785e4f6b0cc7ef8e1acdd0
parent89a167b500dc857f9def03bd83d951161d312d4d
Avoid MessageCache rebuilds if replace() was called recently

* If replace() was called recently, then we know that this is the
  master data center and that the messages are up-to-date. With this
  change, replace() calls have nothing to contend with aside from other
  replace() calls. Even if there were timeouts due to such contention,
  caused by high MediaWiki: page edit rates, the replace() updates would
  pick up the prior changes in passing since they do load().
* This also avoids the following scenario:
  a) Someone edits a message page, triggering replace()
  b) Some page view causes load() to trigger loadFromDB()
     due to the hash being seen as volatile due to replace()
  c) The loadFromDB() loads stale slave data and undoes
     the message key update the replace() did

Change-Id: I9cdf7ad3d67f168fcba7f633af9e32a8d1fa928e
includes/cache/MessageCache.php