SlideShare une entreprise Scribd logo
1  sur  15
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 sub-transactions 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.
SYSTEM FAILURE MODES
• Failures unique to distributed systems:
• Failure of a site.
• Loss of messages
• 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 that 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 (2 PC) protocol is widely used
•The three-phase commit (3 PC) protocol is more complicated and more expensive but
avoids some drawbacks of the two-phase commit protocol.
Commit Protocol
•To ensure atomicity transaction T must execute commit protocol
•Two phase commit protocol. (2pc)
•When T completes its execution – when all the sites at which T has executed
inform to ci that T has completed – ci starts 2PC protocol
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 the log to stable storage
• Sends prepare T messages to all sites at which T executed
• Upon receiving the message, the transaction manager at site determines if it can commit the transaction
• If not, add A record <no T> to the log and send an 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
Phase 2: Recording The Decision
• T can be committed of ci received A ready T message from all the participating sites: otherwise T must
be aborted.
• Coordinator adds a decision record, <commit t> or <abort t>, to the log and forces record onto stable
storage. Once the record stable storage it is irrevocable (even if failures occur)
• Coordinator sends A message to each participant informing it of the decision (commit or abort)
• Participants take appropriate action locally.
Two-Phase Commit Protocol
HANDLING OF FAILURES - SITE FAILURE
When the site si recovers, it examines its log to determine the fate of transactions active at the time of the
failure.
• Log contain <commit t> record: site executes redo (t)
• Log contains <abort T> record: site executes undo (T)
• Log contains <ready T> record: site must consult ci to determine the fate of T.
• If t committed, redo (t)
• If T aborted, undo (T)
• The log contains no control records concerning T
• Implies that sk failed before responding to the prepare T message from ci
• Sk must execute undo (T)
HANDLING OF FAILURES- COORDINATOR FAILURE
• If coordinator fails while the commit protocol for T is executing then participating sites must decide
on t’s fate:
1. If an active site contains a <commit T> record in its log, then T must be committed.
2. If an active site contains an <abort t> record in its log, then t must be aborted.
3. If some active participating site does not contain a <ready t> record in its log, then the failed coordinator ci
cannot have decided to commit t.
1. Can therefore abort t.
4. If none of the above cases holds, then all active sites must have a <ready t> record in their logs, but no
additional control records (such as <abort t> of <commit t>).
1. In this case active sites must wait for ci to recover, to find decision.
• Blocking problem: active sites may have to wait for failed coordinator to recover.
Handling Of Failures - Network Partition
• If the coordinator and all its participants remain in one partition, the failure has no effect on the
commit protocol.
• If the coordinator and its participants belong to several partitions:
• Sites that are not in the partition containing the coordinator think the coordinator has failed, and
execute the protocol to deal with failure of the coordinator.
• No harm results, but sites may still have to wait for decision from coordinator.
• The coordinator and the sites are in the same partition as the coordinator think that the sites in the
other partition have failed, and follow the usual commit protocol.
• Again, no harm results
Three Phase Commit Protocol
• Three-Phase Commit (3PC) Protocol is an extension of the Two-Phase Commit (2PC) Protocol that
avoids blocking problem under certain assumptions
• In particular, it is assumed that no network partition occurs, and not more than k sites fail, where we
assume ‘k’ is predetermined number.
• Instead of directly noting the commit decision in its persistent storage, the coordinator first ensures
that at least ‘k’ other sites know that it intended to commit transaction.
Three Phase Commit Protocol
• In a situation where the coordinator fails, the remaining sites are bound to first select new coordinator.
• This new coordinator checks status of the protocol from the remaining sites.
• If the coordinator had decided to commit, at least one of other ‘k’ sites that it informed will be up and
will ensure that commit decision is respected.
• The new coordinator restarts third phase of protocol if any of rest sites knew that old coordinator
intended to commit transaction.
• Otherwise, new coordinator aborts the transaction.
Three Phase Commit Protocol
THANK YOU

Contenu connexe

Similaire à enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9Yjv.pptx

2011 Db Distributed
2011 Db Distributed2011 Db Distributed
2011 Db Distributed
atali
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMS
koolkampus
 
Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's Algorithm
Souvik Roy
 

Similaire à enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9Yjv.pptx (20)

Chapter 13
Chapter 13Chapter 13
Chapter 13
 
6 two phasecommit
6 two phasecommit6 two phasecommit
6 two phasecommit
 
DBMS UNIT V.pptx
DBMS UNIT V.pptxDBMS UNIT V.pptx
DBMS UNIT V.pptx
 
Top schools in ghaziabad
Top schools in ghaziabadTop schools in ghaziabad
Top schools in ghaziabad
 
2011 Db Distributed
2011 Db Distributed2011 Db Distributed
2011 Db Distributed
 
Fault Tolerant and Distributed System
Fault Tolerant and Distributed SystemFault Tolerant and Distributed System
Fault Tolerant and Distributed System
 
Transaction management transparencies
Transaction management transparenciesTransaction management transparencies
Transaction management transparencies
 
19. Distributed Databases in DBMS
19. Distributed Databases in DBMS19. Distributed Databases in DBMS
19. Distributed Databases in DBMS
 
Mutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's AlgorithmMutual Exclusion using Peterson's Algorithm
Mutual Exclusion using Peterson's Algorithm
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 
2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL2 PHASE COMMIT PROTOCOL
2 PHASE COMMIT PROTOCOL
 
Synchronization
SynchronizationSynchronization
Synchronization
 
dos.ppt.pptx
dos.ppt.pptxdos.ppt.pptx
dos.ppt.pptx
 
Recovery in Multi database Systems
Recovery in Multi database SystemsRecovery in Multi database Systems
Recovery in Multi database Systems
 
basil.pptx
basil.pptxbasil.pptx
basil.pptx
 
Adbms 34 transaction processing and recovery
Adbms 34 transaction processing and recoveryAdbms 34 transaction processing and recovery
Adbms 34 transaction processing and recovery
 
What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...What is Database Backup? The 3 Important Recovery Techniques from transaction...
What is Database Backup? The 3 Important Recovery Techniques from transaction...
 
Unit 5 dbms
Unit 5 dbmsUnit 5 dbms
Unit 5 dbms
 
운영체제론 Ch16
운영체제론 Ch16운영체제론 Ch16
운영체제론 Ch16
 
2 pc
2 pc2 pc
2 pc
 

Plus de DHANUSHKUMARKS

Plus de DHANUSHKUMARKS (6)

analog ppt.pptx
analog ppt.pptxanalog ppt.pptx
analog ppt.pptx
 
beee final.ppt
beee final.pptbeee final.ppt
beee final.ppt
 
theadvantagesanddisadvantagesofonlinelearning-121020185318-phpapp01 (1).pdf
theadvantagesanddisadvantagesofonlinelearning-121020185318-phpapp01 (1).pdftheadvantagesanddisadvantagesofonlinelearning-121020185318-phpapp01 (1).pdf
theadvantagesanddisadvantagesofonlinelearning-121020185318-phpapp01 (1).pdf
 
4. Rectifier.pptx
4. Rectifier.pptx4. Rectifier.pptx
4. Rectifier.pptx
 
dsd.pptx
dsd.pptxdsd.pptx
dsd.pptx
 
Hwr ,Fwr,Br.pptx
Hwr ,Fwr,Br.pptxHwr ,Fwr,Br.pptx
Hwr ,Fwr,Br.pptx
 

Dernier

Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Nitya salvi
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
210303105569
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
balqisyamutia
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
wpkuukw
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
nirzagarg
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
awasv46j
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
CristineGraceAcuyan
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptx
balqisyamutia
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
ehyxf
 

Dernier (20)

LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEKLANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
LANDSCAPE ARCHITECTURE PORTFOLIO - MAREK MITACEK
 
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In eluru [ 7014168258 ] Call Me For Genuine Models We ...
 
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
Just Call Vip call girls Fatehpur Escorts ☎️8617370543 Two shot with one girl...
 
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Ratnagiri Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
 
Q4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentationQ4-W4-SCIENCE-5 power point presentation
Q4-W4-SCIENCE-5 power point presentation
 
Hackathon evaluation template_latest_uploadpdf
Hackathon evaluation template_latest_uploadpdfHackathon evaluation template_latest_uploadpdf
Hackathon evaluation template_latest_uploadpdf
 
Resume all my skills and educations and achievement
Resume all my skills and educations and  achievement Resume all my skills and educations and  achievement
Resume all my skills and educations and achievement
 
TRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptxTRose UXPA Experience Design Concord .pptx
TRose UXPA Experience Design Concord .pptx
 
Minimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptxMinimalist Orange Portfolio by Slidesgo.pptx
Minimalist Orange Portfolio by Slidesgo.pptx
 
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Jalaun Just Call 8617370543 Top Class Call Girl Service Available
 
Sweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptxSweety Planet Packaging Design Process Book.pptx
Sweety Planet Packaging Design Process Book.pptx
 
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for FriendshipRaebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
Raebareli Girl Whatsapp Number 📞 8617370543 | Girls Number for Friendship
 
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
一比一定(购)卡尔顿大学毕业证(CU毕业证)成绩单学位证
 
Gamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad IbrahimGamestore case study UI UX by Amgad Ibrahim
Gamestore case study UI UX by Amgad Ibrahim
 
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
Top profile Call Girls In Mau [ 7014168258 ] Call Me For Genuine Models We ar...
 
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
NO1 Top Pakistani Amil Baba Real Amil baba In Pakistan Najoomi Baba in Pakist...
 
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
一比一原版(WLU毕业证)罗瑞尔大学毕业证成绩单留信学历认证原版一模一样
 
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
Q4-Trends-Networks-Module-3.pdfqquater days sheets123456789
 
Simple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptxSimple Conference Style Presentation by Slidesgo.pptx
Simple Conference Style Presentation by Slidesgo.pptx
 
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
怎样办理莫纳什大学毕业证(Monash毕业证书)成绩单留信认证
 

enc=encoded=TlJst0_SHq0cPRhLS74QDXTP4FpU303sSqpyVVkfhckA93UCiZrRF0QVNAFGmuGu9Yjv.pptx

  • 1.
  • 2. 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 sub-transactions 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.
  • 3. SYSTEM FAILURE MODES • Failures unique to distributed systems: • Failure of a site. • Loss of messages • 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.
  • 4. COMMIT PROTOCOLS •Commit protocols are used to ensure atomicity across sites •A transaction that 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 (2 PC) protocol is widely used •The three-phase commit (3 PC) protocol is more complicated and more expensive but avoids some drawbacks of the two-phase commit protocol.
  • 5. Commit Protocol •To ensure atomicity transaction T must execute commit protocol •Two phase commit protocol. (2pc) •When T completes its execution – when all the sites at which T has executed inform to ci that T has completed – ci starts 2PC protocol
  • 6. 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 the log to stable storage • Sends prepare T messages to all sites at which T executed • Upon receiving the message, the transaction manager at site determines if it can commit the transaction • If not, add A record <no T> to the log and send an 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
  • 7. Phase 2: Recording The Decision • T can be committed of ci received A ready T message from all the participating sites: otherwise T must be aborted. • Coordinator adds a decision record, <commit t> or <abort t>, to the log and forces record onto stable storage. Once the record stable storage it is irrevocable (even if failures occur) • Coordinator sends A message to each participant informing it of the decision (commit or abort) • Participants take appropriate action locally.
  • 9. HANDLING OF FAILURES - SITE FAILURE When the site si recovers, it examines its log to determine the fate of transactions active at the time of the failure. • Log contain <commit t> record: site executes redo (t) • Log contains <abort T> record: site executes undo (T) • Log contains <ready T> record: site must consult ci to determine the fate of T. • If t committed, redo (t) • If T aborted, undo (T) • The log contains no control records concerning T • Implies that sk failed before responding to the prepare T message from ci • Sk must execute undo (T)
  • 10. HANDLING OF FAILURES- COORDINATOR FAILURE • If coordinator fails while the commit protocol for T is executing then participating sites must decide on t’s fate: 1. If an active site contains a <commit T> record in its log, then T must be committed. 2. If an active site contains an <abort t> record in its log, then t must be aborted. 3. If some active participating site does not contain a <ready t> record in its log, then the failed coordinator ci cannot have decided to commit t. 1. Can therefore abort t. 4. If none of the above cases holds, then all active sites must have a <ready t> record in their logs, but no additional control records (such as <abort t> of <commit t>). 1. In this case active sites must wait for ci to recover, to find decision. • Blocking problem: active sites may have to wait for failed coordinator to recover.
  • 11. Handling Of Failures - Network Partition • If the coordinator and all its participants remain in one partition, the failure has no effect on the commit protocol. • If the coordinator and its participants belong to several partitions: • Sites that are not in the partition containing the coordinator think the coordinator has failed, and execute the protocol to deal with failure of the coordinator. • No harm results, but sites may still have to wait for decision from coordinator. • The coordinator and the sites are in the same partition as the coordinator think that the sites in the other partition have failed, and follow the usual commit protocol. • Again, no harm results
  • 12. Three Phase Commit Protocol • Three-Phase Commit (3PC) Protocol is an extension of the Two-Phase Commit (2PC) Protocol that avoids blocking problem under certain assumptions • In particular, it is assumed that no network partition occurs, and not more than k sites fail, where we assume ‘k’ is predetermined number. • Instead of directly noting the commit decision in its persistent storage, the coordinator first ensures that at least ‘k’ other sites know that it intended to commit transaction.
  • 13. Three Phase Commit Protocol • In a situation where the coordinator fails, the remaining sites are bound to first select new coordinator. • This new coordinator checks status of the protocol from the remaining sites. • If the coordinator had decided to commit, at least one of other ‘k’ sites that it informed will be up and will ensure that commit decision is respected. • The new coordinator restarts third phase of protocol if any of rest sites knew that old coordinator intended to commit transaction. • Otherwise, new coordinator aborts the transaction.
  • 14. Three Phase Commit Protocol