How do you manage two-way synchronization between a 'main' database server and many 'secondary' servers, in particular conflict resolution, assuming a connection is not always available?
For example, I have a mobile app that uses CoreData as the 'database' on the iOS and I'd like to allow users to edit the contents without Internet connection. In the same time, this information is available on a website the devices will connect to. What do I do if/when the data on the two DB servers is in conflict?
(I refer to CoreData as a DB server, though I am aware it is something slightly different.)
Are there any general strategies for dealing with this sort of issue?
These are the options I can think of:
1. Always use the client-side data as higher-priority
2. Same for server-side
3. Try to resolve conflicts by marking each field's edit timestamp and taking the latest edit
Though I'm certain the 3rd option will open room for some devastating data corruption.
I'm aware that the CAP theorem concerns this, but I only want eventual consistency, so it doesn't rule it out completely, right?
Related question: Best practice patterns for two-way data synchronization. The second answer to this question says it probably can't be done.