Presentation is loading. Please wait.

Presentation is loading. Please wait.

6.830 Lecture 19 Eventual Consistency No class next Wednesday Oscar Office Hours Today 4PM G9 Lounge.

Similar presentations


Presentation on theme: "6.830 Lecture 19 Eventual Consistency No class next Wednesday Oscar Office Hours Today 4PM G9 Lounge."— Presentation transcript:

1 6.830 Lecture 19 Eventual Consistency No class next Wednesday Oscar Office Hours Today 4PM G9 Lounge

2 Two-phase commit CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) If all yes FW(COMMIT) Else FW(ABORT) COMMIT/ABORT(T) FW(COMMIT/ABORT) Prepared suboorindate’s wait to hear outcome from C Recover into prepared state and ask C for outcome W(DONE), once all S’s ACK ACK S can forget about transaction at this point -- C can forget about transaction at this point C must remember outcome until all S’s ack

3 Presumed Abort – if transaction aborts CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) If all yes FW(COMMIT) Else FW(ABORT) COMMIT/ABORT(T) FW(COMMIT/ABORT) W(DONE), once all S’s ACK ACK

4 Presumed Abort – if transaction aborts CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) If all yes FW(COMMIT) Else FW(ABORT) W(ABORT) COMMIT/ABORT(T) FW(COMMIT/ABORT) W(DONE), once all S’s ACK ACK

5 Presumed Abort – if transaction aborts CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) If all yes FW(COMMIT) Else FW(ABORT) W(ABORT) COMMIT/ABORT(T) FW(COMMIT/ABORT) W(ABORT) W(DONE), once all S’s ACK ACK

6 Presumed commit – if transaction commits Can’t just reply “COMMIT” in no information case Suppose C sends prepare messages, then crashes S sends vote, doesn’t hear anything, re-requests Eventually C recovers, rolls back, and replies “COMMIT” (because it has no information about xaction) Soln: prior to sending prepare, C force writes an additional “BEGIN COMMIT” records with a list of all workers If it crashes prior to writing COMMIT/ABORT, it can restart commit process, contact workers and ensure they know the outcome Adds an additional force write on C, but allows COMMIT to be an async write

7 Presumed commit – if transaction commits CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) COMMIT FW(COMMIT) W(DONE), once all S’s ACK ACK FW(COMMIT)

8 Presumed commit – if transaction commits CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) COMMIT FW(COMMIT) W(DONE), once all S’s ACK ACK FW(BEGIN COMMIT, Suboord list) FW(COMMIT)

9 Presumed commit – if transaction commits CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) W(COMMIT) COMMIT FW(COMMIT) W(DONE), once all S’s ACK ACK FW(BEGIN COMMIT, Suboord list)

10 Presumed commit – if transaction commits CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) COMMIT W(COMMIT) W(DONE), once all S’s ACK ACK FW(BEGIN COMMIT, Suboord list) W(COMMIT)

11 Presumed commit – if transaction commits CoordinatorSuboordinate PREPARE(T) FW(PREPARE, T,locks,…) VOTE(T,YES/NO) COMMIT W(COMMIT) FW(BEGIN COMMIT, Suboord list) W(COMMIT)

12 2PC -- Problems 2 network round trips + synchronous logging  high overheads Particularly when Coord and Suboord are far apart, i.e., in different data centers If Coord fails, Suboords must wait, or somehow choose a new coordinator If Coord + 1 Suboord fail, no way to recover Coord may have told failed Suboord about outcome, it may have exposed results 2PC sacrifices availability of system for consistency 2PC is probably not a good choice in a wide-area distributed setting Due to possibility of network failures, and wide area latency Alternatives: use a more complicated consensus protocol (e.g., Paxos), or relax consistency


Download ppt "6.830 Lecture 19 Eventual Consistency No class next Wednesday Oscar Office Hours Today 4PM G9 Lounge."

Similar presentations


Ads by Google