Outline Distributed DBMS Introduction Background Distributed DBMS Architecture
Outline Distributed DBMS Introduction Background Distributed DBMS Architecture Distributed Database Design Distributed Query Processing Distributed Transaction Management Transaction Concepts and Models Distributed Concurrency Control Distributed Reliability Building Distributed Database Systems (RAID) Mobile Database Systems Privacy, Trust, and Authentication Peer to Peer Systems © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 1
Useful References D. Skeen and M Stonebraker, A Formal Model of Crash Recovery in a Distributed System, IEEE Trans. Software Eng. 9(3): 219 -228, 1983. D. Skeen, A Decentralized Termination Protocol, IEEE Symposium on Reliability in Distributed Software and Database Systems, July 1981. Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 2
Byzantine General Problem Two generals are situated on adjacent hills and enemy is in the valley in between. Enemy can defeat either general, but not both. To succeed, both generals must agree to either attack or retreat. The generals can communicate via messengers who are subject to capture or getting lost. The general may themselves be traitors or send inconsistent information. Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 3
Byzantine Agreement Problem of a set of processors to agree on a common value for an object. Processors may fail arbitrarily, die and revive randomly, send messages when they are not supposed to etc. Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 4
Atomicity Control from Book Commit protocols How to execute commit command for distributed transactions. Issue: how to ensure atomicity and durability? Termination protocols If a failure occurs, how can the remaining operational sites deal with it. Non-blocking : the occurrence of failures should not force the sites to wait until the failure is repaired to terminate the transaction. Recovery protocols When a failure occurs, how do the sites where the failure occurred deal with it. Independent : a failed site can determine the outcome of a transaction without having to obtain remote information. Independent recovery non-blocking termination Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 5
General Terminology for Commit/Termination/Recovery Protocols Committed: Effects are installed to the database. Aborted: Does not execute to completion and any partial effects on database are erased. Derived state from serial execution. Consistent state: Inconsistency caused by: 1. Concurrently executing transaction. 2. Failures causing partial or incorrect execution 3. of a transaction. Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 6
General Terminology for Commit/Termination/Recovery Protocols Commit protocols Protocols for directing the successful execution of a simple transaction Termination protocols Protocols at operational site to commit/abort an unfinished transaction after a failure Recovery protocols Protocols at failed site to complete all transactions outstanding at the time of failure Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 7
General Terminology for Commit/Termination/Recovery Protocols Distributed Crash Recovery: Centralized Protocols Hierarchical Protocols Linear Protocols Decentralized Protocols Phase: Consists of a message round where all Sites exchange messages. Two Phase Commit Protocol: ARGUS, LOCUS, INGRES Four Phase Commit Protocol: SSD-1 Quorum: Minimum number of sites needed to proceed with an action Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 8
Commit/Termination Protocols Two Phase Commit Three Phase Commit Four Phase Commit Linear, Centralized, Hierarchical, Decentralized Protocols Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 9
Two Phase Commit Site 1 1. Site 2 Trans. arrives. Message to ask for vote is sent to other site(s) Message is recorded. Site votes Y or N (abort) Vote is sent to site 1 2. The vote is received. If vote = Y on both sites, then Commit else Abort Either Commit or Abort based on the decision of site 1 Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 10
Two-Phase Commit (2 PC) Phase 1 : The coordinator gets the participants ready to write the results into the database Phase 2 : Everybody writes the results into the database Coordinator : The process at the site where the transaction originates and which controls the execution Participant : The process at the other sites that participate in executing the transaction Global Commit Rule: The coordinator aborts a transaction if and only if at least one participant votes to abort it. The coordinator commits a transaction if and only if all of the participants vote to commit it. Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 11
Local Protocols for the Centralized Two. Phase Commit Protocol Site 1 (co-ordinator) Site 2 (slave) q 1 q 2 xact request start xact w 2 w 1 no a 1 Distributed DBMS start xact yes commit yes abort c 1 abort start xact no a 2 commit c 2 © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 12
Decentralized Two-Phase Commit Protocol qi xact yesi 1 … yesin wi send receive xact noi 1 … noin no 1 i| … |noni ai yes 1 i| … |yesni ci Site i (i = 1, 2, …n) Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 13
Centralized 2 PC (see book) P P C C P P ready? yes/no Phase 1 Distributed DBMS C commit/abort? commited/aborted Phase 2 © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 14
SDD-1 Four-Phase Commit Protocol Site 1 (co-ordinator) Site 2 (back-up) Site i (i = 3, 4) (slave) q 1 q 2 qi xact 2 request xact 2 w 1 ’ act 2 xact 3 xact 4 yes 3 yes 4 commit 2 c 1’ ack 2 commit 3 commit 4 abort 2 act 2 a 2 wi commit 2 act 2 c 2 aborti xacti noi ai commiti ci no 3|no 4 abort 2 a 1 ’ ack 2 abort 3 abort 4 c 1 Distributed DBMS w 1 xacti …i yes a 1 © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 15
2 PC Protocol Actions (see book) Coordinator Participant INITIAL PREP write begin_commit in log VOT write abort in log ORT No E-AB Yes write ready in log GLOBAL-ABORT write abort in log M -COM No VOTE Abort ACK ABORT ACK write end_of_transaction in log Distributed DBMS READY IT write commit in log COMMIT Ready to Commit? Yes VOTE-COMMIT WAIT Any No? ARE write abort in log ABORT © 1998 M. Tamer Özsu & Patrick Valduriez Type of msg Commit write commit in log COMMIT Page 10 -12. 16
Linear 2 PC Phase 1 Prepare 1 VC/VA 2 GC/GA VC/VA 3 GC/GA VC/VA 4 GC/GA VC/VA 5 GC/GA N GC/GA Phase 2 VC: Vote-Commit, VA: Vote-Abort, GC: Global-commit, GA: Global-abort Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Page 10 -12. 17
State Transitions in 2 PC (see book) INITIAL Commit command Prepare Vote-commit Prepare Vote-abort WAIT Vote-abort Global-abort READY Vote-commit (all) Global-commit ABORT Global-abort Ack COMMIT Coordinator Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Global-commit Ack ABORT COMMIT Participants Page 10 -12. 18
Site Failures - 2 PC Termination (see book) COORDINATOR Timeout in INITIAL Who cares Timeout in WAIT Cannot unilaterally commit Can unilaterally abort Commit command Prepare WAIT Timeout in ABORT or COMMIT Stay blocked and wait for the acks Vote-abort Global-abort ABORT Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Vote-commit Global-commit COMMIT Page 10 -12. 19
Site Failures - 2 PC Termination PARTICIPANTS INITIAL Timeout in INITIAL Coordinator must have failed in INITIAL state Prepare Vote-abort Unilaterally abort Prepare Vote-commit Timeout in READY Stay blocked READY Global-abort Ack ABORT Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Global-commit Ack COMMIT Page 10 -12. 20
Site Failures - 2 PC Recovery COORDINATOR Failure in INITIAL Start the commit process upon recovery Failure in WAIT Restart the commit process upon recovery Commit command Prepare Failure in ABORT or COMMIT Nothing special if all the acks have been received Otherwise the termination protocol is involved WAIT Vote-abort Global-abort ABORT Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez Vote-commit Global-commit COMMIT Page 10 -12. 21
Site Failures - 2 PC Recovery PARTICIPANTS Failure in INITIAL Unilaterally abort upon recovery Failure in READY The coordinator has been informed about the local decision Treat as timeout in READY state and invoke the termination protocol Failure in ABORT or COMMIT Prepare Vote-abort Prepare Vote-commit READY Global-abort Ack Global-commit Ack Nothing special needs to be done ABORT Distributed DBMS © 1998 M. Tamer Özsu & Patrick Valduriez COMMIT Page 10 -12. 22
- Slides: 22