Recovery Flashcards

1
Q

What is a roll back?

A

Any writes to disk undone, happens on error.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Possible types of failure

A
  • Logical error: Some form of internal error.
  • System error: Deadlock, bad scheduler etc.
  • System Crash: Power Failure, HW malfunction etc.
  • Disk failure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does atomicity affect recovery?

A

Modifying the database without ensuring that the transaction will commit may leave the database in an inconsistent state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do we ensure atomicity despite failures?

A

We output information describing the modifications to stable storage before modifying the database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What two approaches can be used to store modification to the database in memory?

A
  • Log-based recovery

- Shadow paging

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does log based recovery work?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What two approaches can be used using logs?

A
  • Deferred database modification

- Immediate database modification

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is deferred database modification?

A
  • All modifications recorded in log, but writes deferred until after partial commit
  • Write operation doesn’t include old value.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How does deferred DB modification recover from a crash?

A
  • Transaction only needs to be done if both Ti start> and are in the log.
  • Redo Ti sets value of all data items updated by the transaction to new values.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is immediate database modification?

A
  • Allows updates of uncommitted transactions

- Log record wrote to before DB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How does immediate DB modification recover from failure?

A
  • Redo Ti sets the value of all data items to their new values, going forward from log Ti
  • Undo restores the value of all data update by Ti to their old values, going backward from the last log record for Ti
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What happens when recovering from failure using immediate database modification?

A

Ti needs redone if start and commit in log.

Ti needs undone if start in log with no commit.

Redo done first, undo list populated and done after.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How do checkpoints work?

A

Periodic checkpoints flush records to disk and timestamps. Completed transactions are then removed from the log.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How are checkpoints used during recovery?

A

Only consider log records that hadn’t been completed by time of last checkpoint.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Why is log record buffering used?

A

Output to stable storage in blocks using log force/buffer is full. Reduces I/O cost.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is Shadow Paging?

A

Maintains two page tables during transaction lifetime:

  • Current page table
    Used for data accesses during execution
  • Shadow page table, persisted to storage and not modified
17
Q

What does shadow paging do in execution?

A

Copy page onto unused page, current page table then points to the copy and update copy.

On commit, flush all modified pages to memory and make current page table new shadow page table.

18
Q

How is the current page table made the new shadow page table?

A

Point pointer at fixed disk location to new shadow page table. Transaction is now committed.

19
Q

Benefit of shadow paging?

A

No recovery is needed after crash

20
Q

Drawback of shadow paging?

A

Doesn’t work well with concurrent transactions.

Has to be garbage collected.