In a distributed system, transactions are classified into two different categories: local transactions and global transactions (or distributed transactions). If the data requirement of a transaction can be fulfilled from the local site, it is called a local transaction. Local transactions access data only from local sites.
On the other hand, global transactions access data from remote sites or multiple sites. It is obvious that the transaction management in a distributed DBMS is more complicated than in a centralized DBMS, as the distributed DBMS must ensure the atomicity of the global transaction as well as of each component sub transaction executed at the local sites. This complicated task is performed by four high-level interconnected modules of the DBMS.
These are transaction manager, concurrency control manager, recovery manager and buffer manager. The transaction manager coordinates transactions on behalf of application programs by communicating with the scheduler and implements a particular strategy for concurrency control.
The responsibility of the concurrency control manager is to maximize con-currency, without allowing concurrently executing transactions to interfere with one another, and thereby maintain the consistency of the database as well as the isolation property of the transactions.
The recovery manager preserves the database in a consistent state in case of failures. The buffer manager manages the efficient transfer of data between disk storage and main memory.
In a distributed DBMS, all these modules exist in each local DBMS. In addition, a global transaction manager or transaction coordinator is required at each site to control the execution of global transactions as well as of local transactions initiated at that site.
Therefore, an abstract model of transaction management at each site of a distributed system consists of two different sub modules: the transaction manager and the transaction coordinator.
Transaction manager- The transaction manager at each site manages the execution of the transactions that access data stored at that local site. Each such transaction may be a local transaction or part of a global transaction. The structure of the transaction manager is similar to that of its counterpart in a centralized system, and it is responsible for the following:
Maintaining a log for recovery purposes in case of failures.
Implementing an appropriate concurrency control mechanism to coordinate the concur-rent execution of transactions executing at that local site.
Transaction coordinator- The transaction coordinator at each site in a distributed system coordinates the execution of both local and global transactions initiated at that site. This component or module is not required in centralized DBMSs, as there is only one site in a centralized system. The transaction coordinator at each site performs the following tasks to coordinate the execution of transactions initiated at that local site.
• It starts the execution of the transactions initiated at that site.
• It breaks the transactions into a number of sub transactions and distributes these subtransactions to the appropriate sites for execution.
• It coordinates the termination of the transactions, which may result in the transactions being committed at all sites or aborted at all sites.
The structure of this model is depicted in figure below.
- A transaction is considered as a part of an application. When a user requests for the execution of an application (may be local or global), the application issues a begin transaction primitive. All actions that are performed by the application after that are to be considered part of the same transaction until a commit or an abort primitive is issued. In some systems, all these primitives are implicitly associated with the application; thus, it is not necessary to define all these primitives explicitly. To execute a global application generated at site S1, the transaction coordinator of site SI initiates the transaction and breaks the transaction into a number of sub transactions. It then involves multiple sites by consulting the global system catalog for parallel execution of these sub transactions at different sites. When these sub transactions are distributed over multiple local sites and perform some tasks on behalf of the application, they are called agents. Agents reside at multiple sites and communicate with each other via message passing. The transaction manager at a local site maintains the log when a local transaction or part of a global transaction is executed at that local site. It also controls the concurrent execution of transactions executing at that site. The results retrieved from the parallel execution of these sub transactions at multiple sites are integrated by the transaction coordinator of site S1, and finally the transaction is terminated.