Stop reading from DB_MASTER

Authored by matthiasmullie.


Stop reading from DB_MASTER

The reason we read from DB_MASTER is that we persist just about
all data to cache as well, and we wanted to make sure it is
current (we can't backfill cache from a lagging DB slave...)

The easier way to accomplish this was to remove the cache
backfill. After this patch: data that falls out of cache is gone
from cache forever, it won't be backfilled anymore.

Long-term, we either want to reinstate backfilling cache (using
WANObjectCache), or get rid of the cache layer altogether. But
we'll first figure out the impact of removing the cache layer,
for which this is the first step (without this, lowering cache
TTL would make data fall out of cache sooner = more to backfill

more reads from DB_MASTER)

Next steps:

  • Wait a bit & see impact of stuff that falls out of cache and doesn't get backfilled
  • Start lowering $wgFlowCacheTime to let data fall out of cache earlier & get even more DB queries. Keep monitoring.
  • Set $wgFlowUseMemcache = false; Keep monitoring.
  • Completely remove cache layers from codebase. Optimize queries.

I also considered replacing BagOStuff::merge calls with
WANObjectCache::delete. However, we rely on BufferedBagOStuff,
which lets us deffer cache writes and commit them all at once.
This would require a bunch of refactoring that I suggest not doing
unless our cache proves effective (see above steps about how to
measure impact of eliminating it)

Slow queries can be monitored at:

Bug: T94028
Change-Id: I4198fef645eae73ac7d6fcf3533f4acfcbb06c54