Closed andrealonzo closed 8 years ago
Avoiding the majority of db inconsistencies with edfb1f4. Unfortunately this cannot save the db from being in inconsistent state if concurrent actions happen at the same time, because requires 2 operations (not atomic). But even version control would require atomic operations.
Here is a video on how facebook handle concurrency if someone tries to edit a post that has been deleted. When the user clicks save on the edit screen, a box appears saying:
This content is no longer available The content you requested cannot be displayed right now. It may be temporarily unavailable, the link you clicked on may have expired, or you may not have permission to view this page.
Facebook doesn't refresh the page showing that the post was deleted.
We could follow facebook's model. This would mean that for every write request, we need to check if all the references in the request are still available and valid, otherwise the request should fail, and user should know that something failed.
When 2 people are logged in and making changes in the app, the changes between the users will not be in sync. This will need to inaccurate states. Here are our proposed solutions: