4 ms·
I don't know much about replication but what happens when a master dies just after the database is updated. Will the changes not be replicated? If the user see
by brunoqc 15y ago
I don't know much about replication but what happens when a master dies just after the database is updated. Will the changes not be replicated? If the user see that the second master does have the latest changes and he repeat his latest actions, what will happen when the first master goes back online? Will the data be duplicated or merged?
- alfiejohn_ 15y agoI think spydum's comment is what you're looking for. These are things that can and do happen, and you have to plan for it. Designing your applications and infrastructure with eventual consistency in mind can do wonders for both performance and redundancy.
- jermy 15y agoIt depends on your use case - either you accept there is a write hole that the update wont appear until that host comes back online and other hosts can relay the change, or you add application-level checking to not return to the user in the first instance until the change hits at least another host. In your scenario, yes. The two changes would be a conflict, but hopefully (if the user makes the same change) your conflict-resolution code would realise it is the same and merge them correctly. I fear I don't know how MySQL::Replication handles this, but it has to be application-level logic, so I assume it will allow you to override a default of, say, last-modification-wins.
- ww520 15y agoThat's one of the problems of multi-master replication. It's easy to introduce conflicts and requires lots of application logic or operation manual work to handle them.