Seata of distributed transactions


            _       _       
           | |     | |      
  ___  __ _| |_   _| |_ ___ 
 / __|/ _` | | | | | __/ _ \
 \__ \ (_| | | |_| | ||  __/
 |___/\__,_|_|\__,_|\__\___|
                            

Insert picture description here
Insert picture description here
First, give the definition of Seata life cycle

  • TM applies to TC to start a global transaction. The global transaction is successfully created and a globally unique XID is generated.
  • XID is propagated in the context of the microservice invocation link.
  • RM registers branch transactions with TC and puts them under the jurisdiction of XID corresponding global transactions.
  • TM initiates a global submission or rollback resolution for XID to TC.
  • TC schedules all branch transactions under the jurisdiction of XID to complete commit or rollback requests.

At the beginning, I didn’t understand the life cycle (calling process) of seata. After reading the document many times, I found that the life cycle of seata would be better understood if it was not so terminologically understood.

Here we use a life example to understand

First, compare TM to the village committee, TC to the local government, and RM to the villagers

1. First, the village committee negotiated and resolved a proposal for the welfare of the villagers, and reported the proposal to the local government-application for the opening of the overall affairs

The local government issued a proposal application form, requesting the village committee to fill in the details and submit it-the proposal application form is the globally unique XID

2. The village committee issued the proposal to inform the villagers, and solicit their opinions-if the villagers know the news, it is equivalent to XID spreading in the context of the microservice call link

3. After the villagers unify their opinions, report them to the village committee-it is equivalent to the villagers joining the affairs

4. Although the decision is made by the villagers, it is the village committee that connects with the government—it is equivalent to TM initiating a global submission or rollback resolution for XID to TC

5. After the government receives the message, it executes the proposal (either appropriation or supply) — TC dispatches all branch transactions under the jurisdiction of XID to complete the submission or rollback request

Guess you like

Origin blog.csdn.net/codedecentt/article/details/112998995