Chapter 6. Be Eventually Consistent
In this chapter, we'll finally address the question of what happens when two users update the same piece of information while offline. This problem, known as split-brain, is common to all distributed systems. When the apps finally get online, which change wins? Do we resolve the conflict automatically or do we let the user decide?
Try this now. Open the app in two separate browsers. Using the mobile development tools, put each app into offline mode. Now, make changes to the same to-do item on each device and then put them online. Notice how the last change wins. This is certainly a solution to the problem, but is it the best solution? Probably not.
We can't know which change is the correct change. Maybe both the users think that their change should win or don't even consider the possibility that their change may fail. We could let the owner win by default, but this doesn't address what happens when two collaborators make changes...