Locking disadvantage

  1. Overhead
  2. Deadlock: need special-purpose locking protocols
  3. Need to lock root node while accessing HDD
  4. Locks need to hold until the end of transaction
  5. Locks may be necessary only in the worst case

OCC

  • Reads are not restricted
    • returning a result is considered as a write
  • Writes
    • Read phase -> Validation phase -> Write phase

Read Phase

  • Maintain create/write/read set
  • Only write to local copies (copy-on-write)
  • Assign transaction numbers at end of the read Phase

Write Phase

  • Rename all objects in write set to original name

Validation Phase

Issue

  • Long read phase
    • need to check all previous write sets
    • not enough memory
    • => fail transaction
  • Starving
    • => lock entire database after too many retries

Serial Validation

  • Obtain lock during validation / write phases

serialization is the weakest criterion for preserving consistency of a concurrent transaction system,