On a wiki-style website, what can I do to prevent or mitigate write-write conflicts while still allowing the site to run quickly and keeping the site easy to use?
The problem I foresee is this:
- User A begins editing a file
- User B begins editing the file
- User A finishes editing the file
- User B finishes editing the file, accidentally overwriting all of User A’s edits
Here were some approaches I came up with:
- Have some sort of check-out / check-in / locking system (although I don’t know how to prevent people from keeping a file checked out ‘too long’, and I don’t want users to be frustrated by not being allowed to make an edit)
- Have some sort of diff system that shows an other changes made when a user commits their changes and allows some sort of merge (but I’m worried this will hard to create and would make the site ‘too hard’ to use)
- Notify users of concurrent edits while they are making their changes (some sort of AJAX?)
Any other ways to go at this? Any examples of sites that implement this well?
Remember the version number (or ID) of the last change. Then read the entry before writing it and compare if this version is still the same.
In case of a conflict inform the user who was trying to write the entry which was changed in the meantime. Support him with a diff.
Most wikis do it this way. MediaWiki, Usemod, etc.