446 views
1 1 vote
Consider a simple checkpointing protocol and the following set of operations in the log. (start,T2); (start, T1); (write, T2, y, 4, 7); (write, T1, x, 6, 8); (commit, T2); (commit, T1); (checkpoint); (start, T3); (start, T4); (write, T4, z, 2, 4); (write, T3, z, 5, 7); (commit, T4);

If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents of the undo list and the redo list?

Redo: T3; Undo: T2, T1

Redo: T4; Undo: T3

Redo: T2; Undo: T3

Redo: T3; Undo: T4

 

2 Answers

0 0 votes
To determine the contents of the undo and redo lists in this scenario, we need to analyze the sequence of operations and the state of transactions when the crash occurs. We are working with a simple checkpointing protocol, which means that transactions before the checkpoint that have been committed will not need to be redone or undone, while transactions after the checkpoint must be considered based on their status.

Log of Operations:

1. (start, T2)  
2. (start, T1)  
3. (write, T2, y, 4, 7)  
4. (write, T1, x, 6, 8)  
5. (commit, T2)  
6. (commit, T1)  
7. (checkpoint)  
8. (start, T3)  
9. (start, T4)  
10. (write, T4, z, 2, 4)  
11. (write, T3, z, 5, 7)  
12. (commit, T4)  

The crash occurs after these operations.

Understanding the Lists:
Redo List: This contains transactions that have committed after the last checkpoint. These transactions need to be redone since their effects may not have been written to the stable storage.
Undo List: This contains transactions that are still active (not committed) at the time of the crash. These transactions need to be undone since they may have made some changes that should be rolled back.

Analysis:

Before the checkpoint:
    T2 and T1 both started, wrote changes, and committed before the checkpoint.
    Since both transactions were committed before the checkpoint, neither needs to be redone or undone. Their effects are safe, and they are not part of either list.

After the checkpoint:
    T3 started but has not committed.
    T4 started, wrote changes, and committed.
    Since T4 committed after the checkpoint, it needs to be redone to ensure its changes are applied.
    Since T3 has not committed, it needs to be undone to roll back any changes it made.

Conclusion:

Redo List: Contains T4 because it committed after the checkpoint.
Undo List: Contains T3 because it was active and did not commit before the crash.

Thus, the correct answer is:
Redo: T4
Undo: T3
0 0 votes
the simple trick for this type of question which i follow is to check which transactions are commited before and after the checkpoint the transactions which are commited before the checkpoints are in undo and the transactions with have'nt been commited in whole operation are in redo
Position:
Show:

Related questions

1 1 vote
0 0 answers
1.5k
1.5k views
Chhotu asked Dec 26, 2017
1,526 views
Hi Guys,Please tell following statement is T/F >If there is a schedule which is conflict serializable. But there may not exist any 2 PL with lock upgrade scheme to execu...
1 1 vote
1 1 answer
846
846 views
khushtak asked Jan 22, 2016
846 views
I want to confirm my answers..For 19.2.1a) VIEW equal serial order T1 T2T3 or T2T1T3 b) VIEW equal serial order 6 possible ordersc) 2 VIEW equal serial ordersd) 2 VIEW eq...