Log In
0 votes
In crash recovery in the checkpoint mechanism. Till the last checkpoint for all committed transactions redo will be done and all uncommited transactions undo is done. Can anyone explain what is the reason behind it ?
in Databases
retagged by

1 Answer

3 votes
Best answer

generally our database kept on secondary storage ( our assumption is Secondary storage never crash )

Check points means till that point everything written into the disk !

Note transaction completes means either committed or aborted !

Before the check point may some of the transactions completed, some of the transactions were not completed !

Checkpoints have a List which contains every transaction which is not completed at that point.

after the checkpoints, either a transactions starts, read, modify, committed or aborted or nothing specified , we just write into the LOG, and carried out the effects into the secondary storage.

Now, let crash is happens, ==> our main memory crashes, ( Note that LOG is also kept on secondary storage, so LOG never lost ! )

therefore we need to restore our Database back to the original consistent position.

in this case you can go upto the Checkpoint and restore it back, But note that after checkpoints some of the transactions are completed, and some of the not completed transactions is still running. and some of transactions are newly started and completed !

those non-completed transactions executes partially ==> for getting consistent state, we have to revert every operation of those transaction, So we keep those transactions in UNDO list.

those completed transactions, we have to keep their update effect into the database. ==> for getting consistent state we need to REDO the operations of the transactions, So we keep those transactions in REDO list.

Some people think why we have to keep REDO list, actually we follow buffer system to update the database, i mean when buffer full, then only those operations carried out into the Secondary storage, So before Buffer full may crash happens, So safe side we will keep REDO list.


Practice :-

(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);


(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3); (write, T3, z, 7, 2); 

Before Checkpoint T$_4$  committed, So don't worry about it !

Check point have the list, which contains only T$_1$ due to only T$_1$ is activated at that time.

after check point, T$_2$ started and completed ===> keep it in REDO list

after check point, T$_3$ started but not completed ===> keep it in UNDO list

in the list of CHECK Point, take each transaction and

if that Transactions is completed add it into REDO list.

if that Transactions is not completed add it into UNDO list. ===> T$_1$ is in UNDO list.


Note that First we have do UNDO list ==> system back to some consistence state then we have to do REDO list.

REDO list should preserve the order. I mean after check point if T$_i$ completed first, after that T$_j$ completed, then while recovery you have to do first T$_i$ after that T$_j$.

still you have doubts :-

selected by

Related questions

0 votes
0 answers
Are they in the syllabus? I believe not since nothing is specified in the syllabus but I've seen questions in made easy test series regarding undo and redo list. $(Start, T_4); (Write,T_4,y,2,3); (Start,T_1);(Commit,T_4);(Write,T_1,z,5,7)\\ (Checkpoint)\\ (Start,T_2);(Write,T_2,x,1,9);(Commit,T_2);(Start,T_3);(Write,T_3,z,7,2);\\ (Crash)$ Give contents of Undo and Redo list.
asked Dec 8, 2017 in Databases Tuhin Dutta 602 views
0 votes
1 answer
How can 2PL protocol ( simple one ) ensure conflict serializability even though it cannot ensure freedom from deadlock ? I mean ,if a schedule is conflict serializable it has a conflict equivalent to a serial schedule and serial schedules won't have deadlocks .Right ?
asked Mar 30, 2019 in Databases ashunimbz 194 views
1 vote
0 answers
Is different 2 phase locking a subset of each other? For example, if the schedule is Strict 2PL then it will also be simple 2PL. Something like a 2PL is a subset of Strict 2PL is a subset of rigorous 2PL.
asked Jan 18, 2019 in Databases vinay chauhan 147 views
0 votes
1 answer
Is the following schedule conflict serializable T1 T2 T3 W(X) commit R(X) W(X) R(X) W(X) commit W(X) commit
asked Jan 16, 2019 in Databases jatin khachane 1 403 views