Distributed Transactions Transaction may access data at several sites. Each site has a local transaction manager responsible for: Maintaining a log for recovery purposes Participating in coordinating the concurrent execution of the transactions executing at that site. Each site has a transaction coordinator,which is responsible for: Starting the execution of transactions that originate at the site. Distributing subtransactions at appropriate sites for execution. Coordinating the termination of each transaction that originates at the site,which may result in the transaction being committed at all sites or aborted at all sites. Database System Concepts-6th Edition 19.17 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 19.17 ©Silberschatz, Korth and Sudarshan th Edition Distributed Transactions Transaction may access data at several sites. Each site has a local transaction manager responsible for: Maintaining a log for recovery purposes Participating in coordinating the concurrent execution of the transactions executing at that site. Each site has a transaction coordinator, which is responsible for: Starting the execution of transactions that originate at the site. Distributing subtransactions at appropriate sites for execution. Coordinating the termination of each transaction that originates at the site, which may result in the transaction being committed at all sites or aborted at all sites
Transaction System Architecture TC1 TCn transaction coordinator TM1 TMn transaction manager computer 1 computer n Database System Concepts-6th Edition 19.18 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 19.18 ©Silberschatz, Korth and Sudarshan th Edition 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-6th Edition 19.19 ©Silberschat乜,Korth and Sudarshan
Database System Concepts - 6 19.19 ©Silberschatz, Korth and Sudarshan th Edition 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-6th Edition 19.20 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 19.20 ©Silberschatz, Korth and Sudarshan th Edition 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 Si,and let the transaction coordinator at Si be Ci Database System Concepts-6th Edition 19.21 @Silberschatz,Korth and Sudarshan
Database System Concepts - 6 19.21 ©Silberschatz, Korth and Sudarshan th Edition 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