Ics 214B: Transaction Processing and Distributed Data Management Lecture 12: Three-Phase Commits (3PC)
tarix 29.12.2016 ölçüsü 158,5 Kb. #3852
Lecture 12: Three-Phase Commits (3PC) Professor Chen Li
2PC is blocking Sample scenario: Coord P2 W P1 P3 W P4 W
Case I: Case I: P1 “W”; coordinator sent commits P1 “C” Case II: P1 NO; P1 A P2, P3, P4 (surviving participants) cannot safely abort or commit transaction
Complexity analysis Count number of messages, rounds Centralized 2PC Ignore DONE messages If there are no failures:
Variants of 2PC
Variants of 2PC Distributed Nodes broadcast all messages Every node knows when to commit
Exercise Compare 2PC variants in terms of
Cooperative Termination Protocol Bad case Participant P recovers from failure Has prepared record for transaction T No commit or abort record for T Coordinator is down
Cooperative termination protocol But perhaps some other participant can help? Requires participants “know” each other!
Cooperative Termination Protocol Participant P sends a DECISION-REQUEST message to other participants Alive participants respond with COMMIT, ABORT, or UNCERTAIN If any participant replies with a decision (COMMIT or ABORT), P acts on decision And sends decision to UNCERTAIN participants
Cooperative Termination Protocol When P receives a DECISION-REQUEST If it knows decision, responds with COMMIT or ABORT If it has not prepared transaction , responds ABORT If it is prepared but does not know decision, responds UNCERTAIN
Cooperative Termination Sample scenario: Coord P1 C P2 W P3 W
Cooperative Termination Sample scenario: Coord P1 W P2 W P3 A
Cooperative Termination Sample scenario: Coord P1 W P2 W P3 W
Is there a non-blocking protocol? Theorem: If communications failure or total site failures (i.e., all sites are down simultaneously) are possible, then every atomic protocol may cause processes to become blocked.
Next…
Three-Phase Commit Sample scenario: Coord P1 W P2 W P3 W
3PC Principle If ANY operational site is in the “uncertain” state, NO site (operational or failed) could have decided to commit Reminder: Assume reliable network
Three categories Operational Process has been up since start of 3PC Failed Process has halted since start of 3PC, or is recovering Recovered Process that failed and has completed recovery
Termination Protocol
Termination Protocol Elect new coordinator Use Election Protocol (coming soon…) Makes decision using termination rules Communicates to participants
Termination Protocol Sample scenario: Coord P1 W P2 W P3 W
Termination Protocol Sample scenario: Coord P1 W P2 W P3 PC
Note: 3PC unsafe with communication failures! Note: 3PC unsafe with communication failures!
Dostları ilə paylaş: