Optimistic concurrency control: Difference between revisions

Content deleted Content added
No edit summary
Line 21:
==Web usage==
 
The [[Stateless server|stateless]] nature of [[HTTP]] makes locking infeasible for web user interfaces.{{Fact|date=February 2007}} It's common for a user to start editing a record, then leave without following a "cancel" or "logout" link. If locking is used, other users who attempt to edit the same record must wait until the first user's lock expires.
 
OCC is a natural choice. It is simple to implement and avoids unnecessary waiting or silently overwritten records. Typically the [[Form (web)|form]] presented to the user includes a hidden field with the record's original content, a timestamp, a sequence number, or an opaque token. On submit, this is compared against the database. If it differs, the conflict resolution algorithm is invoked.