Wednesday, December 2, 2020

Types of Schedules based Recoverability in DBMS

Generally, there are three types of schedule given as follows:

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

1. Recoverable Schedule –


A schedule is said to be recoverable if it is recoverable as name suggest. Only reads are allowed before write operation on same data. Only reads (Ti->Tj) is permissible.

Example –

S1: R1(x), W1(x), R2(x), R1(y), R2(y), 
         W2(x), W1(y), C1, C2; 

Given schedule follows order of Ti->Tj => C1->C2. Transaction T1 is executed before T2 hence there is no chances of conflict occur. R1(x) appears before W1(x) and transaction T1 is committed before T2 i.e. completion of first transaction performed first update on data item x, hence given schedule is recoverable.

Lets see example of unrecoverable schedule to clear the concept more:

S2: R1(x), R2(x), R1(z), R3(x), R3(y), W1(x), 
       W3(y), R2(y), W2(z), W2(y), C1, C2, C3; 

Ti->Tj => C2->C3 but W3(y) executed before W2(y) which leads to conflicts thus it must be committed before T2 transaction. So given schedule is unrecoverable. if Ti->Tj => C3->C2 is given in schedule then it will become recoverable schedule.

Note: A committed transaction should never be rollback. It means that reading value from uncommitted transaction and commit it will enter the current transaction into inconsistent or unrecoverable state this is called Dirty Read problem.

Example:

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

2. Cascadeless Schedule –


When no read or write-write occurs before execution of transaction then corresponding schedule is called cascadeless schedule.

Example –

S3: R1(x), R2(z), R3(x), R1(z), R2(y), R3(y), W1(x), C1, 
         W2(z), W3(y), W2(y), C3, C2; 

In this schedule W3(y) and W2(y) overwrite conflicts and there is no read, therefore given schedule is cascadeless schedule.

Special Case –

A committed transaction desired to abort. As given below all the transactions are reading committed data hence it’s cascadeless schedule.

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

3. Strict Schedule –


if schedule contains no read or write before commit then it is known as strict schedule. Strict schedule is strict in nature.

Example –

S4: R1(x), R2(x), R1(z), R3(x), R3(y), 
        W1(x), C1, W3(y), C3, R2(y), W2(z), W2(y), C2; 

In this schedule no read-write or write-write conflict arises before commit hence its strict schedule:

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

4. Cascading Abort –


Cascading Abort can also be rollback. If transaction T1 abort as T2 read data that written by T1 which is not committed. Hence it’s cascading rollback.

Example:

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

Corelation between Strict, Cascadeless and Recoverable schedule:

Oracle Database Tutorial and Material, Oracle Database Certification, Oracle Database Exam Prep, DB Prep, Database Study Material

From above figure:

1. Strict schedules are all recoverable and cascadeless schedules
2. All cascadeless schedules are recoverable

Related Posts

0 comments:

Post a Comment