Unit 3 GRP
Unit 3 GRP
Failure Type
DBMS is Highly complex system with Hundred of Transaction being executed
every second. The Durability of DBMS depend on Its complex Architecture and
Its Hardware and software. Some time Its. Fail/Crash.
It means system can not continue with Its execution or some Information may
be lost.
Type:-
1. Transaction Failure.
2. System Crash.
3. DISK Failure.
4. Transaction Failure
A Failure in transaction occur when the transaction is unable to execute.
The Reason for transaction Failure are:
(1) Logical error. (2) system error.
System Failure:- System Failure can occur due to Power failure or other
Hardware and software failure. e.g- o.s. error.
Fail-Stop Assumption: - It is assumed that system Clash does not have any
effect on the data stored in Non-volatile storage. This is known as Fall stop
assumption.
DISK Failure:- DISK Failure occurs due to Frequent Failure of Hard disk and
storage Drives.
Few Reasons for disk Failure are:
1. Head crash.
2. Damaged sector Formation.
3. Destruction of the disk.
2
Storage Structure
Storage structure is the memory structure In the system. It has mainly two
Categories:
1. volatile storage.
2. Non-volatile storage.
3. Stable storage
#volatiale storage:
It does Not survive system crashes e.g. Main memory, cache memory.
# Non-volatile storage:
It survives system crash. e.g.- disk, tape, flash memory.
But may be still Fall, losing data.
# stable storage:-
It is a mythical Form of Storage that Survives all Failures.
Approximated by maintaining multiple copies on distinct Non-volatile Media.
This is Because in case of crash and data Loss, data Can recovered From other
copies.
Outcome of DISK
Successful Completion
Partial Failure
Total Failure
If data transfer failure occur, then. Solution is (one solution)
Execute output operation as follows (assume two copies of each Block
(1) Write the information onto the First Physical Block.
(2) when the 1st write successfully completes, write Same operation
(Information) onto 2nd Physical BLOCK.
(3) The output Is completed. When Both operation are Successfully
completed.
Copies of a Block may be different due to failure during output operation (data
transfer)
To Recover From Failure.
(i) Find inconsistent Blocks:
# compare the two copies of every DISK Block (expensive,
(ii) Recover :-
(A) If either copy of an in constant Block is detected to have error, overwrite
it by other copy
(B) If Both have No error, But different, over write. The second Block by First
Block.
4
Data access
Database System are divided into Fixed length.
Storage units Called Blocks.
Blocks are the unit of transfer b/w memory and disk.
Input(B)
memory
disk
Output(B)
Recovery technique
Database Recovery is the process of restoring the database to a
correct/consistent state the event of Failure In
Recovery process ensures the atomicity and durability Properties of transaction.
Log Formats:-
An update log record represented as:
6
Transaction Identifier:
It is a unique Identifier of the transaction that performed the write operation
UNDO:- Restores the old value of each item in Ti that have been updated by
Transaction Ti
Redo:- Updates all Data item updated by Transaction Ti with their New values.
The Database can be modified by using two approaches:-
1. Deferred Database modification
2. Immediate database modification.
7
Deferred:- All logs are written on to Stable storage and database is updated
when a transaction commits.
(ii)If log contains record < Ti, start > But does Not contain the Record either <Ti,
commit > or < Ti abort> then transaction Ti Need to be undone
Advantage:-
Durability.
Faster Recovery
Lower Risk of Data Corruption.
DISADVANTAGE:-
Time Consuming.
Storage space.
Complexity
Additional overhead.
8
In this technique
In undo file for my insertion operation There is deletion operation also will be
Mentioned (exist) to Roll Back.
Similarly for each deletion operation Insertion operation will be described.
This method is called as Logical undo logging.
For example.
Suppose transaction T1 is adding x=x+5 then physical logging method will Show
It <T1, X1, 10, 15>
This indicates x value changes From 10 to 15 In Case of Failure, we know what is
pervious value of x was and we can easily undo x to 10. But It will Not work in
case al B+ trees.
In B+ tree A separate logical undo file is created where we will maintain Undo
For X=X+5 as X = X-5.
Redo For the transaction file can be done by following the low file-Physical log
9
Check Point
To Recover the database From Failure. We must use Log Record
to determine which transaction Need to be undone and Redone.
For this we need to search entire long So the search Process Is
time consuming.
And most of transaction already written there value (Update)
into database.
So to Reduce these problem we introduce check -Points.
Checkpoints:-
It is a process that save the current State of database to disk. This
allows the Faster Recovery in event of a System failure of crash.
# Check Points is like a Book marks in the transaction that helps us
rollback a transaction. From a certain point
# when the execution of transaction takes Place. After the execution,
It create a log File.
The Log File are read From end to start (e. T4 to T1)
Recovery system maintain two List Redo List & undo-List
The transaction is put into if system sees a log with. <Tn Start> and < Tn,
commit> or JUST < To commit > Here all transaction are deleted and
redone Before saving log.
If Recovery system system Find a log entry with <Tn , Start> But No entry
with <Tn, commit > or <Tn, abort > It puts in undo List
In example (diagram) → T2 and T3 have < Tn Start > and <Tn Commit>
The T1 Transaction will only <Tn , commit in log File. That’s why the transaction
is Committed After Checkpoint crossed.
Hence T1, T2 and T3 are into Redo List.
In above T4 has <Tn, Start > Here T4 get added to undo List because It is
Incomplete.
Advantage
Very low overhead.
increase data Recovery process
DISADVANTAGE:-
It can only used for Logical error (Human error)
11