Transactions in distributed database / Transaction manager / Transaction coordinator / Commit protocols / 2 Phase commit protocol
Transactions in Distributed Database Management System
Introduction
In centralized database system, it is mandatory to perform any
transaction (ie., accessing any data items) under the satisfaction of ACID
(Atomicity, Consistency, Isolation, and Durability) properties. The act of
preserving the ACID properties for any transaction is mandatory in Distributed Database
(distributed transaction) also. In case of distributed transactions, there are
two types based on the location of accessed data. The first one, the local
transactions involve read, write, or update of data in only one local
database. Whereas, the global transactions involve read, write,
or update of data in many such local databases.
Distributed database – Transaction system
The transaction system consists of two important components, 1.
Transaction manager (which is similar to the transaction manager in
centralized database. But, in distributed database we have one for every site),
whose main job is to verify the ACID properties of those transactions that
execute at that site, 2. Transaction Coordinator, (available
for every site in distributed database) to manage and coordinate various
transactions (both local and global) initiated at that site.
Transaction System Structure for Distributed Database |
Each Transaction Manager is
responsible for,
·
Maintaining a log for recovery purpose,
·
Participating in an appropriate
concurrency-control scheme (more on this later) to coordinate the concurrent
execution of the transactions executing at that site.
Every Transaction Coordinator
is responsible for,
·
Starting the execution of every transaction at
that site,
·
Breaking the transaction into a number of sub-transactions
and distributing these sub-transactions to the appropriate sites for execution
(In the diagram, the links from TC1 to TM2, TC1
to TM3, TC1 to TM4 and so on and TC1
to TMn mention the distribution of sub-transactions to the concerned
transaction managers),
·
Coordinating the termination of the transaction.
Commit Protocols
As we noted earlier, satisfaction of ACID properties is very well
important. At the initial stage, we need to ensure that the transaction is
atomic (i.e., either completed as a whole or not). In distributed database, the
transaction, say T, which is going on in multiple sites must be committed at
all sites to say that the transaction T is successfully completed. If not, the
transaction T must be aborted at all the sites. To implement this, we need a commit protocol. The simplest among the
commit protocol is the Two-Phase Commit protocol which is
widely used.
***********