Study your flashcards anywhere!

Download the official Cram app for free >

  • Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

How to study your flashcards.

Right/Left arrow keys: Navigate between flashcards.right arrow keyleft arrow key

Up/Down arrow keys: Flip the card between the front and back.down keyup key

H key: Show hint (3rd side).h key

A key: Read text to speech.a key

image

Play button

image

Play button

image

Progress

1/15

Click to flip

15 Cards in this Set

  • Front
  • Back

Transaction

A logical unit of work, a basic unit that either fully succeed or not at all.

ACID?

Atomicity


Consistency


Isolation


Durability

Atomicity

Either all change made by a transaction succeed or none do.

Consistency

The integrity constraints cannot be violated.

Isolation

Transactions run concurrently -> must appear as one at a time.

Durability

After commit the transaction must persist

Start/End

Start: varies by system, can be explicit or any sql statement.



End: typically COMMIT

What happens in case of unsuccessful transaction?

ROLLBACK statement is issued that leads to all effect the transaction had on the database is removed.

Types (reasons) of failures (3)

1. Transaction failure


- Logical error: the transaction has some code error


- System error: the transaction stopped by the dbms (pl deadlock)



2. System (DBMS) failure: blackout



3. Disk failure: physical error

Before and After images (for case 1 and 2)

When the system is brought up from a general system failure, it checks its log file:



- Uncommitted transactions are rolled back to their before image. These modifications are restored in reverse order.



- Committed, but not materialised transactions have to be rolled forward to their after image.

Dealing with disc failure

Regular backups are made, the database is restored to its last commits and after images.

Write -ahead log protocol

Log file always must be physically written before record written or commit statement sent.



Failed transactions can always be rolled back!


Committed transactions can always be rolled forward!

Checkpointing

Only transactions in progress at the time of the last checkpoint and later have need to be considered.


The main memory is physically written out.

Graph

Graph solution