1 / 11

CS 603 Distributed Transactions

CS 603 Distributed Transactions. February 18, 2002. What is a Transaction?. A tomic The external view is that either everything in the transaction happened, or nothing did C onsistent If the start state is valid, the end state is valid I solated

oona
Download Presentation

CS 603 Distributed Transactions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 603Distributed Transactions February 18, 2002

  2. What is a Transaction? • Atomic • The external view is that either everything in the transaction happened, or nothing did • Consistent • If the start state is valid, the end state is valid • Isolated • A transaction in process is not affected by and does not affect any other transaction • Durable • Once complete, the effects of a transaction are permanent, even in the event of failure.

  3. Distributed Transactions • What is the difference with Distributed Transactions? • NOTHING! • Must still support ACID properties • Important for all the same reasons • Why do we study Distributed Transactions? • Some properties harder to implement • Basic single-system techniques not sufficient

  4. What is a Distributed Transaction? Data Data Transaction component Transaction component Transaction component Transaction component Data Data

  5. Why are Distributed Transactions Hard? • Atomic • Different parts of a transaction may be at different sites • How do we ensure all or none committed? • Consistent • Failure may affect only part of transaction • Isolated • Commitment must occur “simultaneously” at all sites • Durable • Not much different when other problems solved • Makes “delayed commit” difficult

  6. Key Issues • Commitment • Standard techniques preserve properties when commit occurs • Distributed systems need commit protocols so we know when commit has occurred • Failures • Standard techniques support durability for commit/abort • What happens if a site fails during commitment?

  7. Committing a Distributed Transaction Data Data Transaction component Transaction component log log Transaction component Transaction component log log Data Data

  8. Two-Phase Commit(Lamport ’76, Gray ’79) • Assumes central coordinator • Coordinator initiates protocol • Participants: entities with actions to be committed/aborted • Phase 1: • Coordinator asks if participants can commit • Participants respond yes/no • Phase 2: • If all votes yes, coordinator sends Commit • Otherwise send Abort • Participants send Have Committed / Have Aborted

  9. Two-Phase Commit Data Data Transaction component Transaction component log log CanCommit? CanCommit? Commit Commit Done Done Yes Yes Coordinator Yes Yes Done Done Commit Commit Transaction component Transaction component log log CanCommit? CanCommit? Data Data

  10. Two-Phase Commit:Fault Tolerance • Participant fails in Phase 1: • Coordinator doesn’t get unanimous yes • Abort • Participant fails in Phase 2: • On reawakening, can ask coordinator if it should commit or abort • Requires that both commit and abort states be durable before sending “yes” vote

  11. Two-Phase Commit:Problems • Blocks on failure • Timeout before abort if participant fails • All participants must wait for recovery if coordinator fails • While blocked, transaction must remain Isolated • Hold locks on data items touched • Prevents other transactions from completing • Solution: Wednesday

More Related