[wp-hackers] Allow Wordpress to use a Slave Database

Andy Skelton skeltoac at gmail.com
Tue Jun 3 17:34:22 GMT 2008

On Tue, Jun 3, 2008 at 11:24 AM, Colin Ogilvie
<wordpress at colinogilvie.co.uk> wrote:
> I've already done that at:
> http://trac.wordpress.org/ticket/7081

There is some good stuff in that patch and it looks like a good start
but I would not be quick to commit it to core. It does not consider
replication lag. It supports only one slave. The new bail has an
inappropriate message. The coding style could be more consistent.
(Aren't I critical?)

The lag issue appears when you write a record and then try to read the
same record from a slave before it has caught up. We don't handle the
case of old data being read in subsequent page loads but when it
happens in the same page load it can cause very nasty problems. We
handled this in HyperDB by staying on the write connection after any
write, in the same page load. In other words, never use a read-only
connection after having used a master connection. It's not perfect but
you can't imagine how many problems this caused in the early days of

If I think of anything else WPDB needs for slave awareness I'll let
you know. I have a sneaking feeling that I'm forgetting something


More information about the wp-hackers mailing list