Database Recovery Techniques: Checkpointing, Logging, and Non-quiescent Checkpoints, Slides of Database Management Systems (DBMS)

Various database recovery techniques including checkpointing, undo/redo logging, and non-quiescent checkpoints. It covers the process of recovery after a crash, the key drawbacks of each technique, and real-world examples. The document also explains how to handle media failure and the importance of consistency in data.

Typology: Slides

2012/2013

Uploaded on 04/26/2013

duurga
duurga 🇮🇳

4.6

(25)

121 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Failure Recovery
Checkpointing
Undo/Redo Logging
1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Database Recovery Techniques: Checkpointing, Logging, and Non-quiescent Checkpoints and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

Failure Recovery

Checkpointing

Undo/Redo Logging

Recovery is very, very SLOW!

Redo log:

First T1 wrote A,B Last Record Committed a year ago Record (1 year ago) --> STILL, Need to redo after crash!!

2

Crash

Example: what to do at recovery?

Redo log (disk):

4

<T1,A,16> <T1,commit>

Checkpoint <T2,B,17> <T2,commit>

<T3,C,21>

Crash ... ... ... ... ... ...

Start from last checkpoint and move forward in the log file redoing updates for committed transactions.

Key drawbacks:

  • Undo logging: data must be written to disk

immediately after a transaction finishes,

which can increase number of disk I/O's

  • Redo logging: need to keep all modified

blocks in memory until transaction commits

and log is flushed, which can increase the

number of buffers required

Rules

  • Buffer containing X can be flushed to disk

either before or after T commits

  • Log record must be flushed to disk before

corresponding updated buffer is (WAL)

Recovery with Undo/Redo Logging

1. Redo all committed transactions in order from

earliest to latest

 handles committed transactions with some changes not yet on disk

2. Undo all incomplete transactions in order from

latest to earliest

 handles uncommitted transactions with some chnages already on disk

Non-quiescent Checkpoint for

Undo/Redo

  • write "start checkpoint" listing all active transactions

to log

  • flush log to disk
  • write to disk all dirty buffers (contain a changed DB

element), whether or not transaction has committed

  • this implies some log records may need to be written to disk (WAL)
  • write "end checkpoint" to log
  • flush log to disk

Non-quiescent checkpoint for undo/redo

L

O

G

for

undo dirty buffer

pool pages

flushed

11

start ckpt active T's: T1,T2,...

end ckpt

Examples what to do at recovery time?

no T1 commit

L

O

G

13

T 1 ,-

a ...^

Ckpt T 1 ...^

Ckpt end ...^

T 1 -

... b

 Undo T 1 (undo a,b)

Example

L

O

G

14

... T^1

a

... ... T^1

b

... ... T^1

c

... T^1

cmt

ckpt- ... end

ckpt-s T 1

 Redo T1: (redo b,c)

Solution

(1) execute real-world actions after commit

(2) try to make idempotent

Media failure (loss of non-volatile storage)

17

A: 16

Solution: Make copies of data!

Example 2 Redundant writes, Single reads

  • Keep N copies on separate disks
  • Output(X) --> N outputs
  • Input(X) --> Input one copy
    • if ok, done
    • else try another one

 Assumes bad data can be detected

Example 3: DB Dump + Log

20

backup database

active database log

  • If active database is lost,
    • restore active database from backup
    • bring up-to-date using redo entries in log