Cs4432 database systems ii
This presentation is the property of its rightful owner.
Sponsored Links
1 / 21

CS4432: Database Systems II PowerPoint PPT Presentation


  • 71 Views
  • Uploaded on
  • Presentation posted in: General

CS4432: Database Systems II. Lecture #19 Database Consistency and Violations?. Professor Elke A. Rundensteiner. Transactions, etc. Crash recovery Ch.8 [17] Concurrency control Ch.9 [18] Transaction processing Ch.10 [19]. All about Project 3. Name. Age. White Green

Download Presentation

CS4432: Database Systems II

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Cs4432 database systems ii

CS4432: Database Systems II

Lecture #19

Database Consistency and Violations?

Professor Elke A. Rundensteiner

recovery


Transactions etc

Transactions, etc.

  • Crash recovery

    Ch.8 [17]

  • Concurrency control

    Ch.9 [18]

  • Transaction processing

    Ch.10 [19]

recovery


All about project 3

All about Project 3.

recovery


Integrity or correctness of data

Name

Age

White

Green

Gray

52

3421

1

Integrity or correctness of data ?

  • We would like data in our database to be “accurate” ( “correct” ) at all times.

    EMP

  • How DBMS decides if data is consistent?

recovery


Integrity or consistency constraints

Integrity or consistency constraints

  • Utilize predicates data must satisfy

  • Examples:

    - x is key of relation R

    - x  y holds in R

    - Domain(x) = {Red, Blue, Green}

    - a is valid index for attribute x of R

    - no employee should make more thantwice the average salary

recovery


Definitions

Definitions:

  • Consistent state: satisfies all constraints

  • Consistent DB: DB in consistent state

recovery


Such constraints may not capture full correctness

Such Constraints may not capture “full correctness”

Example 1 :Transaction constraints

  • When salary is updated,

    new salary > old salary

  • When account record is deleted,

    balance = 0

recovery


Constraints as we use here may not capture full correctness

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

Example 2 Database should reflectreal world

Reality

DB

recovery


In any case continue with constraints

in any case, continue with constraints...

Observation: DB cannot be consistent always

Example:

Constraint : a1 + a2 +…. an = TOT

Action:

Deposit $100 in a2: a2 a2 + 100

TOT  TOT + 100

recovery


Cs4432 database systems ii

Example: a1 + a2 +…. an = TOT (constraint)

Deposit $100 in a2: a2 a2 + 100

TOT  TOT + 100

a2

TOT

.

.

.

.

.

.

50

150

150

.

.

.

.

.

.

1000

1000

1100

recovery


Transaction a collection of actions that preserve consistency

Transaction: a collection of actions that preserve consistency

Consistent DB

Consistent DB’

T

recovery


Big assumption

Big assumption:

If T starts with consistent state

AND

T executes in isolation

 T leaves consistent state

recovery


Correctness informally

Correctness(informally)

  • If we stop running transaction(s),DB left consistent

  • Each transaction sees a consistent DB

recovery


How can constraints be violated

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

recovery


Will not consider

Will not consider:

  • How to write correct transactions

  • How to write correct DBMS system

  • Constraint checking & repair

recovery


How can we prevent fix violations

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

recovery


Chapter 8 17 recovery

Chapter 8 [17]: Recovery

  • First : Failure Model

recovery


Cs4432 database systems ii

Events Desired

Undesired Expected

Unexpected

recovery


Our failure model

Our failure model

processor

memory disk

CPU

D

M

recovery


Cs4432 database systems ii

that’s it!!

Undesired Unexpected: Everything else!

Desired events: see product manuals….

Undesired expected events:

System crash

- memory lost

- cpu halts, resets

recovery


Cs4432 database systems ii

Undesired Unexpected: Everything else!

Examples:

  • Disk data is lost

  • Memory lost without CPU halt

  • CPU implodes wiping out universe….

  • You name it …

recovery


  • Login