Lampson and Lomets Paper: A New Presumed Commit Optimization for Two Phase Commit - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

Lampson and Lomets Paper: A New Presumed Commit Optimization for Two Phase Commit

Description:

Messaging is low already, try to reduce forced log writes. In PrC a forced write happens at PREPARE ... To remove the forced PREPARE write, we need to: ... – PowerPoint PPT presentation

Number of Views:115
Avg rating:3.0/5.0
Slides: 21
Provided by: Big9
Category:

less

Transcript and Presenter's Notes

Title: Lampson and Lomets Paper: A New Presumed Commit Optimization for Two Phase Commit


1
Lampson and Lomets 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

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

COMMIT or ABORT
Forced record
execute commit
ACK
Record ACK

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
PREPARE
Forced record
make vote
COMMIT-VOTE

crash
COMMIT
Forced remove record
recovery
STATUS?
no record
COMMIT
2 forced write, 2 messages to cohort Cohort
doesnt need to send ACK
11
Presumed Commit (PrC) - ABORT
Cohort
Coordinator
PREPARE
Forced record
make vote
ABORT-VOTE
ABORT
execute abort
ACK

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
tidl
tidh
tidsta
Window of Active/Undocumented Transactions (REC)
Commited or Aborted Transactions
Not used space
  • 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 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)

15
The New PrC Protocol ABORT
Coordinator
PREPARE
IN range of tids contains this transaction tidl tid make vote
ABORT-VOTE
ABORT
abort
ACK

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 make vote
COMMIT-VOTE
COMMIT
ACK
abort

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
Write a Comment
User Comments (0)
About PowerShow.com