TOPICS (Click to Navigate)

Pages

Saturday, August 9, 2014

Database Recovery in Distributed Database

Question 4

Figure 1 - Execution of Transaction T in a distributed environment

Figure 1 shows a distributed database configured on sites A, B, C, and D. All the sites are connected. Assume that a request in the form of Transaction T is reaching Site A. For this case represented in Figure 1, answer the following questions;
(a) How do you handle and restore(recover) the database if Site A is failed during transaction T? Explain.
(b) How do you handle and restore(recover) the database if Site B is failed during transaction T? Explain.
(c) Assume that the Site C is failed. When it recovers from failure, it reads <ready T> control message for transaction T in its log file. How would site C restore the database using the <ready T> control message?
(d) Assume that the Site C is failed. When C recovers, it checks the log file for deciding the fate of the transactions that were running during failure. This step is very much necessary as it can lead the database to a consistent state. When you check the log file, what are the different cases or log entries which would force you to perform an Undo(T) (undo a transaction) on your own without consulting the other sites?

Answer

Click on the links to further view the answers;
 
(a) Transaction T is initiated at Site A. Hence, Site A is the Transaction Coordinator site according to the information provided and the given figure. Now, the other sites which are participating in Transaction T can execute the routine of 2PC protocol for handling the Coordinator Failure. For explanation, continue with the link.

(b) According the information provided, Site B is one of the participating site in Transaction T. Hence, the algorithm for handling Site Failure can be invoked and the database could be set right. For explanation, continue with the link.

(c) The appropriate solution for this case is to invoke the Handling of Site Failure routine. As Site C reads a <ready T> message, Site C, in any case cannot decide the fate of Transaction T. Hence, it has to approach other sites including the Coordinator site to know the decision on Transaction T. 

(d) There are two cases;
  • If the Site C has a record with <abort T>, it has to perform an Undo(T)
  • If the Site C does not contain any control messages (no abort, commit, or ready), it has to perform an Undo(T)