Introduction:
Objective of Distributed Database recovery is to maintain ACID properties(Atomicity ,Consistency,Isolation,Durability) of distributed transactions. A database must guarantee that all statements in a transaction, distributed or non-distributed should be either commit or roll back as a whole single unit. The effects of an ongoing transaction should be invisible to all other transactions at all sites. This transparency should be true for all those transactions which include any type of operations like including queries, including updates or remote procedure calls (RPC).
In DDBMS, a given transaction is submitted at some one site, but it can access data at other sites as well when a transaction is submitted at some one site, the transaction manager at that site breaks it up into a collection of one or more sub transactions that execute at different sites. Topics such as Distributed Database Recovery, ACID properties, and Commit Protocols are important concepts studied in Database Management Systems and Distributed Computing courses offered in BCA and MCA programs.
Two-phase Commit Protocol:-
Two phase commit protocol (2PL) is the simplest and most widely used technique for recovery and concurrency control in distributed database environment, 2PC mechanism ensures that all database servers participating in a distributed transaction either all commit or all abort, in a distributed database system, each sub transaction must show that is prepared to commit. Otherwise, the transaction and all of its changes are entirely aborted. For a transaction to be ready to commit, all of its actions must have been completed successfully. If any sub transaction indicates that its actions cannot be completed, then all the sub transaction are aborted and none of the changes are committed. The two phase commit process requires the coordinator to communicate with every participant site.
Two phase commit (2PC) protocol has two phases namely the voting phase and the decision phase. Both phases are initiated by a coordinator. The coordinator asks all the participants whether they are prepared to commit the transaction. In the voting phase, the sub transactions are requested to vote on their readiness to commit or abort. In the decision phase, a decision phase, a decision as to whether all sub transactions should commit or abort is made and carried out. If one participant votes to abort or fails to respond within a timeout period, then the coordinator instructs all participants to commit the transaction. The global decision must be adopted by all participants.
2PC is that any of the transaction manger involved (including the coordinator) can unilaterally abort a transaction. However, there must be unanimity to commit a transaction. When a message is sent in 2PC, its signals a decision by the sender. In order to ensure that this decision survives a crash at the sender’s site, the log record describing the decision is always forced to stable storage before the message in sent. A transaction is officially committed at the time the coordinators commit log record reaches.
Three phase Commit:-
Three phase commit protocol (3PC) is an extension of a two phase commit protocol. It avoids the blocking limitation of a two phase commit protocol. 3PC is a non-blocking for site failures of all sites. If avoid blocking even if the coordinator site fails during recovery. 3PC assumes that no network partition occurs and not more than predetermined number of site fails. Under these assumptions, the 3PC protocol avoids blocking by introducing an extra third phase where multiple sites are involved in the decision to commit. In 3PC the coordinator effectively postpones the decision to commit until it ensures that at least predetermined number of sites know that it intended to commit the transaction. If the coordinator site failure occurs , the remaining sites first select a new coordinator. This new coordinator site now checks the status of the protocol from the remaining sites. If the earlier coordinator had decided to commit, at last one of the other predetermined sites that it informed is made up and ensures that the commit, at least one of the predetermined sites that it informed is made up and ensures that the commit decision is respected.
Frequently Asked Questions (FAQs)
Q.1 What is objective of distributed database recovery?
Ans: Objective of Distributed Database recovery is to maintain ACID properties(Atomicity ,Consistency,Isolation,Durability) of distributed transactions.
Q.2 What is two phase commit protocol?
Ans: Two phase commit protocol (2PL) is the simplest and most widely used technique for recovery and concurrency control in distributed database environment.
Q.3 What is three phase commit protocol?
Ans: Three phase commit protocol (3PC) is an extension of a two phase commit protocol. It avoids the blocking limitation of a two phase commit protocol.
Author
Mr. Rahul Agarwal
Associate Professor,Department of CS & I.T.
Biyani Group Of Colleges,Jaipur