Thursday 4 April 2013

Explain the steps involved in recovery of distributed transactions.


q.n.4 Explain the steps involved in recovery of distributed transactions.

Ans. For Recovery of Distributed transactions, let’s assume that at each site a Local Transaction Manager is available. Each agent can issue begin_transaction, commit, and abort primitives to its LTM. After having issued a begin_transaction to its LMT. An agent will possess the properties of a local transaction. We will call an agent that has issued a begin_transaction primitive to its local transaction manager a Sub-transaction. Also to distinguish the begin_transaction, commit, and abort primitives of the distributed transaction from the local primitives issued by each agent to its LTM, we will call the later as local_begin, local_commit, and local_abort.
For building a Distributed Transaction Manager (DTM), the following properties are expected from the LTM:
  Ensuring the atomicity of sub-transaction
  Writing some records on stable storage on behalf of the distributed transaction manager
We need the second requirement, as some additional information must also be recorded in such a way that they can be recovered in case of failure. In order to make sure that either all actions of a distributed transaction are performed or none is performed at all, two conditions are necessary:
  At each site either all actions are performed or none is performed all sites must take the same decision with respect to the commitment or abort of sub transaction.
Begin_transaction: When it is issued by the root agent, DTM will have to issue a local_behin primitive to the LTM at the site of origin and all the sites at which there are already active agents of the same application, thus transforming all agents into sub_transaction; from this time on the activation of a new agent by the same distributed transaction requires that the local_begin be issued to the LTM where the agent in activated, so that the new agent is created as a Sub-transaction. The example of FUND TRANSFER is taken for explaining this concept.
Abort: When an abort is issued by the root agent, all existing sub-transactions must be aborted. Issuing local_aborts to the LTMs at all sites where there is an active sub transaction performs this.
Commit: The implementation of the commit primitive is the most difficult and expensive. The main difficulty originates from the fact that the correct commitment of a distributed transaction requires that al sub-transactions commit locally even if there are failures.
In order to implement this primitive for a distributed transaction, the general idea of 2-Phase commit Protocol has been developed.

No comments:

Post a Comment