Upload
rts090185
View
236
Download
0
Embed Size (px)
Citation preview
8/14/2019 Distributed Transaction Model
1/17
Distributed TransactionDistributed Transaction
ModelModel
Presented by:-Presented by:-Rohit SrivastavaRohit Srivastava
&&
Ashutosh TripathiAshutosh Tripathi
8/14/2019 Distributed Transaction Model
2/17
DefinitionDefinition
AA distributed transactiondistributed transaction is an operation bundle, in whichis an operation bundle, in whichtwo or more network hosts are involved.two or more network hosts are involved.
Transaction should contain 4 ACID propertiesTransaction should contain 4 ACID properties
1.1. AtomicityAtomicity (ability of BBMS to gurantee that all tasks are(ability of BBMS to gurantee that all tasks areperformed)performed)
2.2. ConsistencyConsistency (DBMS remain in consistent state before(DBMS remain in consistent state beforeand after transaction)and after transaction)
3.3. IsolationIsolation (other operations cannot access data during(other operations cannot access data duringtransaction)transaction)
4.4. DurabilityDurability (once transaction is done then it may remain(once transaction is done then it may remainin persistent state)in persistent state)
8/14/2019 Distributed Transaction Model
3/17
System StructureSystem Structure
TM1
TMn
TCnTC1 TransactionCoordinator
Transaction
Manager
Computer 1 Computer n
8/14/2019 Distributed Transaction Model
4/17
ResponsibiltiesResponsibilties
Transaction Manager:-Transaction Manager:- Managing a log for recovery purposeManaging a log for recovery purpose Participating in an appropriate ConcurrencyParticipating in an appropriate Concurrency
Control to coordinate concurrent executionControl to coordinate concurrent execution
Transaction Coordinator:-Transaction Coordinator:- Starting the execution of transactionStarting the execution of transaction Breaking transaction into subtransactions andBreaking transaction into subtransactions and
distribute them to sites for executiondistribute them to sites for execution Coordinating the termination of transactionCoordinating the termination of transaction
8/14/2019 Distributed Transaction Model
5/17
Commit ProtocolsCommit Protocols
To ensure Atomicity property theTo ensure Atomicity property the
Transaction Cordinator mustTransaction Cordinator must
execute commit protocols. Thereexecute commit protocols. There
are 2 types of Commit Protocols:-are 2 types of Commit Protocols:-
1.1. Two Phase Commit protocolTwo Phase Commit protocol
2.2. Three Phase Commit protocolThree Phase Commit protocol
8/14/2019 Distributed Transaction Model
6/17
Two Phase CommitTwo Phase Commit
It comprises of 3 phases:-It comprises of 3 phases:-
1.1. Prepare PhasePrepare Phase:- The initiating node in the:- The initiating node in thetransaction asks the other participating nodes totransaction asks the other participating nodes topromise to commit or roll back the transaction.promise to commit or roll back the transaction.
2.2. Commit PhaseCommit Phase:- The initiating node asks all:- The initiating node asks allparticipating nodes to commit the transaction. Ifparticipating nodes to commit the transaction. Ifthis outcome is not possible, then all nodes arethis outcome is not possible, then all nodes areasked to roll back.asked to roll back.
3.3. Forget PhaseForget Phase:- The global coordinator forgets:- The global coordinator forgetsabout the transaction.about the transaction.
8/14/2019 Distributed Transaction Model
7/17
Types of Responses in theTypes of Responses in the
Prepare PhasePrepare Phase
PreparedPrepared:- Data on the node has been:- Data on the node has been
modified by a statement in the distributedmodified by a statement in the distributed
transaction, and the node has successfullytransaction, and the node has successfully
prepared.prepared. Read-onlyRead-only:- No data on the node has:- No data on the node has
been, or can be, modified (only queried),been, or can be, modified (only queried),
so no preparation is necessary.so no preparation is necessary.
AbortAbort:- The node cannot successfully:- The node cannot successfully
prepare.prepare.
8/14/2019 Distributed Transaction Model
8/17
Steps in the Prepare PhaseSteps in the Prepare Phase
The node requests that itsThe node requests that its descendantsdescendants, that is, the, that is, thenodes subsequently referenced, prepare to commit.nodes subsequently referenced, prepare to commit.
The node checks to see whether the transactionThe node checks to see whether the transactionchanges data on itself or its descendants. If there is nochanges data on itself or its descendants. If there is no
change to the data, then the node skips the remainingchange to the data, then the node skips the remainingsteps and returns a read-only response.steps and returns a read-only response.
The node allocates the resources it needs to commitThe node allocates the resources it needs to committhe transaction if data is changed.the transaction if data is changed.
8/14/2019 Distributed Transaction Model
9/17
ContCont
The node saves redo records corresponding toThe node saves redo records corresponding tochanges made by the transaction to its onlinechanges made by the transaction to its onlineredo log.redo log.
The node guarantees that locks held for theThe node guarantees that locks held for thetransaction are able to survive a failure.transaction are able to survive a failure.
The node responds to the initiating node with aThe node responds to the initiating node with a
prepared response or, if its attempt or theprepared response or, if its attempt or theattempt of one of its descendents to prepare wasattempt of one of its descendents to prepare wasunsuccessful, with an abort response.unsuccessful, with an abort response.
8/14/2019 Distributed Transaction Model
10/17
Steps in the Commit PhaseSteps in the Commit Phase
The global coordinator instructs theThe global coordinator instructs thecommit point site to commit.commit point site to commit.
The commit point site commits.The commit point site commits.
The commit point site informs the globalThe commit point site informs the globalcoordinator that it has committed.coordinator that it has committed.
The global and local coordinators send aThe global and local coordinators send amessage to all nodes instructing them tomessage to all nodes instructing them tocommit the transaction.commit the transaction.
8/14/2019 Distributed Transaction Model
11/17
ContCont
At each node, Site commits the local portionAt each node, Site commits the local portionof the distributed transaction and releasesof the distributed transaction and releaseslocks.locks.
At each node, Site records an additional redoAt each node, Site records an additional redoentry in the local redo log, indicating thatentry in the local redo log, indicating thatthe transaction has committed.the transaction has committed.
The participating nodes notify the globalThe participating nodes notify the globalcoordinator that they have committed.coordinator that they have committed.
8/14/2019 Distributed Transaction Model
12/17
Steps of Forget PhaseSteps of Forget Phase
After receiving notice from the globalAfter receiving notice from the globalcoordinator that all nodes havecoordinator that all nodes havecommitted, the commit point site erasescommitted, the commit point site erasesstatus information about this transaction.status information about this transaction.
The commit point site informs the globalThe commit point site informs the global
coordinator that it has erased the statuscoordinator that it has erased the statusinformation.information.
The global coordinator erases its ownThe global coordinator erases its owninformation about the transaction.information about the transaction.
8/14/2019 Distributed Transaction Model
13/17
Failures of Two Phase ProtocolFailures of Two Phase Protocol
Failure of a participating siteFailure of a participating site
Failure of a CoordinatorFailure of a Coordinator
Network PartitionNetwork Partition
8/14/2019 Distributed Transaction Model
14/17
Recovery and Concurrency ControlRecovery and Concurrency Control
In doubt transactionsIn doubt transactions
Noting lock informationNoting lock information
Faster RecoveryFaster Recovery
8/14/2019 Distributed Transaction Model
15/17
Three Phase Commit ProtocolThree Phase Commit Protocol
Extension of Two Phase ProtocolExtension of Two Phase Protocol
Select new CoordinatorSelect new Coordinator
Property of Non BlockingProperty of Non Blocking
8/14/2019 Distributed Transaction Model
16/17
RefrencesRefrences
Database System Concepts: Henry F.Database System Concepts: Henry F.
KorthKorth
http://stonesoup.esd.ornl.gov/http://stonesoup.esd.ornl.gov/
http://extremelinux.esd.ornl.gov/http://extremelinux.esd.ornl.gov/
http://www.beowulf.org/http://www.beowulf.org/
http://www.cacr.caltech.edu/researchttp://www.cacr.caltech.edu/research/beowulf/h/beowulf/
http://beowulf-underground.org/http://beowulf-underground.org/
8/14/2019 Distributed Transaction Model
17/17
Thank You