Talking about the second distributed transaction: A distributed transaction management model based on DTC [next article]

Source: Internet
Author: User
Tags commit resource

[continued] When a transaction based on the LTM or KTM is promoted to a distributed transaction based on DTC, DTC becomes the manager of all the transactional resource managers in this machine; In addition, when a transactional operation is outside the scope of the machine, and a call is made across machines, the local DTC needs Assists the DTC of the machine on which the caller is located. Superior to the subordinate (including the native DTC to all of the local resource manager, as well as the Superior DTC) The premise is subordinate to the superiors to register, that is, transaction registration (Transaction Enlist). All transaction participants, including all the resource managers and the transaction Manager (DTC), have formed a tree-level hierarchy after transaction level completion, which is formed by subsequent transaction provisioning, so we call it a transactional commit tree (Transaction commit trees).

I. Transaction registration (Transaction enlisting) and transaction submission tree (Transaction commit trees)

The purpose of transaction registration is to establish a relationship between a transaction participant (as long as it refers to the resource manager and the transaction Manager DTC) and to facilitate collaboration among themselves. Let's take a look at how the entire transaction registration process is going, and the entire transaction registration flow is roughly as shown in Figure 1.

Figure 1 Process of transaction registration

The transaction shown in Figure 1 relates to the deployment of an interaction between two services on two machines (Machine A and Machine B), which is initialized by service and propagated to Machine B at the time of invocation of SERVICE2, thus incorporating a resource manager distributed in two machines into into the same business. Next, we describe the entire process in detail.

First, service A starts a new transaction, and it is the environment transaction (ambient Transaction) that most currently executes the context. When service a invokes the native Resource manager, the Explorer is included in this transaction (for the System.Transactions transaction we are going to introduce, like SQL Server, Resource managers such as Oracle and MSMQ can automatically perceive current environmental transactions. At this point, the Resource Manager (RM) registers transactions with the local DTC, establishing a hierarchy between the DTC and the resource manager.

When service A calls service B, some information about the current transaction, such as the ID of the distributed transaction and information about the native DTC, is encapsulated in the message (typically the SOAP header) to the other. When service B receives the call request message, it extracts the transaction-related information and rebuilds the transaction locally as the current environment transaction with the same ID as the original transaction. At the same time, according to the information of DTC related to Machine A, the DTC of this machine can register the DTC of Machine A, and then the DTC of the two machines establishes the subordinate relation.

As with service a accessing the native resource manager, the Machine B's resource manager is registered with the native DTC when it is invoked by service B and is included in the current transaction.

When the transaction registration process described above is completed, the DTC and resource managers involved in the entire distributed transaction form the tree hierarchy shown in Figure 2, which is generally referred to as the transaction commit tree because it is built primarily for subsequent delivery of the entire transaction (Transaction Commit tree). The root of the transaction submission tree is the DTC of the machine on which the transaction initializes the service, which is the total coordinator and is called the Global commit coordinator (Gcc:global commit coordinator) throughout the transaction commit process. The resource Manager acts as the leaf node of the transaction commit tree, and their parent node is a native DTC. The DTC distributed in different machines forms a subordinate relationship according to the path of transaction propagation.

Figure 2 Transaction Commit tree

The construction of the transaction commit tree makes the submission of distributed transaction possible, and the delivery of distributed transaction is implemented by two-stage protocol, then we introduce the transaction submission mechanism based on two-phase commit protocol in detail.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.