Recovery Control in distributed database is based on the two-phase commit protocol. The two phase commit protocol is the transaction protocol duo to which all nodes and databases agree with each other to commit a transaction. This protocol is required in an environment where single transaction can interact with multiple independent resource managers as in case of distributed databases. It also support data integrity by ensuring that modifications made to transactions are either committed by all the databases involved in teh distributed system or rolled back by all the databases.
The two phases commit protocol works in two phases. The first phase is called the prepare phase during which the updates are recorded in a transaction log file, and the resource through a resource manager indicates that it is ready to make the changes. Resources can vote either to commit phase depend on the vote of resources. If all resources vote to commit then, all the resources participating in the transaction are updated whereas if one or more of the resources vote to roll back, then, all the resources are rolled back to their previous state.
Consider an example, in which an interaction between a coordinator at a local site and a participant at a remote site takes place and a transaction has requested the commit operation. In the first phase, the coordinator instructs the participants to get ready and sends the get ready message at time. Participants make an entry in it log and send the ok message as acknowledgement to the coordinator. The coordinator then, writes an entry in the log, takes a final decision and sends it to the participants.