60 likes | 159 Vues
This session addendum elaborates on distributed transactions using a practical scenario where client H.C. attempts to book a hotel in NYC for one week and a flight from Paris to NYC. Key concepts include the transaction's lifecycle, with distinct phases for beginning and ending transactions. The importance of the coordinator and participants in maintaining consistency during failures is discussed, along with mechanisms for committing or aborting transactions. The significance of stable storage and handling failed participants are also highlighted.
E N D
Distributed Systems Session 3 Addendum:More on Transactions CSC 253 Gordon Blair, François Taïani
Distributed Transaction:An Example client H C book hotel NYC 1 week book flight Paris-NYC End_Transaction Begin_Transaction option on 1 week available OK Co available option on 1 seat Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction coordinator F participants(servers) G. Blair/ F. Taiani
commit commit yes:Th yes:Tf (a) Commit Succeeds client H C canCommit? doCommit haveCommited yes Co Transaction OK canCommit? yes doCommit haveCommited What was it again? Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction F participants(servers) G. Blair/ F. Taiani
Important Points • Once the coordinator has sent doCommit only a commit is possible • If one of the participants fails: • Transaction is blocked until the participant resumes • Consistency is ensured because of transaction state being saved on stable storage • On resuming the failed participants check its disk to know which transactions to ask the coordinator about • Many details not represented • The coordinator uses stable storage as well against failure • Distributed locking protocol omitted • Typically multiple clients performing transaction at the same time G. Blair/ F. Taiani
abort abort Transaction failed (b) Commit Fails client H C canCommit? abort Co canCommit? yes What was it again? abort Begin_Transactionbook hotel NYC 1 week book flight Paris-NYCEnd_Transaction F yes:Tf participants(servers) G. Blair/ F. Taiani
Important Points • Same basic mechanisms as when everybody agrees • Except here no need to wait for failed servers: • It is the responsibility of the failed servers to catch up • The failed server still need to check with the coordinator • It does not know the outcome of the transaction • The transaction could have succeeded G. Blair/ F. Taiani