Monday, June 11, 2007

Multi-Master Replication, looking over the code-base

I'm running into a situation, where I need real multi-master replication, yet as we all know this doesn't exist (yet) in mysql.

So, as a result I'm investigating how I could implement multi-master replication. Fortunately mySQL has documented some of the source code and hosts this documentation online.

http://dev.mysql.com/sources/doxygen/mysql-5.1/slave_8cc-source.html

There are already references and hooks for multi-master replication in slave.cc


/*
TODO: replace the line below with
list_walk(&master_list, (list_walk_action)end_slave_on_walk,0);
once multi-master code is ready.
*/



Of all the ideas that I have batted around, I've come to a common conclusion, modify mysql source to enable multi-master replication or make an external daemon that would essentially do the same thing.



    In both cases here are my requirements.

  • It would need to read multiple replication events

  • It would need to log these multiple replication events

  • It would need a command interface to dynamically add,remove,change hosts




I could either build a method for pushing replication events to a list of hosts, or build a subscribe method which I'm leaning towards.

No comments: