0% found this document useful (0 votes)
9 views12 pages

Unit 3 GRP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views12 pages

Unit 3 GRP

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

1

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.

Logical error:- Transaction cannot complete dice to some Internal error


condition Such as: # Bad Input, data Not found, overflow

System error:- Transaction cannot complete due to error condition such as


deadlock.

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.

Stable Storage Implementation


By Definition, Information store in Stable storage is Never Lost.
To Achieve such storage, we need to Replicate (Replace) the Needed information
in Different non-volatile storage media.
Maintain multiple copy of each Block in separate disks
# copies can be at remote site to Protect From. Disaster i.e. fire, Flooding.
Failure during Data transfer can still result Inconsist copies:
Lock Transfer Result:
(1) Successful completion.
(2) Partial Failure:- Destination BLOCK has incorrect information
(3) Total Failure:- Destination Block was Never Updated.
3

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)

Physical BLOCK:- A Block Residing on the disk.


Buffer BLOCK:- A BLOCK temporarily residing (present) in main memory
Block movement B/W Disk & memory.
Input(B): Transfer Physical Block B to main memory.
Output (B):- Transfer Buffer Block B to the disk. And Replace a suitable Block
there.
Each Transaction Ti has its private work which local copy of all data Item
accessed.
 Ti’s local copy of data item X is called xi

Transaction transfer data Item:-


Read (x) assign the value of data Item X to the local variable xi
Write (x) assign the value of variable xi to data item X in the buffer Block.
Transactions :- Must perform read(x) before accessing X For 1st write(x) can
be executed at any time. Before commit time.
5

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 Based Recovery Technique


Log→ The log is a sequence of Records. (List of Records) Log of each
transaction is stored in some Stable Storage so that if any failure occur, then It
Can be recovered from there.
# If any operation is performed on the database, then It will be recorded in the
log.
# It is Important to store log Before the actual operation performed on the
database.

Log Formats:-
An update log record represented as:
6

< Ti, xi, V1, V2>


Where Ti = transaction.
Xi= Data
V1=old data
V2 New value.

Transaction Identifier:
It is a unique Identifier of the transaction that performed the write operation

Data item: It uniquely identifies data.

OLD Value:- It is the value of data item Before writing.


New value:- It is value of data Item After written.
Some other log record are
<Ti Start >: It Contain Information when transaction Ti Starts.
<Ti Commit> : it contain information when a Transaction Ti commits
<Ti abort>: It contain information when a Transaction Ti aborts.
In Recovery method, we use two operations:-
(1) UNDO
(2) Redo

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.

Immediate :- In this a database is & Modified immediately after every


operation. It follows the actual database modification.

Recovery using Log records:-


When the system is crashed, then the system Consults the day to Find which
transactions. Need to be undone and which is Need to be Redone.
(i) If Log contains the Record < Ti Start > and <Ti, commit> or <Ti, commit>
, then the transaction Ti needs to be Redone.

(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

Logical undo Logging


Logging and Check Point will work In Normal type of executions effectively
But when Records are inserted and deleted in a B+ tree Form.
B+ tree Structure Release the Lock early. Those Record will be locked by other
transactions In tree as soon as they Released.
So Physical undo is Impossible (Rolling Back)
So we need a different technique to undo these type of Insertion or deletion.
So we Need Logical Undo Techniques
In physical undo method It will see the logs for previous values or commit, the
Record value will be updated to old value
But in Logical Undo method, a Separate Undo File is created along with boy File.

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.

# When the File Reaches the Checkpoint, the transaction Status is


Updated and tell that point entire log file will be removed From File.
# we can have more than one Checkpoint in transaction These are
given a Name so it’s easier to Identify the particular Point in the
transaction
A checkpoint represent a point till which all transactions are
completed and database is in consistent state
10

Recovery using checkpoint

 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

Remote Backup system

 Remote Backup system Provides a security In Case of the primary location


where database is stored is destroyed.
 Remote Backup can be offline or Real time online.
 In case It is offline It is updated/maintend manually
 Online Backup system are more real time and very useful For database
administrator and investor.
 An online Backup system is a process where every Bit of the Real time
data is Backed up Simultaneously at two different place
 One of them is directly connected to the system and other is kept at a
remote place as Backup.
As soon As Primary database storage falls. The Backup system detect the failure
and switches the user system to the Remote storage.

It is sometime also called the secondary site.

Issue during designing


1. Detection of failure.
2. Transfer of Control.
3. Time to Recover.
4. Time to commit
12

You might also like