Added slave/master fallback logic in Revision
* This is a more specific form of the logic removed in
3c2bc32ae1.
It does not suffer the problem of causing constant master DB
queries due to a bad template reference or such.
* It will use the master if writes from the current thread
are pending or were recently committed. This deals with the
common problem of code that needs to read things it just wrote,
such as diffs on rollback or edit hooks.
* This commit reverts
8624e261f by making the hack obsolete.
Bug: T93866
Bug: T94407
Change-Id: Ib9ecb75e1236e767bdc86d124d5e22a03ae0fb5f