Recovery and Logging Flashcards

1
Q

Caching

A
  • Recently accessed database pages are cached in memory to reduce disk I/O
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Recovery

A
  • Performed after a crash or non-catastrophic failure
  • Need to maintain enough state about transactions to redo or undo them
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Recovery Steps

A
  • Redo changes made by any committed transaction
  • Undo changes made by any transaction that didn’t commit
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Log

A
  • Update records summarizing writes
  • Records for transaction begins
  • Records for transaction commits
  • Append-only
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write-Ahead Logging (WAL)

A
  • Both updated database pages and log records are cached
  • All update log records must be forced to disk before the database page
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Undo-Redo Logging

A
  • Update records must include both the old and new values
  • At commit, write the commit log record to the in-memory log buffer and force to disk all dirty log records
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Undo-Redo Backward Pass

A
  • For each commit record, add the transaction to a commit list
  • For each update by a transaction not on the commit list, undo the update
  • Skip updates on the commit list and all begin records
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Undo-Redo Forward Pass

A
  • For each update by a transaction on the commit list, redo the update
  • Skip updates by transactions not on the commit list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Logical Logging

A
  • When a data element is updated, store the LSN of the updated log record with the data element (datum LSN)
  • Stores the old LSN of the data element in the log record
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Logical Logging Backward Pass

A
  • Undo an update if the transaction did not commit and datum LSN == record LSN
  • If undo, set datum LSN = olsn
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Logical Logging Forward Pass

A
  • Redo an update if the transaction did commit and datum LSN == olsn
  • If redo, set datum LSN = record LSN
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Undo-Only Logging

A
  • Force all dirty log records to disk
  • Force database pages changed by the transaction to disk
  • Write the commit log record
  • Force the commit log record to the disk
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Redo-Only Logging

A
  • Write the commit log record
  • Force all dirty log records to disk
  • Move database pages to disk anytime after this
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Advantages and Disadvantages of Undo-Only Logging

A
  • Smaller logs than undo-redo (+)
  • Simple and quick recovery (+)
  • Forces log and data to disk at commit (wait for I/O) (-)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Advantages and Disadvantages of Redo-Only Logging

A
  • Smaller logs than undo-redo (+)
  • More complex recovery than undo-only, but less than undo-redo (+/-)
  • Must be able to cache all changes until the transaction commits (-)
  • Forces only log records to disk at commit (+)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Advantages and Disadvantages of Undo-Redo Logging

A
  • Larger logs (-)
  • Complex recovery (-)
  • Forces only log records to disk at commit (+)
  • Don’t need to retain all data in cache until commit (+)
17
Q

Checkpoint

A
  • Force data and log records to disk to create a consistent on-disk database state
  • Avoid long recoveries
18
Q

Static Checkpoint

A
  1. Stop the activity and wait for a consistent state
  2. Force dirty log records to disk
  3. Force dirty database pages to disk
  4. Write a checkpoint record to the log
19
Q

Dynamic Checkpoint

A
  1. Prevent all update operations during the checkpoint
  2. Force dirty log records to disk
  3. Force dirty database pages to disk
  4. Write a checkpoint record to the log