Distributed Transactions ■Local transactions Access/update data at only one database Global transactions Access/update data at more than one database Key issue:how to ensure ACID properties for transactions in a system with global transactions spanning multiple database Database System Concepts-7th Edition 23.2 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 23.2 ©Silberschatz, Korth and Sudarshan th Edition Distributed Transactions ▪ Local transactions • Access/update data at only one database ▪ Global transactions • Access/update data at more than one database ▪ Key issue: how to ensure ACID properties for transactions in a system with global transactions spanning multiple database
Distributed Transactions Transaction may access data at several sites. Each site has a local transaction manager Each site has a transaction coordinator Global transactions submitted to any transaction coordinator TC1 TCn transaction coordinator TM1 TMn) transaction manager computer 1 computer n Database System Concepts-7th Edition 23.3 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 23.3 ©Silberschatz, Korth and Sudarshan th Edition Distributed Transactions ▪ Transaction may access data at several sites. • Each site has a local transaction manager • Each site has a transaction coordinator ▪ Global transactions submitted to any transaction coordinator
Distributed Transactions Each transaction coordinator 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 transaction must be committed at all sites or aborted at all sites. Each local transaction manager responsible for: Maintaining a log for recovery purposes Coordinating the execution and commit/abort of the transactions executing transaction at that site. coordinator TM transaction manager computer 1 computer n Database System Concepts-7th Edition 23.4 @Silberschatz,Korth and Sudarshan
Database System Concepts - 7 23.4 ©Silberschatz, Korth and Sudarshan th Edition Distributed Transactions ▪ Each transaction coordinator 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 ▪ transaction must be committed at all sites or aborted at all sites. ▪ Each local transaction manager responsible for: • Maintaining a log for recovery purposes • Coordinating the execution and commit/abort of the transactions executing at that site
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-7th Edition 23.5 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 23.5 ©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. cannot have transaction committed at one site and aborted at another The two-phase commit(2PC)protocol is widely used ■ Three-phase commit(3PC)protocol avoids some drawbacks of 2PC,but is more complex Consensus protocols solve a more general problem,but can be used for atomic commit More on these later in the chapter The protocols we study all assume fail-stop model-failed sites simply stop working,and do not cause any other harm,such as sending incorrect messages to other sites. Protocols that can tolerate some number of malicious sites discussed in bibliographic notes online Database System Concepts-7th Edition 23.6 ©Silberscha乜,Korth and Sudarshan
Database System Concepts - 7 23.6 ©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. ▪ cannot have transaction committed at one site and aborted at another ▪ The two-phase commit (2PC) protocol is widely used ▪ Three-phase commit (3PC) protocol avoids some drawbacks of 2PC, but is more complex ▪ Consensus protocols solve a more general problem, but can be used for atomic commit • More on these later in the chapter ▪ The protocols we study all assume fail-stop model – failed sites simply stop working, and do not cause any other harm, such as sending incorrect messages to other sites. • Protocols that can tolerate some number of malicious sites discussed in bibliographic notes online