Recovery Past Paper Questions Flashcards

1
Q

(b) Explain (with examples) why log records for transactions on the undo-list must be processed in reverse order, whereas redo is performed in a forward direction. [5 marks]

A

Undo Needs to Revert the Most Recent State First: By undoing the most recent changes first, the database is reverted to its prior state step-by-step, avoiding any inconsistencies that might arise from dependency relations among the database actions.
Example: if a transaction first added money to one account (action A) and then transferred some of that money to another account (action B), reversing them from last to first (B then A) prevents errors like overdrafts.
Redo Needs to Rebuild the State Forward: Redoing from the start of the transaction to its end ensures that all the actions are applied in the precise sequence they were intended, maintaining logical and data integrity.
Example: X=X+200 and Y=Y-200. If these actions were committed but the system crashed before they were fully persisted on disk, the recovery process must ensure the database reflects these changes.

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

(c) Differentiate between Starvation and Deadlock [4 Marks]

A

In a system where the selection of victims is based primarily on cost
factors, it may happen that the same transaction is always picked as a victim. As a result, this transaction never completes its designated task, thus there is starvation.

Deadlock occurs when two or more transactions are unable to proceed because each is waiting for the other to release a resource that it needs to continue execution.

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

(d) Explain the distinction between Serializable schedule and Serial schedule. [4 marks]

A

A serializable schedule allows transactions to execute concurrently while still producing the same outcome as if they had executed in some serial order.
A serial schedule executes transactions sequentially, with one transaction completing before the next begins.

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

(e) Explain the purpose of the checkpoint mechanism. [4 marks]

A
  1. Checkpoints streamline recovery processes by providing reference points in the transaction log.
  2. They minimize recovery time by identifying which transactions need redo or undo operations after a crash.
  3. Checkpoints reduce system overhead by preventing unnecessary redo operations for transactions already written to the database.
  4. They enhance system reliability by facilitating quick identification of active transactions at the time of a crash
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How often should checkpoints be performed If there is no systems failure? Explain your answer
[3 marks

A

Checkpoints should be taken frequently (say, several times an hour). Generally, checkpoints should be frequent enough to minimize recovery time in case of failure but not too frequent to avoid excessive overhead during normal operation.

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

How does the frequency of checkpoints affect the time it takes to recover from a system crash?

A

If checkpoints are infrequent, the system will have to process a larger segment of the transaction log to identify affected transactions during recovery. This means it will take more time to sift through the log, identify transaction states, and perform the necessary redo and undo operations.

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

How does the frequency of checkpoints affect the time it takes to recover from a disk crash?

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

How does the frequency of checkpoints affect system performance when no failure occurs?

A

More frequent checkpoints can lead to increased overhead due to the interruption of regular transaction processing for checkpoint operations. This interruption can result in decreased throughput and longer response times for user transactions.

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

Differentiate between Differed DB and Immediate DB modification

A

Deferred: Transaction operations do not immediately update the database. Instead all changes are written to the transaction log. The database is updated only after the transaction reaches its commit point.

Immediate: The database is immediately updated by transaction operations during the transaction’s execution, even before it reaches its commit point. The transaction log is updated prior to writing to the database files.

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