{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Notes08 - PART II CS 245 Database System Principles Notes...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 245 Notes 08 1 CS 245: Database System Principles Notes 08: Failure Recovery Hector Garcia-Molina CS 245 Notes 08 2 PART II Crash recovery (2 lectures) Ch.17[17] Concurrency control (3 lectures) Ch.18[18] Transaction processing (2 lects) Ch.19[19] Information integration (1 lect) Ch.20[21,22] CS 245 Notes 08 3 Integrity or correctness of data • Would like data to be “accurate” or “correct” at all times EMP Name White Green Gray Age 52 3421 1 CS 245 Notes 08 4 Integrity or consistency constraints • Predicates data must satisfy • Examples: - x is key of relation R - x y holds in R - Domain(x) = {Red, Blue, Green}   is valid index for attribute x of R - no employee should make more than twice the average salary CS 245 Notes 08 5 Definition: • Consistent state: satisfies all constraints • Consistent DB: DB in consistent state CS 245 Notes 08 6 Constraints ( as we use here) may not capture “full correctness” Example 1 Transaction constraints • When salary is updated, new salary > old salary • When account record is deleted, balance = 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 CS 245 Notes 08 7 Note: could be “emulated” by simple constraints, e.g., account Acct # …. balance deleted? CS 245 Notes 08 8 Example 2 Database should reflect real world DB Reality Constraints ( as we use here) may not capture “full correctness” CS 245 Notes 08 9 in any case, continue with constraints... Observation: DB cannot be consistent always! Example: a 1 + a 2 +…. a n = TOT ( constraint ) Deposit $100 in a 2 : a 2 a 2 + 100 TOT TOT + 100 CS 245 Notes 08 10 a 2 TOT . . 50 . . 1000 . . 150 . . 1000 . . 150 . . 1100 Example: a 1 + a 2 +…. a n = TOT ( constraint ) Deposit $100 in a 2 : a 2 a 2 + 100 TOT TOT + 100 CS 245 Notes 08 11 Transaction: collection of actions that preserve consistency Consistent DB Consistent DB’ T CS 245 Notes 08 12 Big assumption: If T starts with consistent state + T executes in isolation T leaves consistent state
Background image of page 2
3 CS 245 Notes 08 13 Correctness (informally) • If we stop running transactions, DB left consistent • Each transaction sees a consistent DB CS 245 Notes 08 14 How can constraints be violated? • Transaction bug • DBMS bug • Hardware failure e.g., disk crash alters balance of account • Data sharing e.g.: T1: give 10% raise to programmers T2: change programmers systems analysts CS 245 Notes 08 15 How can we prevent/fix violations? • Chapter 8[17]: due to failures only • Chapter 9[18]: due to data sharing only • Chapter 10[19]: due to failures and sharing CS 245 Notes 08 16 Will not consider: • How to write correct transactions • How to write correct DBMS • Constraint checking & repair That is, solutions studied here do not need to know constraints CS 245 Notes 08 17 Chapter 8[17]: Recovery • First order of business: Failure Model CS 245 Notes 08 18 Events Desired Undesired Expected Unexpected
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 CS 245 Notes 08 19 Our failure model processor memory disk CPU M D CS 245 Notes 08 20 Desired events: see product manuals….
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}