Transaction System Architecture C transaction coordinator TMI TM transaction manager computer 1 computer n Database System Concepts-5th Edition,Aug 22,2005. 22.17 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 22.17 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Transaction System Architecture
System Failure Modes Failures unique to distributed systems: Failure of a site. Loss of massages Handled by network transmission control protocols such as TCP-IP Failure of a communication link Handled by network protocols,by routing messages via alternative links Network partition A network is said to be partitioned when it has been split into two or more subsystems that lack any connection between them -Note:a subsystem may consist of a single node Network partitioning and site failures are generally indistinguishable. Database System Concepts-5th Edition,Aug 22,2005. 22.18 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 22.18 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. System Failure Modes Failures unique to distributed systems: Failure of a site. Loss of massages Handled by network transmission control protocols such as TCP-IP Failure of a communication link Handled by network protocols, by routing messages via alternative links Network partition A network is said to be partitioned when it has been split into two or more subsystems that lack any connection between them – Note: a subsystem may consist of a single node Network partitioning and site failures are generally indistinguishable
Commit Protocols Commit protocols are used to ensure atomicity across sites a transaction which executes at multiple sites must either be committed at all the sites.or aborted at all the sites. not acceptable to have a transaction committed at one site and aborted at another The two-phase commit(2PC)protocol is widely used The three-phase commit(3PC)protocol is more complicated and more expensive,but avoids some drawbacks of two-phase commit protocol.This protocol is not used in practice Database System Concepts-5th Edition,Aug 22,2005. 22.19 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 22.19 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Commit Protocols Commit protocols are used to ensure atomicity across sites a transaction which executes at multiple sites must either be committed at all the sites, or aborted at all the sites. not acceptable to have a transaction committed at one site and aborted at another The two-phase commit (2PC) protocol is widely used The three-phase commit (3PC) protocol is more complicated and more expensive, but avoids some drawbacks of two-phase commit protocol. This protocol is not used in practice
Two Phase Commit Protocol(2PC) Assumes fail-stop model-failed sites simply stop working,and do not cause any other harm,such as sending incorrect messages to other sites. Execution of the protocol is initiated by the coordinator after the last step of the transaction has been reached. The protocol involves all the local sites at which the transaction executed Let T be a transaction initiated at site S;,and let the transaction coordinator at S;be Ci Database System Concepts-5th Edition,Aug 22,2005. 22.20 @Silberschatz,Korth and Sudarshan
Database System Concepts - 5 22.20 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Two Phase Commit Protocol (2PC) Assumes fail-stop model – failed sites simply stop working, and do not cause any other harm, such as sending incorrect messages to other sites. Execution of the protocol is initiated by the coordinator after the last step of the transaction has been reached. The protocol involves all the local sites at which the transaction executed Let T be a transaction initiated at site Si , and let the transaction coordinator at Si be Ci
Phase 1:Obtaining a Decision Coordinator asks all participants to prepare to commit transaction Ti. Ci adds the records <prepare T>to the log and forces log to stable storage sends prepare T messages to all sites at which T executed Upon receiving message,transaction manager at site determines if it can commit the transaction if not,add a record <no T>to the log and send abort T message to Ci if the transaction can be committed,then: add the record <ready T>to the log force all records for Tto stable storage send ready T message to Ci Database System Concepts-5th Edition,Aug 22,2005. 22.21 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 5 22.21 ©Silberschatz, Korth and Sudarshan th Edition, Aug 22, 2005. Phase 1: Obtaining a Decision Coordinator asks all participants to prepare to commit transaction Ti . Ci adds the records <prepare T> to the log and forces log to stable storage sends prepare T messages to all sites at which T executed Upon receiving message, transaction manager at site determines if it can commit the transaction if not, add a record <no T> to the log and send abort T message to Ci if the transaction can be committed, then: add the record <ready T> to the log force all records for T to stable storage send ready T message to Ci