CS411 - Transaction Management - Note 1 - 2

When a transaction which does any write finishes it

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ugh that transaction never executed at all Correctness of Transactions (1 of 12) Transaction Management (12 of 61) - Situation: Suppose you are at ATM and get money back through several steps. If there is something wrong within those steps, should it go back so that everything doesn’t happen (you take money away but the balance is still unchanged) or should it go forward to the end of everything that have happened (the balance is changed but you haven’t get your money)? - If a transaction fails, it should either execute fully (commits) or go back to the original state (rollback/abort) A Typical Transaction • User view: “ Transfer money from savings to checking” • Program: • • • • • read savings; verify balance is adequate; update savings balance; read checking; update checking balance; Correctness of Transactions (2 of 12) Transaction Management (13 of 61) "Commit" and "Abort" • A transactions which only READs expects DB to be consistent, and cannot cause it to become otherwise. • When a transaction which does any WRITE finishes, it must either • COMMIT: "I'm done and the DB is consistent again" OR • ABORT (ROLLBACK): "I'm done but I goofed: my changes must be undone." Correctness of Transactions (3 of 12) Transaction Management (14 of 61) Complications • A DB may have many simultaneous users • simultaneous users implies simultaneous transactions implies simultaneous DB access • multiprogramming/multiprocessing • Things can go wrong! • transactions can conflict with one another • programs may crash, OS may crash, disk may crash • company loses customer, gets sued, goes bankrupt, etc. Correctness of Transactions (4 of 12) Transaction Management (15 of 61) But DB Must Not Crash • Can't be allowed to become inconsistent • A DB that's 1% inaccurate is 100% unusable. • Can't lose data • Can't become unavailable Can you name information processing systems that are more error tolerant? Situation: Suppose you and your brother Alex and you deposit $100. However, Alex is hungry. So he takes this $100 out. If you change your mind that you don’t want to deposit money any more, It can’t roll back because Alex has already taken this $100 out. So, we need...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online