Docsity

Failure Recovery: Undo and Redo Logging for Database Consistency, Slides of Database Management Systems (DBMS)

Partial preview of the text

Download Failure Recovery: Undo and Redo Logging for Database Consistency and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Failure Recovery

Introduction Undo Logging Redo Logging

Integrity or correctness of data

  • Would like data to be “accurate” or “correct” at all times

EMP

2

Name White Green Gray

Age 52 3421 1

Definition:

  • Consistent state: satisfies all constraints
  • Consistent DB: DB in consistent state

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

Constraints ( as we use here) may not capture “full correctness”

Example 2 Database should reflect real world

7

DB

Reality

in any case, continue with constraints...

Observation: DB cannot be consistent always! Example: a 1 + a 2 +…. an = TOT ( constraint ) Deposit $100 in a 2 : a 2 ← a 2 + 100 TOT ← TOT + 100

Transaction: collection of actions that preserve consistency

10

Consistent DB T Consistent DB’

Big assumption:

If T starts with consistent state + T executes in isolation ⇒ T leaves consistent state

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

How can we prevent/fix violations?

  • Chapter 17: due to failures only
  • Chapter 18: due to data sharing only
  • Chapter 19: due to failures and sharing

Chapter 17: Recovery

  • First order of business: Failure Model

Events Desired

Undesired Expected Unexpected

Desired events: see product manuals….

Undesired expected events: System crash

  • memory lost
  • cpu halts, resets

19

Undesired Unexpected: Everything else!

that’s it!!

Examples:

  • Disk data is lost
  • Memory lost without CPU halt
  • CPU implodes wiping out universe….

20

Undesired Unexpected: Everything else!