On 16 June 2012 15:26, Antoine Musso hashar+wmf@free.fr wrote:
Niklas Laxström wrote:
I have now had multiple issues in Translate extension that are related to database replication. After doing write to the master, some maintenance tasks kick in and use slave to read the (now stale) data.
The maintenance script need to wait for the slave to catchup the master position. The wfWaitForSlaves() global function is exactly intended for that. A typical use cases is when you make tons of writes to master and dont want to break replication or have the slaves lagging too much. You would split the writes in batches and then wait until slaves catch up.
Have a look at maintenance/runBatchedQuery.php for an easy to read example.
The latest case is https://bugzilla.wikimedia.org/37647 - it is not a maintenance script and the problem is not lot of writes, but getting fresh data after write. -Niklas