1 / 20

Lampson and Lomet’s Paper: A New Presumed Commit Optimization for Two Phase Commit

Lampson and Lomet’s Paper: A New Presumed Commit Optimization for Two Phase Commit. Doug Cha COEN 317 – SCU Spring 05. About the authors. Butler Lampson Currently at MSFT Formerly at Xerox PARC, DEC research, and a professor at MIT and Berkeley ACM Turing Award in 1992 David Lomet

landon
Download Presentation

Lampson and Lomet’s Paper: A New Presumed Commit Optimization for Two Phase Commit

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lampson and Lomet’s Paper: A New Presumed Commit Optimization for Two Phase Commit Doug Cha COEN 317 – SCU Spring 05

  2. About the authors • Butler Lampson • Currently at MSFT • Formerly at Xerox PARC, DEC research, and a professor at MIT and Berkeley • ACM Turing Award in 1992 • David Lomet • Also at MSFT, formerly at DEC research • Key work on database systems • One of the inventors of the transaction concpet • ACM Fellow

  3. Outline • Review of 2PC • More on 2PC / Optimizations • Presumed Nothing • Presumed Abort • Presumed Commit • Recovery requirements • The new PrC protocol • Summary

  4. Review of 2PC • Distributed Atomic Commit problem (DC9 p2) • How to get all members of a group to commit/abort together? • Two Phase Commit, Gray 1987 (DC9 p3): • First phase is the voting phase • Coordinator sends all participants (cohorts) a vote request (PREPARE) • All participants (cohorts) respond COMMIT-VOTE or ABORT-VOTE • Second phase, coordinator decides commit or abort: if any participant voted ABORT, then decision must be abort. Otherwise, commit. • Coordinator sends all participants decision (COMMIT or ABORT) • Participants (who have been waiting for decision) commit or abort as instructed and ACK.

  5. 2 Phase Commit Cohort Coordinator PREPARE make vote COMMIT-VOTE <<collect all votes>> COMMIT execute commit ACK Additional Detail – A protocol database at the coordinator stores transaction states and cohort votes. This is used for error recovery.

  6. 2PC Variations • Presumed Nothing (PrN) • Presumed Abort (PrA) • Presumed Commit (PrC) • Variations deal with how to handle recovery and vary on how recovery data is logged.

  7. Presumed Nothing (PrN) Cohort Coordinator PREPARE make vote COMMIT or ABORT-VOTE <<collect all votes>> COMMIT or ABORT Forced record execute commit ACK Record ACK <<collect all acks>> Remove record 1 forced write, 1 lazy write, 2 messages to cohort

  8. PrN Failure Recovery Cohort Coordinator PREPARE make vote COMMIT-VOTE crash timeout STATUS? no record ABORT In PrN nothing is recorded until a COMMIT is sent, so coordinator crash results in ABORT.

  9. PrA Optimization Cohort Coordinator PREPARE make vote ABORT-VOTE No record crash ABORT recovery STATUS? no record ABORT On an ABORT, there are no log records and no ACK. This works because we “presume an abort” if no record exists!

  10. Presumed Commit (PrC) - COMMIT Cohort Coordinator Forced record PREPARE make vote COMMIT-VOTE <<collect all votes>> crash COMMIT Forced remove record recovery STATUS? no record COMMIT 2 forced write, 2 messages to cohort Cohort doesn’t need to send ACK

  11. Presumed Commit (PrC) - ABORT Cohort Coordinator Forced record PREPARE make vote ABORT-VOTE ABORT execute abort ACK <<collect all acks>> remove record ACK only needed on ABORTs

  12. Comparison For Now

  13. Improving PrC • Messaging is low already, try to reduce forced log writes. • In PrC a forced write happens at PREPARE • Any transactions with a PREPARE, but no transaction end are aborted • Non existence of a transaction record assumes commit • To remove the forced PREPARE write, we need to: • Find another way to identify transactions that may have started before the crash but did not finish • Keep these transaction records around so we know to abort them (since we are still presuming commits)

  14. Improving PrC Transaction Log time • Instead of recording trans init, record timestamps: • tidl –lowest possible time of an undocumented transaction • tidh –most recent undocumented transaction • tidsta – most recent record of a transaction • So we have: • REC = { tid | tidl < tid < tidh} = recent transactions • COM = commited and stable transactions • IN = REC – COM = transactions maybe active during crash • On recovery: • Cohorts asking status of a transaction assume commit unless the record exists in the IN set • The IN set must be stored forever! (But data size is small) tidl tidsta tidh Commited or Aborted Transactions Window of Active/Undocumented Transactions (REC) Not used space

  15. The New PrC Protocol ABORT Coordinator PREPARE IN range of tids contains this transaction tidl < tid < tidh make vote ABORT-VOTE ABORT abort ACK <<Collect all acks>> increase tidl value past this trans, so IN set does not include this anymore

  16. The New PrC Protocol COMMIT Coordinator PREPARE IN range of tids contains this transaction tidl < tid < tidh make vote COMMIT-VOTE COMMIT ACK abort <<Collect all acks>> Move tidl past this recovery / crash STATUS? No trans record in IN so commit COMMIT

  17. The New PrC Protocol ABORT/CRASH Coordinator PREPARE IN range of tids contains this transaction make vote ABORT-VOTE ABORT abort crash ACK recovery STATUS? Trans is still in IN set, so we send abort ABORT

  18. Analysis of New PrC Protocol • We reduce the # of forced writes but require permanent storage of IN records

  19. Summary • Two-Phase Commit • Presumed Nothing • Presumed Abort • Presumed Commit • Requirements for logging/recovery • New Presumed Commit

  20. References • A New Presumed Commit Optimization for Two Phase Commit – Lampson and Lomet, 1993. • Distributed Systems Concepts and Design – Coulouris, Dollimore, Kindberg • Santa Clara Univ, COEN 317 class notes – Holliday

More Related