Tuesday, January 5, 2016

Database: Read, Modify, Write Pattern

Applies: When updating a record or item in a database

  1. Read item, remember the version number of the record (Vo)
  2. Validate if the update is allowed
  3. Update the record, and increment the version number (Vi)
  4. Replace the record in the data store only if the version in the data store is Vo
  5. If update fails, go to step 1