Review of Database Software Design

Wednesday, 13 April

Disks

(Chapter 13)

Indexes

Query Execution: scanning and algorithms

(Chapter 15) Number of Block I/O required

Query compiler

(Chapter 16)

Logging and Recovery

(Chapter 17)

Concurrency control - locking, etc. - exam will be limited to locking

Why? A Transaction should, in isolation, maintain the database in a consistent state. Even a read-only transaction should "see" a consistent state. If transactions were executed one at a time (serially) there would be no problems. But concurrency is good, so we need to avoid conflict between transactions.

Locking

The most common method of concurrency control is to have each transaction lock the elements it plans to read or write. A lock manager will either grant the lock request, or delay the transaction until a lock held by another transaction has released it.
Different lock modes

Optimistic methods (not on exam)

  1. Timestamps: Each transaction is given a unique timestamp. It is allowed to run, unless one of two things occurs:
    1. Late read: It attempts to read an element already written by a transaction with a later timestamp. Possibly the database can supply the proper previous value, else it must abort.
    2. Late write: It attempts to write an element already read by a transaction with a later timestamp. In this case it must abort.
  2. Validation: Transactions have a read phase and a write phase. We know the read set(RS) and write set(WS) of each transaction that is concurrently active.
    1. During the read phase they do all their reading and prepare what they want to write
    2. Validation: the transaction is ready to commit, but it must abort if its RS or WS overlaps with the WS of any previously validated recent transaction.
    3. It now does its writing.

Dirty reads, Deadlocks - Ahh, transactions

Lin Jensen