Page MenuHomePhabricator

Avoid falling back to master when loading page data in GET requests
Closed, DuplicatePublic

Description

Currently, if WikiPageEntityMetaDataLookup::loadRevisionInformation fails to find an Entity, it will try to load it from the master database. This is done to avoid race conditions when loading entities right after creating them.

We now want to disable this fallback when it is not absolutely needed, so we don't hit the master database in GET requests.

Proposal:
WikiPageEntityMetaDataLookup::loadRevisionInformation already has a $mode parameter, which controls whether we first try the slave DB, or if we hit the master DB directly, see EntityRevisionLookup::LATEST_FROM_SLAVE and EntityRevisionLookup::LATEST_FROM_MASTER. LATEST_FROM_SLAVE is the default.

We should redefine LATEST_FROM_SLAVE to not fall back to the DB, and introduce a new mode LATEST_FROM_SLAVE_OR_MASTER to enable fallback. That mode would e.g. be used in jobs that handle change notifications on the client.