6.830 lecture 19 eventual consistency no class next wednesday oscar office hours today 4pm g9 lounge

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

Upload: imogene-potter

Post on 19-Jan-2016

220 views

Category:

Documents


0 download

TRANSCRIPT

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

6.830 Lecture 19Eventual Consistency

No class next WednesdayOscar Office Hours Today 4PM G9 Lounge

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

Two-phase commit

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

If all yesFW(COMMIT)

ElseFW(ABORT)

COMMIT/ABORT(T)

FW(COMMIT/ABORT)

Prepared suboorindate’s wait to hear outcome from CRecover into prepared state and ask C for outcome

W(DONE), once all S’s ACK

ACKS can forget about transaction at this point --

C can forget about transaction at this point

C must remember outcomeuntil all S’s ack

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

Presumed Abort – if transaction aborts

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

If all yesFW(COMMIT)

ElseFW(ABORT)

COMMIT/ABORT(T)

FW(COMMIT/ABORT)

W(DONE), once all S’s ACK

ACK

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

Presumed Abort – if transaction aborts

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

If all yesFW(COMMIT)

ElseFW(ABORT) W(ABORT)

COMMIT/ABORT(T)

FW(COMMIT/ABORT)

W(DONE), once all S’s ACK

ACK

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

Presumed Abort – if transaction aborts

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

If all yesFW(COMMIT)

ElseFW(ABORT) W(ABORT)

COMMIT/ABORT(T)

FW(COMMIT/ABORT)W(ABORT)

W(DONE), once all S’s ACK

ACK

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

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

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

Presumed commit – if transaction commits

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

COMMIT

FW(COMMIT)

W(DONE), once all S’s ACK

ACK

FW(COMMIT)

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

Presumed commit – if transaction commits

Coordinator Suboordinate

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)

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

Presumed commit – if transaction commits

Coordinator Suboordinate

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)

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

Presumed commit – if transaction commits

Coordinator Suboordinate

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)

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

Presumed commit – if transaction commits

Coordinator Suboordinate

PREPARE(T)

FW(PREPARE, T,locks,…)VOTE(T,YES/NO)

COMMIT

W(COMMIT)

FW(BEGIN COMMIT, Suboord list)

W(COMMIT)

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

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 consistency2PC 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