Chapter 23 Data Recovery Flashcards

1
Q

Purpose of Database Recovery

A

To bring the database into the last consistent state which existed prior to the failure. To preserve transaction properties.

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

Types of failure

A

transaction failure
system failure
media failure

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

transaction failure

A

transactions may fail because of incorrect input, deadlock, incorrect synch.

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

System failure

A

System may fail because of addressing error, application error,, operating system fault, RAM failure

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

Media failure

A

Disk head Crash , power disruption

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

Transaction log

A

for recovery from any failure requires value prior to modification (BeFore IMage) and after modification(AFter IMage). these values are stored in a seq file called the transaction log.

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

data update

A

Immediate update
Deffered update
Shadow update
in-place update

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

Immediate Update

A

As soon as a data item is modified in cache, the disk copy is updated

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

Defered update

A

All modified data items in the cache is written either after a transaction ends its execution or after a fixed number of transactions have completed their execution

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

Shadow update

A

the mod. version of a data item doesnt overwrite its disk copy but is written at a separate disk location

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

Data caching

A

data items are stored into the database by the cache manage then written into the disk after modification. flushing is controlled by modified and pin-unpin bits.

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

Pin-unpin bits

A

instructs the OS not to flush the data item.

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

Modified bits

A

Indicates the AFIM of the data item.

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

trans. rollback(UNDO)

A

restore all BFIMS on to disk (Removes the AFIMS)

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

trans rollback(REDO)

A

Restore all AFIMS on to the disk

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

in-place update

A

The disk version of the data item is overwritten by the cache version

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

Checkpointing

A

Time to time (randomly or under some criteria) the database flushes its buffer to database disk to minimize the task of recovery.

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

steps defines a checkpoint operation

A
  1. Suspend execution of transactions temporarily.
  2. Force write modified buffer data to disk.
  3. Write a [checkpoint] record to the log, save the log to disk.
  4. Resume normal transaction execution.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Possible ways for flushing database cache to database disk:

A

Steal/No-Steal and Force/No-Force

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

Steal:

A

Cache can be flushed before transaction commits

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

No-Steal

A

Cache cannot be flushed before transaction commit.

22
Q

Force

A

Cache is immediately flushed (forced) to disk.

23
Q

No-Force

A

: Cache is deferred until transaction commits.

24
Q

four different ways for handling recovery

A

Steal/No-Force (Undo/Redo), Steal/Force (Undo/No-redo), No-Steal/No-Force (Redo/No-undo) and No-Steal/Force (No-undo/No-redo).

25
Q

Deferred Update (No Undo/Redo)

A

The data update goes as follows:
1. A set of transactions records their updates in the log.
2. At commit point under WAL scheme these updates are saved on database disk.
After reboot from a failure the log is used to redo all the transactions affected by this failure. No undo is required because no AFIM is flushed to the disk before a transaction commits.

26
Q

Deferred Update in a single-user system

A

The data update goes as follows:
1. A set of transactions records their updates in the log.
2. At commit point under WAL(write ahead logging) scheme these updates are saved on database disk.
After reboot from a failure the log is used to redo all the transactions affected by this failure. No undo is required because no AFIM is flushed to the disk before a transaction commits.

27
Q

Deferred Update with concurrent users

A

This environment requires some concurrency control mechanism to guarantee isolation property of transactions.
In a system recovery transactions which were recorded in the log after the last checkpoint were redone.
The recovery manager may scan some of the transactions recorded before the checkpoint to get the AFIMs.

28
Q

Deferred Update with concurrent users table types:

A

Two tables are required for implementing this protocol:

Active table: All active transactions are entered in this table.
Commit table: Transactions to be committed are entered in this table.

29
Q

active tables and conc. tables recovery process

A

During recovery, all transactions of the commit table are redone and all transactions of active tables are ignored since none of their AFIMs reached the database.

30
Q

Undo/No-redo Algorithm

A

In this algorithm AFIMs of a transaction are flushed to the database disk under WAL before it commits. For this reason the recovery manager undoes all transactions during recovery. No transaction is redone.

31
Q

Undo/Redo Algorithm (Single-user environment)

A

Recovery schemes of this category apply undo and also redo for recovery. In a single-user environment no concurrency control is required but a log is maintained under WAL.

32
Q

Recovery manager actions in Undo/Redo Algorithm (Single-user environment)

A

The recovery manager performs:

Undo of a transaction if it is in the active table.
Redo of a transaction if it is in the commit table.

33
Q

Undo/Redo Algorithm (Concurrent execution)

A

In concurrent execution environment a concurrency control is required and log is maintained under WAL. Commit table records transactions to be committed and active table records active transactions.

34
Q

Recovery manager actions in Undo/Redo Algorithm (concurrent execution)

A

The recovery performs:

Undo of a transaction if it is in the active table.
Redo of a transaction if it is in the commit table.

35
Q

Shadow Paging

A

The AFIM does not overwrite its BFIM but recorded at another place on the disk. Thus, at any time a data item has AFIM and BFIM (Shadow copy of the data item) at two different places on the disk.

36
Q

ARIES Recovery Algorithm based on

A
  1. WAL (Write Ahead Logging)
  2. Repeating history during redo: ARIES will retrace all actions of the database system prior to the crash to reconstruct the database state when the crash occurred.
  3. Logging changes during undo: It will prevent ARIES from repeating the completed undo operations if a failure occurs during recovery, which causes a restart of the recovery process.
37
Q

ARIES recovery algorithm consists of three steps:

A

Analysis, Redo, Undo

38
Q

Aries Analysis Step

A

step identifies the dirty (updated) pages in the buffer and the set of transactions active at the time of crash.

39
Q

Aries REdo Step

A

necessary redo operations are applied.

40
Q

Aries Undo Step

A

log is scanned backwards and the operations of transactions active at the time of crash are undone in reverse order.

41
Q

Log Record Use

A

A log record is written for (a) data update, (b) transaction commit, (c) transaction abort, (d) undo, and (e) transaction end.

42
Q

Log Sequence Number (LSN)

A

unique number associated with every log, indicates where the log is in the disk

43
Q

A log record stores:

A

Previous LSN of that transaction: It links the log record of each transaction. It is like a back pointer points to the previous record of the same transaction.

Transaction ID

Type of log record.

44
Q

For a write operation a log record also logs

A

Page ID for the page that includes the item

Length of the updated item

Its offset from the beginning of the page

BFIM of the item

AFIM of the item

45
Q

Transaction table

A

Contains an entry for each active transaction, with information such as transaction ID, transaction status and the LSN of the most recent log record for the transaction.

46
Q

Dirty Page table

A

Contains an entry for each dirty page in the buffer, which includes the page ID and the LSN corresponding to the earliest update to that page.

47
Q

Checkpointing Steps

A
  1. Writes a begin_checkpoint record in the log
  2. Writes an end_checkpoint record in the log.
  3. Writes the LSN of the begin_checkpoint record to a special file. This file is accessed in recovery to locate the checkpoint info
48
Q

ARIES Recovery Algorithm Steps

A

Analysis, Redo, Undo phases

49
Q

ARIES Recovery Algorithm Analysis

A

Analysis phase: Start at the begin_checkpoint record and proceed to the end_checkpoint record. Access transaction table and dirty page table are appended to the end of the log.

50
Q

ARIES Recovery Algorithm Redo phase

A

Starts from the point in the log up to where all dirty pages have been flushed, and move forward to the end of the log.

51
Q

ARIES Recovery Algorithm Undo phase

A

Starts from the end of the log and proceeds backward while performing appropriate undo. For each undo it writes a compensating record in the log.