Вы находитесь на странице: 1из 17

Distributed Transaction

Model

Presented by:-
Rohit Srivastava
&
Ashutosh Tripathi
Definition
A distributed transaction is an operation bundle, in which
two or more network hosts are involved.

Transaction should contain 4 ACID properties

1. Atomicity (ability of BBMS to gurantee that all tasks are


performed)
2. Consistency (DBMS remain in consistent state before
and after transaction)
3. Isolation (other operations cannot access data during
transaction)
4. Durability (once transaction is done then it may remain
in persistent state)
System Structure

TC1 TCn Transaction


Coordinator

Transaction
TM1 TMn Manager

Computer 1 Computer n
Responsibilties
Transaction Manager:-
• Managing a log for recovery purpose

• Participating in an appropriate Concurrency

Control to coordinate concurrent execution

Transaction Coordinator:-
• Starting the execution of transaction

• Breaking transaction into subtransactions and

distribute them to sites for execution


• Coordinating the termination of transaction
Commit Protocols
To ensure Atomicity property the
Transaction Cordinator must
execute commit protocols. There
are 2 types of Commit Protocols:-

1. Two Phase Commit protocol


2. Three Phase Commit protocol
Two Phase Commit
It comprises of 3 phases:-

1. Prepare Phase:- The initiating node in the


transaction asks the other participating nodes to
promise to commit or roll back the transaction.

2. Commit Phase:- The initiating node asks all


participating nodes to commit the transaction. If
this outcome is not possible, then all nodes are
asked to roll back.

3. Forget Phase:- The global coordinator forgets


about the transaction.
Types of Responses in the
Prepare Phase
 Prepared:- Data on the node has been
modified by a statement in the distributed
transaction, and the node has successfully
prepared.
 Read-only:- No data on the node has
been, or can be, modified (only queried),
so no preparation is necessary.
 Abort:- The node cannot successfully
prepare.
Steps in the Prepare Phase
 The node requests that its descendants, that is, the
nodes subsequently referenced, prepare to commit.

 The node checks to see whether the transaction


changes data on itself or its descendants. If there is no
change to the data, then the node skips the remaining
steps and returns a read-only response.

 The node allocates the resources it needs to commit


the transaction if data is changed.
Cont…
 The node saves redo records corresponding to
changes made by the transaction to its online
redo log.

 The node guarantees that locks held for the


transaction are able to survive a failure.

 The node responds to the initiating node with a


prepared response or, if its attempt or the
attempt of one of its descendents to prepare was
unsuccessful, with an abort response.
Steps in the Commit Phase

 The global coordinator instructs the


commit point site to commit.

 The commit point site commits.

 The commit point site informs the global


coordinator that it has committed.

 The global and local coordinators send a


message to all nodes instructing them to
commit the transaction.
Cont…
 At each node, Site commits the local portion
of the distributed transaction and releases
locks.

 At each node, Site records an additional redo


entry in the local redo log, indicating that
the transaction has committed.

 The participating nodes notify the global


coordinator that they have committed.
Steps of Forget Phase

 After receiving notice from the global


coordinator that all nodes have
committed, the commit point site erases
status information about this transaction.

 The commit point site informs the global


coordinator that it has erased the status
information.

 The global coordinator erases its own


information about the transaction.
Failures of Two Phase Protocol
 Failure of a participating site

 Failure of a Coordinator

 Network Partition
Recovery and Concurrency Control
 In doubt transactions

 Noting lock information

 Faster Recovery
Three Phase Commit Protocol
 Extension of Two Phase Protocol

 Select new Coordinator

 Property of Non Blocking


Refrences
 Database System Concepts: Henry F.
Korth
 http://stonesoup.esd.ornl.gov/

 http://extremelinux.esd.ornl.gov/

 http://www.beowulf.org/

 http://www.cacr.caltech.edu/researc

h/beowulf/
 http://beowulf-underground.org/
Thank You

Вам также может понравиться