Notes08 - CS 245: Database System Principles Notes 08:...

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

View Full Document Right Arrow Icon
CS 245 Notes 08 1 CS 245: Database System Principles Notes 08: Failure Recovery Steven Whang CS 245 Notes 08 2 PART II • Crash recovery (1 lectures) Ch.17[17] • Concurrency control (2 lectures) Ch.18[18] • Transaction processing (1 lect) Ch.19[19] • Information integration (1 lect) Ch.20[21,22] • Entity resolution (1 lect) 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 DocumentRight Arrow Icon
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
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 17[17]: due to failures only
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

Notes08 - CS 245: Database System Principles Notes 08:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online