Transaction processing method, device and system, storage medium and program product

By introducing a second transaction coordinator TC in a multi-center distributed system and collaborating with the first TC to register branch transactions of the global transaction, the problem of transaction processing collaboration in a multi-center scenario is solved and transaction consistency is guaranteed.

CN120653372APending Publication Date: 2025-09-16HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410292265.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-13
Publication Date
2025-09-16

AI Technical Summary

Technical Problem

In a multi-center distributed system, existing technologies cannot effectively achieve cross-center collaboration in transaction processing, resulting in the inability to guarantee transaction consistency.

Method used

By introducing a second transaction coordinator TC into the transaction processing system, the second TC receives the request from the second RM, carries the identification information of the first TC and the identification information of the global transaction, sends a registration message to the first TC to request registration of the branch transaction of the global transaction, and the first TC records the association relationship to achieve cross-center transaction processing collaboration.

Benefits of technology

It achieves effective collaboration in transaction processing in multi-center scenarios, ensures transaction consistency, and avoids transaction failures caused by communication failures between centers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120653372A_ABST
    Figure CN120653372A_ABST
Patent Text Reader

Abstract

A transaction processing method, apparatus and system, a storage medium and a program product, the method is applied to a transaction processing system, a first center in the transaction processing system comprises a TM, a first TC and a first RM, a second center comprises a second RM and a second TC, the method comprises: the second TC receives a first request from the second RM for requesting to create a branch transaction of a global transaction, the first request comprises first information used for indicating the identification information of the first TC and the identification information of the global transaction; the second TC sends a first registration message for requesting to register a branch transaction of the global transaction to the first TC based on the identification information of the first TC; the second TC sends a first response to the second RM, the first response comprises identification information of the branch transaction, and the identification information of the branch transaction is generated by the first TC or the second TC. And the second TC and the first TC cooperate with each other to complete registration of branch transactions, so that transaction processing in a multi-center scene is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to transaction processing methods, devices, systems, storage media, and program products. Background Art

[0002] Distributed systems are based on microservice architecture, and transaction consistency between each microservice system is a key factor in implementing distributed systems.

[0003] Generally, in a single-center distributed system, a resource manager (RM) is used to manage the corresponding microservice resources. All RMs in the distributed system correspond to the same transaction coordinator (TC) and the same transaction manager (TM). In a single-center distributed system, the TC assigns a global identifier to the transaction and sends the global identifier to the RM corresponding to each microservice through the TM. The RM then requests the TC to create a branch transaction based on the global identifier. In other words, the same TC provides registration services for different branch transactions of the same transaction. This allows the behavior of different branch transactions controlled by the same TC to be unified (for example, determining the execution of business behaviors or canceling business behaviors), thereby ensuring transaction consistency.

[0004] However, with the continuous advancement of technology, the types of transaction services are constantly increasing. This requires distributed systems to adapt to the transaction processing needs of multi-center scenarios. This means that the TCs corresponding to the multiple RMs included in the distributed system are not unique. Assume that the distributed system includes TC1 and TC2. During transaction processing, the TM requests the global identifier of the global transaction from TC1 and sends it to RM1 corresponding to TC1 and RM2 corresponding to TC2. After receiving the global identifier, RM2 requests TC2 to create a branch transaction based on it. However, because TC1 has not shared the global identifier with TC2, TC2 will reject the branch transaction registration request on the grounds that the global identifier is unknown. As a result, the branch transaction's related tasks cannot be completed, and transaction consistency cannot be guaranteed.

[0005] Therefore, how to realize transaction processing in a multi-center scenario is an urgent problem to be solved. Summary of the Invention

[0006] The present application provides a transaction processing method, device, system, storage medium and program product to implement transaction processing in a multi-center scenario.

[0007] In a first aspect, the present application provides a transaction processing method, which is applied to a second transaction coordinator TC in a transaction processing system, the transaction processing system including a first center and a second center, the first center including a transaction manager TM, a first TC, and a first resource manager RM, and the second center including the second RM and the second TC. The method includes: the second TC receiving a first request from the second RM, the first request being used to request creation of a branch transaction of a global transaction, the global transaction being created by the first TC, the branch transaction belonging to the first TC, the first request including first information indicating identification information of the first TC and identification information of the global transaction; the second TC sending a first registration message to the first TC based on the identification information of the first TC, the first registration message being used to request registration of the branch transaction of the global transaction; and the second TC sending a first response to the second RM, the first response including identification information of the branch transaction, the identification information of the branch transaction being generated by the first TC or the second TC.

[0008] In the description of the embodiment of the present application, for the sake of distinction, the branch transaction created by the second RM request is also referred to as the second branch transaction.

[0009] Using the transaction processing method provided in the embodiment of the present application, the first request received by the second TC from the second RM for requesting the creation of a second branch transaction carries the first information. The first information is used to indicate the identification information of the first TC and the identification information of the global transaction. It can also be understood as indicating that the global transaction corresponding to the branch transaction belongs to the first TC, so that the second TC will not only process the second branch transaction in the local center, nor refuse to process the first request on the grounds that the identification information of the global transaction is unknown. Instead, the second TC sends the first registration message of the second branch transaction to the first TC, and cooperates with the first TC to complete the registration of the second branch transaction, thereby realizing transaction processing in a multi-center scenario.

[0010] In some possible implementations, the identification information of the branch transaction is generated by the second TC based on the first request, and the first registration message includes the identification information of the global transaction and the identification information of the branch transaction.

[0011] In this way, the second TC creates the second branch transaction. That is, the branch transactions related to the global transaction are not all created to the first TC in the first center, but are decentralized to the TCs in the centers corresponding to the branch transactions. This can alleviate the problem of excessive resource occupation by the main center due to the branch transaction creation process, and reduce the performance pressure of the main center (the first center) of the business.

[0012] In some possible implementations, before sending the first response to the second RM, the method further includes: the second TC receiving a second response from the first TC, where the second response is used to indicate that the branch transaction is successfully registered.

[0013] In some possible implementations, the first registration message is used to request the first TC to create a branch transaction of the global transaction, and the identifier of the branch transaction is generated by the first TC based on the first registration message. Before sending the first response to the second RM, the method further includes: the second TC receiving a second response from the first TC, the second response including the identifier information of the branch transaction, and the second response indicating that the branch transaction registration is successful.

[0014] In this way, the first TC creates the second branch transaction, meaning that all branch transactions related to the global transaction are managed by the main center. The second TC can then perform routing and forwarding without the need to further understand the management actions or matters of the second branch transaction. This can reduce the redundancy of repeated responses or repeated operations for the same management action of the same branch transaction in the second TC.

[0015] In some possible implementations, the first registration message further includes identification information of the second TC, which is used to indicate that the first registration message originates from the second TC.

[0016] In some possible implementations, a first association relationship is recorded in the second TC, where the first association relationship includes an association relationship between the identification information of the branch transaction and the identification information of the first TC. The method further includes: the second TC receiving a pre-processing result of the branch transaction from the second RM; and the second TC sending the pre-processing result of the branch transaction to the first TC based on the first association relationship.

[0017] In this way, after the second TC receives the pre-processing result of the second branch transaction from the first TC, it sends the pre-processing result of the second branch transaction to the first TC based on the first association relationship, successfully completing the unified management of the cross-center transaction pre-processing results and ensuring transaction consistency.

[0018] In some possible implementations, a second association relationship is recorded in the second TC, and the second association relationship includes an association relationship between the identification information of the branch transaction and the identification information of the first TC. The method also includes: the second TC receives first indication information from the first TC, and the first indication information is used to indicate the execution of the branch transaction, or to indicate the cancellation of the execution of the branch transaction; based on the first indication information and the second association relationship, the second TC sends the third indication information to the second RM, and the third indication information is used to indicate the execution of the branch transaction, or to indicate the cancellation of the execution of the branch transaction.

[0019] In this way, after the second TC receives the first indication information from the first TC, it sends the third indication information to the second RM based on the first association relationship, successfully completing the unified management of cross-center transaction commit or rollback operations and ensuring transaction consistency.

[0020] In some possible implementations, a fourth association relationship is configured in the second TC, and the fourth association relationship includes an association relationship between the identification information of the first TC and the communication address of the first TC. The second TC sends the first registration message to the first TC based on the identification information of the first TC, including: the second TC determines the communication address of the first TC based on the identification information of the first TC and the fourth association relationship; and the second TC sends the first registration message to the first TC based on the communication address of the first TC.

[0021] In a second aspect, the present application provides a transaction processing method, which is applied to a first transaction coordinator TC in a transaction processing system, wherein the transaction processing system includes a first center and a second center, the first center includes a transaction manager TM, the first TC, and a first resource manager RM, and the second center includes a second TC and a second RM. The method includes: the first TC receives a first registration message from the second TC, where the first registration message is used to request registration of a branch transaction of a global transaction, where the global transaction is created by the first TC; the first TC records a third association relationship based on the first registration message, where the third association relationship includes an association relationship between identification information of the global transaction, identification information of the branch transaction, and identification information of the second TC, where the identification information of the branch transaction is generated by the first TC or the second TC.

[0022] Using the transaction processing method provided in the embodiment of the present application, after the first TC receives the above-mentioned first registration message from the second center, it records the identification information of the global transaction, the identification information of the branch transaction, and the association between the identification information of the second TC, and collaborates with the first TC to complete the registration of the second branch transaction, thereby realizing transaction processing in a multi-center scenario.

[0023] In some possible implementations, the identification information of the branch transaction is generated by the second TC, and the first registration message includes the identification information of the global transaction and the identification information of the branch transaction.

[0024] In this way, the second TC creates the second branch transaction. That is, the branch transactions related to the global transaction are not all created to the first TC in the first center, but are decentralized to the TCs in the centers corresponding to the branch transactions. This can alleviate the problem of excessive resource occupation by the main center due to the branch transaction creation process, and reduce the performance pressure of the main center (the first center) of the business.

[0025] In some possible implementations, after recording the third association relationship, the method further includes: the first TC sending a second response to the second TC, where the second response is used to indicate that the branch transaction is successfully registered.

[0026] In some possible implementations, the first registration message is used to request the first TC to create a branch transaction of the global transaction, and the identification information of the branch transaction is generated by the first TC based on the first registration message. After recording the third association relationship, the method further includes: the first TC sending a second response to the second TC, where the second response includes the identification information of the branch transaction, and the second response is used to indicate that the branch transaction is successfully registered.

[0027] In this way, the first TC creates the second branch transaction, meaning that all branch transactions related to the global transaction are managed by the main center. The second TC can then perform routing and forwarding without the need to further understand the management actions or matters of the second branch transaction. This can reduce the redundancy of repeated responses or repeated operations for the same management action of the same branch transaction in the second TC.

[0028] In some possible implementations, before the first TC receives the first registration message from the second TC, the method further includes: the first TC receiving a second request from the TM, where the second request is used to request creation of a global transaction; the first TC creating the global transaction based on the second request and generating identification information of the global transaction; and the first TC sending a third response to the TM, where the third response includes the identification information of the global transaction.

[0029] In some possible implementations, the third response includes the first information. Before the first TC sends the third response to the TM, the method further includes: the first TC determining the first information of the global transaction. In this manner, the first TC independently generates the first information, which clarifies the functional division of labor between the first TC and the TM. Subsequent traceability or docking of the first information can be successful solely through the first TC, aligning with the design concept of high program cohesion and low coupling.

[0030] In some possible implementations, the third association relationship includes the association relationship between the identification information of the global transaction, the identification information of the branch transaction, and the identification information of the second TC, which means that the third association relationship includes the association relationship between the first information, the identification information of the branch transaction, and the identification information of the second TC.

[0031] In some possible implementations, the first registration message further includes identification information of the second TC.

[0032] In some possible implementations, the method further includes: the first TC receiving a pre-processing result of the branch transaction from the second TC; and the first TC recording the pre-processing result of the branch transaction.

[0033] In this way, after receiving the pre-processing result of the second branch transaction from the second TC, the first TC records the pre-processing result of the second branch transaction, successfully completing the unified management of the cross-center transaction pre-processing results and ensuring transaction consistency.

[0034] In some possible implementations, the method further includes: the first TC receiving second indication information from the TM, where the second indication information is used to instruct execution of the global transaction or to instruct cancellation of execution of the global transaction; and the first TC sending first indication information to the second TC based on the second indication information and the third association relationship, where the first indication information is used to instruct execution of the branch transaction or to instruct cancellation of execution of the branch transaction.

[0035] In this way, after the second TC receives the first indication information from the first TC, it sends the third indication information to the second RM based on the first association relationship, successfully completing the unified management of cross-center transaction commit or rollback operations and ensuring transaction consistency.

[0036] In some possible implementations, the first registration message also includes identification information of the second TC, a fifth association relationship is configured in the first TC, the fifth association relationship includes an association relationship between the identification information of the second TC and the communication address of the second TC, and the first TC sends a second response to the second TC including: the first TC determines the communication address of the second TC based on the identification information of the second TC and the fifth association relationship; and the first TC sends the second response to the second TC based on the communication address of the second TC.

[0037] In a third aspect, the present application provides a transaction processing method, which is applied to a second resource manager RM in a transaction processing system, wherein the transaction processing system includes a first center and a second center, the first center includes a transaction manager TM, a first transaction coordinator TC, and a first RM, and the second center includes a second TC and the second RM. The method includes: the second RM receives first information from the TM, the first information is used to indicate identification information of the first TC and identification information of a global transaction, and the global transaction is created by the TM requesting the first TC; the second RM sends a first request to the second TC, the first request includes the first information, and the first request is used to request the creation of a branch transaction of the global transaction.

[0038] By adopting this transaction processing method, the second RM carries the first information when requesting the second TC to create a second branch transaction, which can indicate to the second TC that the global transaction belongs to the first TC. Therefore, the second TC will not only process the second branch transaction in its own center, nor refuse to process the second branch transaction on the grounds that the identification information of the global transaction is unknown. Instead, the second TC sends the first registration message of the second branch transaction to the first TC, and cooperates with the first TC to complete the registration of the second branch transaction, thereby realizing transaction processing in a multi-center scenario.

[0039] In some possible implementations, after the second RM sends the first request to the second TC, the method further includes: the second RM preprocesses the branch transaction and obtains a preprocessing result of the branch transaction; and the second RM sends the preprocessing result of the branch transaction to the second TC.

[0040] In some possible implementations, after the second RM sends the first request to the second TC, the method further includes: the second RM receives third indication information from the second TC, the third indication information being used to indicate the execution of the branch transaction or to indicate the cancellation of the execution of the branch transaction; the second RM determines whether to execute the branch transaction or cancel the execution of the branch transaction based on the third indication information.

[0041] In a fourth aspect, the present application provides a transaction processing method, which is applied to a transaction manager TM in a transaction processing system, wherein the transaction processing system includes a first center and a second center, wherein the first center includes the TM, a first transaction coordinator TC, and a first resource manager RM, and the second center includes a second TC and a second RM. The method includes: the TM sends a second request to the first TC, where the second request is used to request the creation of a global transaction; the TM receives a third response, where the third response carries identification information of the global transaction; and the TM sends first information to the second RM, where the first information is used to indicate identification information of the first TC and identification information of the global transaction.

[0042] In some possible implementations, the third response includes the first information, where the first information is generated by the first TC.

[0043] With this transaction processing method, when the TM triggers the second RM to create a branch transaction, the TM transmits to the second RM a first message that not only indicates the identification information of the global transaction but also the identification information of the first TC, thereby indicating to the second RM that the global transaction belongs to the first TC. In this way, when the second RM requests the second TC to create a second branch transaction, it can also carry the first message, indicating to the second TC that the global transaction belongs to the first TC. This ensures that the second TC will not only process the second branch transaction within its own center, nor will it refuse to process the second branch transaction due to unknown global transaction identification information. Instead, the second TC will send a first registration message for the second branch transaction to the first TC, collaborating with the first TC to complete the registration of the second branch transaction, thus achieving transaction processing in a multi-center scenario.

[0044] In a fifth aspect, the present application provides a transaction processing method, which is applied to a transaction processing system, wherein the transaction processing system includes a first center and a second center, the first center includes a transaction manager TM, a first transaction coordinator TC, and a first resource manager RM, and the second center includes a second TC and a second RM; the method includes: the TM sends a second request to the first TC, the second request is used to request the creation of a global transaction; the first TC creates the global transaction based on the second request and determines the identification information of the global transaction; the first TC sends a third response to the TM, the third response includes the identification information of the global transaction; after receiving the third response, the TM sends a first message to the second RM, the first message is used to indicate the identification information of the first TC and the identification of the global transaction information; the second RM sends a first request to the second TC based on the first information, the first request including the first information, and the first request is used to request the creation of a branch transaction of the global transaction; the second TC sends a first registration message to the first TC based on the identification information of the first TC, and the first registration message is used to request the registration of the branch transaction of the global transaction; the first TC records a third association relationship based on the first registration message, the third association relationship including the association relationship between the identification information of the global transaction, the identification information of the branch transaction, and the identification information of the second TC, wherein the identification information of the branch transaction is generated by the first TC or the second TC; the second TC sends a first response to the second RM, and the first response includes the identification information of the branch transaction.

[0045] In the sixth aspect, the present application provides a transaction processing system, which includes a first center and a second center, the first center including a transaction manager TM, a first transaction coordinator TC and a first resource manager RM, the second center including a second TC and a second RM, the second TC is used to implement the method described in any possible implementation method of the first aspect or for implementing the method or steps performed by the second TC in the fifth aspect, the first TC is used to implement the method described in any possible implementation method of the second aspect or for implementing the method or steps performed by the first TC in the fifth aspect, the second RM is used to implement the method described in any possible implementation method of the third aspect or for implementing the method or steps performed by the second RM in the fifth aspect, and the TM is used to implement the method described in any possible implementation method of the fourth aspect or for implementing the method or steps performed by the TM in the fifth aspect.

[0046] In the seventh aspect, the present application provides a transaction processing device, comprising a unit for implementing the method described in any one of the first aspects above, or a unit for implementing the method described in any one of the second aspects above, or a unit for implementing the method described in any one of the third aspects above, or a unit for implementing the method described in any one of the fourth aspects above, or a unit for implementing the method described in any one of the fifth aspects above.

[0047] In an eighth aspect, the present application provides a transaction processing device, comprising a processor configured to read and execute a computer program stored in a memory to implement the method described in any of the implementations of the corresponding aspects of the embodiments of the present application. In some possible implementations, the transaction processing device further comprises the aforementioned memory. Optionally, the processor and memory are integrated.

[0048] In a possible implementation, the processor is configured to support the device in executing corresponding functions in the communication method, and the memory is used to store computer programs (or computer executable instructions) and / or data necessary for the device.

[0049] In some possible implementations, the apparatus further includes a communication interface configured to support communication between the apparatus and other network elements, such as the transmission or reception of data and / or signals. Exemplarily, the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface.

[0050] In some possible implementations, the device is a chip.

[0051] In a ninth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when run on an electronic device, enables the electronic device to execute the method shown in any implementation method in the corresponding aspect of the embodiment of the application.

[0052] In a tenth aspect, the present application provides a computer-readable storage medium for storing a computer program. When the computer program is executed, the method shown in any implementation method in the corresponding aspect of the embodiment of the present application is implemented.

[0053] In the eleventh aspect, the present application provides a chip module, including a transceiver component and a chip, wherein the chip is used to execute the method shown in any implementation method in the corresponding aspect of the embodiment of the present application.

[0054] It is understood that the transaction processing device, transaction processing system, computer storage medium, computer program, computer program product, and chip system provided above are all used to execute the method shown in any implementation of the corresponding aspects of the embodiments of this application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects of the corresponding methods and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Figure 1 A schematic diagram of the architecture of a single-center distributed system provided in an embodiment of the present application;

[0056] Figure 2 A schematic diagram of a transaction processing flow in a single-center distributed system provided in an embodiment of the present application;

[0057] Figure 3 A schematic diagram of an embodiment of the present application in which cross-center branch transaction processing cannot be completed;

[0058] Figure 4 This is a schematic diagram of the architecture of a distributed transaction processing system in a multi-center scenario provided by an embodiment of the present application;

[0059] Figure 5 A schematic diagram of a transaction processing method provided in an embodiment of the present application;

[0060] Figure 6 A schematic diagram of another transaction processing method provided in an embodiment of the present application;

[0061] Figure 7 A schematic diagram of another transaction processing method provided in an embodiment of the present application;

[0062] Figure 8 A schematic diagram of another transaction processing method provided in an embodiment of the present application;

[0063] Figure 9 A schematic diagram of the structure of a transaction processing device provided in an embodiment of the present application;

[0064] Figure 10 A schematic diagram of the structure of another transaction processing device provided in an embodiment of the present application;

[0065] Figure 11 A schematic diagram of the structure of another transaction processing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] The following introduces some terms involved in the embodiments of this application.

[0067] (1) Affairs

[0068] A transaction is a sequence of database operations that accesses and potentially manipulates various data items. Operations corresponding to the same transaction are either all executed or none executed. It is an indivisible unit of work. That is, branch transactions corresponding to the same global transaction are either all executed or none executed.

[0069] (2) Transaction Manager (TM)

[0070] The TM is used to start transactions and determine the commit or rollback of global transactions. It is the initiator and manager of global transactions. The commit operation determines the execution of a transaction, and the rollback operation determines the cancellation of a transaction.

[0071] (3) Transaction Coordinator (TC)

[0072] TC is used to assign identification information to global transactions and branch transactions, maintain the correspondence between global transactions and branch transactions, and drive the corresponding RM to commit or rollback branch transactions.

[0073] (4) Microservice system, single-center distributed system, multi-center distributed system

[0074] Generally speaking, a microservice system can be understood as an integrated system. A microservice system is a thread that can run independently on a computer to provide services to users. A microservice system includes at least one TM and at least one RM, with each RM corresponding to at least one database (DB). A distributed system consists of at least two microservice systems, and transaction consistency between each microservice system is a key element in implementing a distributed system.

[0075] In a distributed system, the TM in a microservice system is responsible for managing at least one type of business. If the same business involves RMs from multiple microservice systems, the TM in the target microservice system that initiated the business will centrally handle transaction control. Specifically, during the business-related process, the TM in the target microservice system communicates and interacts with multiple RMs from different microservice systems to complete the business-related transaction process and ensure transaction consistency. This is not managed by the TMs in microservice systems other than the target microservice system corresponding to these multiple RMs.

[0076] For example, the distributed system includes two microservice systems: the transaction system and the personal account system. For a transaction initiated by the transaction system, completing the transaction requires combining the microservices of the personal account system. The RM in the transaction system uniformly manages the RM of the transaction system and the RM of the personal account system to execute the relevant affairs of the transaction.

[0077] In a single-center distributed system, all microservice systems correspond to the same TC.

[0078] In a multi-center distributed system, there are at least two TCs in the system, and the TCs corresponding to every two microservice systems are the same or different.

[0079] (5) Transaction preprocessing, commit, and rollback operations

[0080] Generally, transaction preprocessing includes, but is not limited to, simulating the database operations involved in the transaction to determine whether they can be executed normally. The TM only initiates a commit operation for the global transaction if it determines that the preprocessing results for each branch transaction of the global transaction are correct. Otherwise, it initiates a rollback operation. A commit operation involves executing the corresponding database operations for all branches of the global transaction, while a rollback operation cancels the corresponding database operations for all branches of the global transaction.

[0081] As an example, the DB operations corresponding to the branch transactions of the global transaction include deductions from the personal account balance center and increases in credit points. The preprocessing of the branch transactions of the global transaction includes: the RM of the personal account balance center reads the corresponding DB to perform preprocessing of simulated deduction operations, and the RM of the credit center points reads the corresponding DB to perform preprocessing of simulated credit points increase operations. If the preprocessing of each branch transaction can be successfully executed, the TM will determine the commit operation of the global transaction to actually modify the data items in the corresponding DB. If one of the preprocessing fails, the TM determines to perform a rollback operation on the global transaction, that is, determines not to modify the data items in the corresponding DB.

[0082] It should be noted that this article takes the example of preprocessing transactions including simulating DB operations involved in the corresponding transactions, but the operations included in preprocessing transactions may not be limited to DB operations, but may also be preprocessing of other operations, which will not be elaborated in this article.

[0083] For the sake of distinction, this article also refers to the transaction commit operation process and rollback operation process as the formal transaction processing process.

[0084] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.

[0085] Figure 1 An embodiment of the present application provides an architectural diagram of a microservice system that may be involved in the same business in a single-center distributed system.

[0086] like Figure 1As shown, in a single-center distributed system, the microservice systems that may be involved in the same business include at least two microservice systems, such as Figure 1 The diagram shows three microservice systems: microservice A, microservice B, and microservice C. Each microservice system corresponds to a single TC. A business is initiated by microservice A and requires the services provided by microservices B and C. TM1 in microservice A communicates with RM in microservice B and RM in microservice C to complete the transaction flow.

[0087] As an example, to ensure transaction consistency, for a business in TM (which can be any TM in the distributed system), if the business involves RM1 and RM2 (that is, two microservice systems), the transaction coordination process between TM, TC, and RM (RM1 and RM2) in the single-center distributed system can be as follows: Figure 2 As shown, it includes the following processes:

[0088] 1) Global transaction creation process between TM and TC.

[0089] The TM applies to the TC to start a global transaction. The TC generates unique identification information for the global transaction and sends the identification information to the TM.

[0090] 2) TM passes the identification information of the global transaction to RM.

[0091] After receiving the identification information of the global transaction returned by TC, TM passes it to the RM of the microservice system using the service interface call as the call chain transmission carrier.

[0092] For example, the TM transmitting the global transaction identification information to the RM includes transmitting the global transaction identification information to RM1 and RM2. RM1 and RM2 are RMs related to the transaction, as determined by the TM based on the transaction. RM1 and RM2 can belong to the same microservice system or different microservice systems. For ease of description, RM1 and RM2 are collectively referred to as RM below.

[0093] 3) Branch transaction creation process between RM and TC.

[0094] Based on the global transaction's identification information, the RM requests the TC to create a branch transaction of the global transaction. The TC creates the branch transaction, assigns identification information to it, records the association between the branch transaction and the global transaction, and sends the branch transaction's identification information to the RM.

[0095] 4) The TC and RM interact with each other regarding branch transaction pre-processing.

[0096] After receiving the identification information of the branch transaction, the RM preprocesses the branch transaction, obtains a preprocessing result, and sends the preprocessing result to the TC. After receiving the preprocessing result, the TC records the preprocessing result and sends a response message to the RM indicating that the preprocessing result has been successfully recorded. The RM then sends the preprocessing result of the branch transaction to the TM.

[0097] 5) Global transaction commit or rollback.

[0098] Based on the pre-processing results of each branch transaction corresponding to the global transaction, the TM initiates a global transaction commit or rollback to the TC. Based on the recorded information of the branch transactions corresponding to the global transaction, the TC initiates a global transaction commit or rollback to the RM (including RM1 and RM2). After the RM completes the commit or rollback of the branch transactions, the global transaction ends.

[0099] As transaction service types continue to increase, the TCs corresponding to multiple microservice systems in a distributed system are no longer the same. Instead, each microservice system can correspond to a different TC. This can also be understood as if two microservice systems correspond to different TCs, then these two microservice systems belong to different centers. Distributed systems need to adapt to the transaction processing requirements of multi-center scenarios.

[0100] In a cross-center scenario, assuming that the initiator of a global transaction of a business is the TM corresponding to the first center, if it is still based on Figure 2 If the transaction is processed according to the processing flow shown, the RM in other centers (not the first center) involved in the business will not be able to complete the task of creating the branch transaction, resulting in the problem that the transaction consistency cannot be maintained between the microservice systems.

[0101] For example, Figure 3 As shown, the same business involves two centers: the transaction center and the credit center. The transaction center includes TC1, TM, and RM1, while the credit center includes TC2 and RM2. The initiator of the global transaction for this business is the TM corresponding to the transaction center. Therefore, during transaction processing, the TM requests a global identifier for the global transaction from TC1 and sends it to RM1 and RM2 involved in the business. After receiving this global identifier, RM2 requests TC2 to create a branch transaction based on it. However, because TC1 has not shared this global identifier with TC2, TC2, upon receiving the request to create a branch transaction based on this global identifier, rejects the branch transaction registration request on the grounds that the global identifier is unknown. Consequently, the branch transaction's related tasks cannot be completed, and transaction consistency cannot be guaranteed.

[0102] In view of this, an embodiment of the present application provides a transaction processing method for implementing a multi-center scenario.

[0103] The following combination Figure 4 This paper introduces the architecture diagram of the distributed transaction processing system in a multi-center scenario provided by this application.

[0104] The system includes a first center and a second center. The first center includes a TM, a first TC, and a first RM. The second center includes a second RM and a second TC. The first and second TCs are different. The first center refers to the center corresponding to the TM responsible for initiating the global transaction for this service. The second center refers to any center corresponding to any other RM involved in this service, other than the first center. The first and second TCs can communicate with each other.

[0105] It should be noted that the second center can generally also include the TM corresponding to the second TC, but Figure 4 The TM corresponding to the second TC in the second center is not described in the following. Figure 4 Taking one of the services, whose global transaction is initiated by the TM corresponding to the first center, as an example, the nodes included in the transaction processing system provided by this application are described for one service.

[0106] The following Figure 4 Based on Figure 5 The interactive flowchart shown introduces a transaction processing method provided by an embodiment of the present application.

[0107] like Figure 5 As shown, the method includes the following steps:

[0108] S501: The TM sends a second request to the first TC. The second request is used to request creation of a global transaction. Correspondingly, the first TC receives the second request.

[0109] In the embodiment of the present application, the first center can be understood as the main center of this business, and the TM in the first center is the initiator of the global transaction of this business.

[0110] S502: The first TC creates a global transaction based on the second request and generates identification information of the global transaction.

[0111] In the embodiment of the present application, the identification information of the global transaction is the unique identifier of the global transaction.

[0112] S503: The first TC sends a third response to the TM. The third response includes identification information of the global transaction.

[0113] In some possible implementations, the third response includes identification information of the global transaction but does not include identification information of the first TC.

[0114] In some other possible implementations, the first TC generating the identification information of the global transaction in step S502 includes: the first TC generating first information, the first information being used to indicate the identification information of the first TC and the identification information of the global transaction. Furthermore, the first TC sending a third response to the TM including the first information.

[0115] As an example, the first information may include two independent pieces of information: identification information of the first TC and identification information of the global transaction. As another example, the first information may also include identification information obtained by combining the identification information of the first TC and the identification information of the global transaction, such as an extended transaction identifier (XID). The XID is used to uniquely identify the global transaction. The specific combination method may be string concatenation or other appropriate methods. This document does not limit the method used by the first information to indicate the identification information of the first TC and the identification information of the global transaction.

[0116] S504, the TM sends first information to the second RM. Correspondingly, the second RM receives the first information, where the first information is used to indicate identification information of the first TC and identification information of the global transaction.

[0117] In an embodiment of the present application, after the TM obtains the identification information of the global transaction returned by the first TC, it uses the remote service as a call delivery carrier to send the first information to the RM in the other microservice system related to the current business. According to the type of the business, the TM can obtain the other microservice systems related to the business and the communication addresses of the RMs configured with the other microservice systems in the TM (including the communication address configured with the second RM). Thus, when the TM obtains the identification information of the global transaction returned by the first TC and determines that the microservice systems involved in the current business include the second center, the TM sends the first information to the second RM based on the communication address of the second RM.

[0118] In the embodiment of the present application, the first information can also be understood as indicating that the global transaction belongs to the first TC, that is, the identification information of the global transaction is allocated by the first TC, and the correspondence between the branch transactions of the global transaction and the global transaction is also maintained by the first TC, for example, including the storage and recording of the identification information of the branch transactions.

[0119] As an example, if the third response sent by the first TC in step S503 includes identification information of the global transaction but does not include identification information of the first TC, the first information is generated by the TM according to the identification information of the first TC and the identification information of the global transaction carried in the third response.

[0120] As another example, if the third response sent by the first TC in step S503 includes the first information, that is, the first information is generated by the TC, then the TM can directly use the first information without the need for the TM to regenerate it. In this application, the method of independently generating the first information by the first TC, compared with the method of generating the identification information of the global transaction by the first TC and then generating the first information based on the identification information of the global transaction by the TM, can make the functional division of the first TC and the TM clearer. Subsequent traceability or docking of the first information can be successfully traced or docked only through the first TC, without the need to dock with both the first TC and the TM to complete the traceability or docking of the first information, which is in line with the design concept of high cohesion and low coupling of the program.

[0121] S505 : The second RM sends a first request to the second TC based on the first information. The first request is used to request creation of a second branch transaction of the global transaction. The first request includes the first information. Accordingly, the second TC receives the first request.

[0122] In this embodiment of the present application, the first request includes first information, which indicates the identification information of the first TC and the identification information of the global transaction. This information can also be understood as indicating to the second TC that the global transaction corresponding to the branch transaction being requested to be created belongs to the first TC. This information can also be understood as indicating to the second TC that the branch transaction being requested to be created belongs to the first TC. The second TC can parse the first information to obtain the identification information of the first TC.

[0123] S506: The second TC sends a first registration message to the first TC. The first registration message is used to request registration of the second branch transaction of the global transaction. Correspondingly, the first TC receives the first registration message.

[0124] In the embodiment of the present application, the first registration message includes identification information of the global transaction. Optionally, the first registration message may also include identification information of the second TC, indicating that the first registration message comes from the second TC.

[0125] In some possible implementations, a fourth association is configured in the second TC. This fourth association includes an association between the identification information of the first TC and the communication address of the first TC. For example, the communication address of the first TC is the Internet Protocol (IP) address of the first TC. Thus, after creating the second branch transaction based on the first information, the second TC can determine the IP address of the first TC based on the identification information of the first TC indicated in the first information and the fourth association, and then send a first registration message to the first TC based on the IP address of the first TC. For example, a Java package or a code snippet logic can be expanded, and the fourth association can be configured as a configuration item in the second TC within the Java package or code snippet logic. Alternatively, the fourth association can be recorded in a database, and the fourth association in the database can be retrieved through the Java package or code snippet logic. This is not limited herein.

[0126] As an example, the fourth association is configured in the second TC before the TM initiates the global transaction or before the second TC receives the first request, for example, during the second TC's installation and deployment phase. Furthermore, if the first TC's communication address changes, the first TC's communication address recorded in the fourth association must be changed accordingly.

[0127] S507: The first TC records a third association relationship, where the third association relationship includes an association relationship among the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC.

[0128] In some possible implementations, the identification information of the second branch transaction is generated by the second TC based on the first request. The first registration message then includes the identification information of the global transaction and the identification information of the second branch transaction. For example, the second TC creates the second branch transaction based on the first request and generates the identification information of the second branch transaction. The first registration message can be understood as a notification message used to inform the first TC that the branch transactions of the global transaction also include the second branch transaction generated and managed by the second TC, so that the first TC records the third association.

[0129] In some other possible implementations, the first registration message is used to request the first TC to create a second branch transaction of the global transaction. The identifier of the second branch transaction is generated by the first TC based on the first registration message. For example, the first TC creates the second branch transaction based on the first registration message, generates identifier information for the second branch transaction, and records the third association relationship.

[0130] In some possible implementations, a fifth association is configured in the first TC. This fifth association includes an association between the identification information of the second TC and the communication address of the second TC. For example, the communication address of the second TC is the IP address of the second TC. For example, a Java package or a code snippet logic can be expanded to configure the fifth association as a configuration item in the first TC. Alternatively, the fifth association can be recorded in a database, and the fifth association in the database can be retrieved through the Java package or the code snippet logic. This is not limited herein.

[0131] As an example, the fifth association relationship is configured in the first TC before the TM initiates a global transaction or before the first TC receives the first registration message, for example, during the first TC's installation and deployment phase. As another example, after the second TC has configured the fourth association relationship, the second TC can send its identification information and communication address to the first TC based on the first TC's IP address. Furthermore, if the second TC's communication address changes, the communication address recorded in the fifth association relationship must be changed accordingly.

[0132] As an example, the identification information of the second TC may be an identity document (ID) of the second TC.

[0133] As an example, if the first registration message does not include the identification information of the second TC, the first TC can determine that the first registration message comes from the second TC through the sender IP address corresponding to the above-mentioned first registration message, and then can determine the identification information of the second TC based on the IP address of the second TC and the fifth association relationship, so as to facilitate recording the above-mentioned third association relationship.

[0134] In some other possible implementations, the first registration message may further include identification information of the second TC. The first TC may then directly obtain the identification information of the second TC based on the first registration message to facilitate recording the third association relationship.

[0135] As another example, the identification information of the second TC can also be identification information generated by the second TC. This identification information of the second TC is different from the ID of the second TC (for example, called TC2RMID). This TC2RMID can be understood as the RM interface identifier that enables communication interaction with the first TC. For example, a Java package or a code snippet logic can be expanded, and the identification information of the second TC can be configured as a configuration item in the second TC in this Java package or code snippet logic. This Java package or code snippet logic can be the same as the Java package or code snippet logic used to configure the fourth association relationship in the second TC, and this is not limited to this in this document.

[0136] In some other possible implementations, after the first TC completes recording the third association relationship, the transaction processing method further includes: the first TC sending a second response to the second TC, where the second response is used to indicate that the second branch transaction is successfully registered.

[0137] As an example, if the identification information of the second branch transaction is generated by the second TC based on the first request, the second response may or may not include the identification information of the second branch transaction. The inclusion of the identification information of the second branch transaction in the second response may be used to indicate that the second response is a response to the registration message for the second branch transaction. If the second response does not include the identification information of the second branch transaction, the first TC may also indicate that the second response is a response to the registration message for the second branch transaction through other means, such as through a preset registration identifier and response identifier, which is not limited herein.

[0138] As another example, the identification information of the second branch transaction is generated by the first TC based on the first registration message, and the second response includes the identification information of the second branch transaction.

[0139] As an example, the second TC may trigger execution of step S508 (sending the first response to the second RM) after receiving the second response. As another example, the second TC may also determine that the second branch transaction registration is successful and trigger execution of step S508 if it does not receive a registration failure response message from the first TC within a preset time period.

[0140] In some possible implementations, when the first information is the above-mentioned XID, the above-mentioned third association relationship includes the association relationship between the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC, which means: the third association relationship includes the association relationship between the first information, the identification information of the second branch transaction, and the identification information of the second TC.

[0141] S508: The second TC sends a first response to the second RM. The first response includes identification information of the second branch transaction. Correspondingly, the second RM receives the first response.

[0142] In this embodiment of the present application, the first response is a response message to the first request.

[0143] Using the transaction processing method provided in the embodiment of the present application, when the TM triggers the second RM to create a branch transaction, the TM transmits to the second RM the first information indicating not only the identification information of the global transaction but also the identification information of the first TC, thereby indicating to the second RM that the global transaction belongs to the first TC. In this way, when the second RM requests the second TC to create a second branch transaction, it can also carry the first information, indicating to the second TC that the global transaction belongs to the first TC. This ensures that the second TC will not only process the second branch transaction in its own center, nor will it refuse to process the second branch transaction on the grounds that the identification information of the global transaction is unknown. Instead, the second TC sends the first registration message of the second branch transaction to the first TC, and collaborates with the first TC to complete the registration of the second branch transaction, thereby realizing transaction processing in a multi-center scenario.

[0144] For example, the second TC first creates a second branch transaction based on the first request of the second RM, assigns identification information to the second branch transaction, and registers the association relationship between the second branch transaction and the global transaction in the first TC through the first registration message. After receiving the second response sent by the first TC indicating that the registration is successful, the second TC sends the above-mentioned first response including the identification information of the second branch transaction to the second RM, completing the branch transaction registration in the cross-center scenario and realizing transaction processing in the multi-center scenario.

[0145] Alternatively, the first TC creates a second branch transaction in response to the first registration message, assigns identification information to the second branch transaction, sends a second response including the identification information of the second branch transaction to the second TC, and then the second TC sends the above-mentioned first response including the identification information of the second branch transaction to the second RM, completing the branch transaction registration in the cross-center scenario and realizing transaction processing in the multi-center scenario.

[0146] The following combination Figure 6 introduce Figure 5 One implementation of the method shown. Figure 6 In the transaction processing method shown, the second TC first creates a second branch transaction based on the first request of the second RM, assigns identification information to the second branch transaction, and registers the association relationship between the second branch transaction and the global transaction in the first TC through a first registration message. Figure 6 As shown, the method includes:

[0147] S601: The TM sends a second request to the first TC. The second request is used to request creation of a global transaction. Correspondingly, the first TC receives the second request.

[0148] S602: The first TC creates a global transaction based on the second request and generates identification information of the global transaction.

[0149] S603: The first TC sends a third response to the TM. The third response includes identification information of the global transaction.

[0150] S604, the TM sends first information to the second RM, where the first information is used to indicate identification information of the first TC and identification information of the global transaction. Correspondingly, the second RM receives the first information.

[0151] S605 : The second RM sends a first request to the second TC based on the first information. The first request is used to request creation of a second branch transaction of the global transaction. The first request includes the first information. Accordingly, the second TC receives the first request.

[0152] The description of steps S601-S605 can refer to the above steps S501-S505 and will not be described in detail here.

[0153] S606: The second TC creates a second branch transaction based on the first request and generates identification information of the second branch transaction.

[0154] In the embodiment of the present application, the second TC generates a second branch transaction of the global transaction based on the first request, and allocates identification information to the second branch transaction.

[0155] S607: The second TC sends a first registration message to the first TC. The first registration message includes identification information of the global transaction and identification information of the second branch transaction. Correspondingly, the first TC receives the first registration message.

[0156] In the embodiment of the present application, the second TC sends the first registration message to the first TC after determining to generate the identification information of the second branch transaction based on the first information in the first request including the identification information of the first TC.

[0157] In this embodiment of the present application, the second branch transaction belongs to the first TC, but is managed by the second TC, which can perform routing and forwarding functions. For example, this management may include creation and may also include recording raw data related to the second branch transaction, such as the identification information of the second branch transaction, the identification information of the global transaction, and the pre-processing results of the second branch transaction.

[0158] In some other possible expressions, the first registration message may also be called a first notification message, etc., and this document does not limit the expression of the first registration message.

[0159] Regarding how the second TC obtains the communication address of the first TC, reference may be made to the relevant description in step S506 above, which will not be described in detail here.

[0160] S608: The first TC records a third association relationship based on the first registration message, where the third association relationship includes an association relationship among the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC.

[0161] S609: The first TC sends a second response to the second TC. The second response is used to indicate that the second branch transaction is successfully registered. Correspondingly, the second TC receives the second response.

[0162] It should be noted that, in some other possible implementations, after the first TC completes the recording of the third association relationship (that is, the second branch transaction is successfully registered), it may not send the second response to the first RM. If the first TC fails to complete the recording of the third association relationship normally (including failing to receive the first registration message normally), the first TC may send a registration failure response message to the second TC. The second TC side may determine that the second branch transaction is successfully registered based on the second response, or the second TC may determine that the second branch transaction is successfully registered if it does not receive a response message from the first TC indicating that the second branch transaction has failed to register within a preset time. This document does not limit whether the first TC sends a second response to the second TC, and how it responds.

[0163] S610: The second TC sends a first response to the second RM based on the second response. The first response includes identification information of the second branch transaction. Correspondingly, the second RM receives the first response.

[0164] Using the embodiment of this application Figure 6 In the transaction processing method provided, after the second TC creates a second branch transaction, it registers the second branch transaction with the first TC via a first registration message. That is, branch transactions related to the aforementioned global transaction are not all submitted to the first TC in the first center, but are instead distributed to TCs in the centers corresponding to the branch transactions. This reduces the performance pressure on the first center (which can also be understood as the main center for this business).

[0165] Please refer to Figure 7 , Figure 7 For Figure 6On the basis of the transaction processing method shown in the figure, combined with some other processing processes involved in the entire life cycle of the global transaction, including the first branch transaction creation operation initiated by the first RM in the first center and the pre-processing operations of the first branch transaction and the second branch transaction, the content of the commit or rollback operation, etc., another transaction processing method provided by this application is introduced. Figure 7 As shown, the method includes the following processes:

[0166] Process 1: Global transaction creation process.

[0167] S701: The TM sends a second request to the first TC. The second request is used to request creation of a global transaction. Correspondingly, the first TC receives the second request.

[0168] S702: The first TC creates a global transaction based on the second request and generates first information, where the first information is used to indicate identification information of the global transaction and identification information of the first TC.

[0169] In this embodiment, the first TC may create a global transaction based on the second request, and generate identification information of the global transaction and first information. For example, the first information may be the aforementioned XID.

[0170] S703: The first TC sends a third response to the TM, where the third response includes the first information.

[0171] S701-S703 can refer to the relevant description of steps S501-S503 above, and will not be described in detail here.

[0172] Process 2: First branch transaction processing process:

[0173] S704: The TM sends first information to the first RM, and correspondingly, the first RM receives the first information.

[0174] S705 : The first RM sends a third request to the first TC based on the first information. The third request is used to request creation of a first branch transaction of the global transaction. The third request includes the first information. Accordingly, the second TC receives the third request.

[0175] S706: The first TC creates a first branch transaction based on the third request, generates identification information of the first branch transaction, and records the sixth association relationship.

[0176] In the embodiment of the present application, the sixth association relationship includes an association relationship between the identification information of the global transaction and the identification information of the first branch transaction.

[0177] S707: The first TC sends a fourth response to the first RM. The fourth response is used to indicate that the first branch transaction is successfully registered. The fourth response includes identification information of the first branch transaction. Accordingly, the first RM receives the response information.

[0178] In this embodiment of the present application, the fourth response is a response to the third request.

[0179] Process 3: First branch transaction preprocessing process.

[0180] S708: The first RM pre-processes the first branch transaction and obtains a pre-processing result of the first branch transaction.

[0181] In the embodiment of the present application, after the first RM determines that the first branch transaction is successfully registered, it performs a pre-processing task of the first branch transaction.

[0182] S709: The first RM sends the pre-processing result of the first branch transaction to the first TC. Correspondingly, the first TC receives the pre-processing result of the first branch transaction.

[0183] The first RM may send the identification information of the first branch transaction and the preprocessing result of the first branch transaction to the first TC to indicate that the preprocessing result corresponds to the identification information of the first branch transaction and the preprocessing result is the preprocessing result of the first branch transaction.

[0184] S710: The first TC records the pre-processing result of the first branch transaction.

[0185] S711: The first TC sends a fifth response to the first RM. The fifth response is used to indicate that the first TC has recorded the pre-processing result of the first branch transaction. Accordingly, the first RM receives the fifth response.

[0186] It should be noted that, in some other possible implementations, after the first TC completes the recording of the preprocessing result of the first branch transaction (that is, the recording result is successful), it may not send the fifth response to the first RM. If the first TC fails to normally record the preprocessing result of the first branch transaction (including failing to normally receive the information carrying the preprocessing result of the first branch transaction), the first TC sends a response message of recording failure to the first RM. The first RM may also fail to receive the response message of communication failure within the preset time, in which case it is assumed that the first TC has completed the recording of the preprocessing result of the first branch transaction. This document does not limit whether the first TC sends a response to step S710 to the first RM, and how to respond specifically.

[0187] S712: The first RM sends the pre-processing result of the first branch transaction to the TM. Correspondingly, the TM receives the response information.

[0188] In the embodiment of the present application, the pre-processing result of the first branch transaction sent by the first RM to the TM is response information to the first information sent by the TM in step S704.

[0189] It should be noted that the first RM may execute S712 after confirming receipt of the fifth response. Alternatively, the first RM may execute step S712 independently of the fifth response, that is, step S712 and step S711 may be executed simultaneously or sequentially, and the order is not limited.

[0190] Process 4: Second branch transaction creation process.

[0191] S713: The TM sends first information to the second RM. Correspondingly, the second RM receives the first information, where the first information is used to indicate identification information of the first TC and identification information of the global transaction.

[0192] It should be noted that S713 and step S704 can be executed in parallel or sequentially with no limitation on the order. It can also be understood that S713-S727 and S704-S712 can be executed in parallel or sequentially with no limitation on the order. This article does not make any limitation on this.

[0193] S714 : The second RM sends a first request to the second TC based on the first information. The first request is used to request creation of a second branch transaction of the global transaction. The first request includes the first information. Accordingly, the second TC receives the first request.

[0194] S715. The second TC creates a second branch transaction based on the first request, generates identification information of the second branch transaction, and records a first association relationship and a second association relationship. The first association relationship includes an association relationship between the identification information of the second branch transaction and the identification information of the first TC, and the second association relationship includes an association relationship between the identification information of the second branch transaction and the identification information of the second RM.

[0195] In some other possible implementations, the first association relationship includes an association relationship among identification information of the second branch transaction, identification information of the first TC, and identification information of the global transaction.

[0196] In the embodiments of the present application, the first association relationship and the second association relationship may also be merged into a single association relationship, which is not limited herein. For example, the association relationship may be merged into the identification information of the second branch transaction, the identification information of the first TC, and the identification information of the second RM, or the association relationship may be merged into the identification information of the second branch transaction, the identification information of the first TC, the identification information of the first TC, and the identification information of the second RM.

[0197] S716: The second TC sends a first registration message to the first TC. The first registration message includes identification information of the global transaction and identification information of the second branch transaction. Correspondingly, the first TC receives the first registration message.

[0198] S717: The first TC records a third association relationship based on the first registration message, where the third association relationship includes an association relationship among the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC.

[0199] S718: The first TC sends a second response to the second TC. The second response is used to indicate that the second branch transaction is successfully registered. Correspondingly, the second TC receives the second response.

[0200] In some other possible implementations, the second response may also be omitted, which is not limited herein. Specific details may refer to the relevant description in the above step S609, which will not be described in detail here.

[0201] S719: The second TC sends a first response to the second RM. The first response includes identification information of the second branch transaction. Correspondingly, the second RM receives the first response.

[0202] In the embodiment of the present application, the first response is also used to indicate that the second branch transaction is successfully registered. After receiving the first response, the second RM can record the identification information of the second branch transaction, or record the corresponding relationship between the identification information of the second branch transaction and the identification information of the global transaction.

[0203] Process 5: Second branch transaction pre-processing process.

[0204] S720: The second RM pre-processes the second branch transaction based on the first response and obtains a pre-processing result of the second branch transaction.

[0205] S721: The second RM sends the pre-processing result of the second branch transaction to the second TC. Correspondingly, the second TC receives the pre-processing result of the second branch transaction.

[0206] S722: The second TC records the pre-processing result of the second branch transaction.

[0207] In some possible implementations, the second TC recording the preprocessing result of the second branch transaction includes recording a correspondence between the preprocessing result of the second branch transaction and the identification information of the branch transaction. In other possible implementations, the second TC may not record the preprocessing result of the second branch transaction, but may instead forward it to the first TC for storage. If the second TC needs to query the preprocessing result of the second branch transaction, it may obtain the preprocessing result from the first TC.

[0208] S723: The second TC sends the pre-processing result of the second branch transaction to the first TC based on the first association relationship.

[0209] It should be noted that steps S722 and S723 may be performed simultaneously or sequentially, which is not limited in this document.

[0210] S724: The first TC records the pre-processing result of the second branch transaction.

[0211] In some possible implementations, recording the preprocessing result of the second branch transaction by the first TC includes recording a correspondence between the preprocessing result of the second branch transaction and the identification information of the branch transaction. In other possible implementations, the first TC may not record the preprocessing result of the second branch transaction, but may instead store the preprocessing result of the second branch transaction at the second TC. If the first TC needs to query the preprocessing result of the second branch transaction, the first TC may obtain the preprocessing result from the second TC. This is not limited herein.

[0212] In some other possible implementations, the second TC may not send the pre-processing result of the second branch transaction to the first TC, which is not limited herein.

[0213] S725 , the first TC sends a sixth response to the second TC, where the sixth response is used to indicate that the pre-processing result of the second branch transaction has been recorded. Correspondingly, the second TC receives the sixth response.

[0214] In the embodiment of the present application, the sixth response may carry identification information of the second branch transaction.

[0215] It should be noted that, in some other possible implementations, the sixth response may also be omitted. The basis for this is similar to the basis for the omission of the second response and will not be described in detail here.

[0216] S726: The second TC sends a seventh response to the second RM. The seventh response is used to indicate that the pre-processing result of the second branch transaction has been recorded. Correspondingly, the second RM receives the seventh response.

[0217] In the embodiment of the present application, the seventh response may carry identification information of the second branch transaction. The seventh response and the eighth response may be the same or different, which is not limited herein.

[0218] It should be noted that, in some other possible implementations, the seventh response may also be omitted. The basis for its omission is similar to the basis for the omission of the second response and will not be described in detail here.

[0219] S727 : The second RM sends an eighth response to the TM. The eighth response is used to indicate the pre-processing result of the second branch transaction. Correspondingly, the TM receives the eighth response.

[0220] In this embodiment of the present application, the eighth response is the response information of the second RM to the first information of step S713.

[0221] Process 6: Formal processing flow of the global transaction (including steps S728-S738), wherein S729-S733 can be understood as the formal processing flow of the second branch transaction, and S734-S736 can be understood as the formal processing flow of the first branch transaction.

[0222] S728: The TM sends second indication information to the first TC, where the second indication information is used to indicate a commit operation or a rollback operation of the global transaction.

[0223] In an embodiment of the present application, the TM determines whether to execute the global transaction (executing the global transaction is also referred to as a commit operation of the global transaction) or cancel the execution of the global transaction (canceling the execution of the global transaction is also referred to as a rollback operation of the global transaction) based on the received pre-processing result of the first branch transaction and the pre-processing result of the second branch transaction. If the pre-processing result of the first branch transaction and the pre-processing result of the second branch transaction are both successful, the TM determines to initiate a commit operation of the global transaction; otherwise (the pre-processing result of the first branch transaction and / or the pre-processing result of the second branch transaction is an execution failure), the TM determines to initiate a rollback operation of the global transaction.

[0224] In an embodiment of the present application, the second indication information may include identification information of the above-mentioned global transaction.

[0225] S729: The first TC sends first indication information to the second TC based on the third association relationship and the second indication information. The first indication information is used to indicate a commit operation or a rollback operation of the second branch transaction.

[0226] In some possible implementations, the first indication information includes identification information of the second branch transaction, and the first indication information is used to directly indicate a commit or rollback operation of the second branch transaction.

[0227] In some other possible implementations, the first indication information may also include identification information of the global transaction. By instructing the execution of a commit or rollback operation for the global transaction, the first indication information indirectly indicates the commit or rollback operation for the second branch transaction. For example, if the first association recorded in the second transaction controller includes an association between identification information of the branch transaction, identification information of the first transaction controller, and identification information of the global transaction, the second transaction controller may determine, based on the identification information of the global transaction included in the first indication information and the first association, that the first indication information is used to indicate the commit or rollback operation for the second branch transaction. In this approach, the first indication information and the second indication information may be the same.

[0228] S730: The second TC sends third indication information to the second RM based on the second association relationship and the first indication information. The third indication information is used to indicate a commit operation or a rollback operation of the second branch transaction.

[0229] In some possible implementations, the third indication information includes identification information of the second branch transaction, and the third indication information is used to directly indicate a commit or rollback operation of the second branch transaction.

[0230] In some other possible implementations, the third indication information may also include identification information of the global transaction. The third indication information indirectly indicates the commit or rollback operation of the second branch transaction by indicating the execution of the commit or rollback operation of the global transaction. For example, if the second RM records the association between the identification information of the branch transaction and the identification information of the global transaction, the second RM can determine that the third indication information is used to indicate the commit or rollback operation of the second branch transaction based on the identification information of the global transaction included in the first indication information and the association. In this method, the third indication information can be the same as the second indication information described above.

[0231] As an example, the first association relationship includes the identification information of the second branch transaction, the identification information of the first TC, and the association relationship between the second RM. The second TC determines that the third indication information needs to be sent to the second RM based on the first association relationship.

[0232] S731, the second RM performs a commit operation or a rollback operation of the second branch transaction based on the third indication information, and sends a ninth response to the second TC, where the ninth response is used to indicate the formal processing result of the second branch transaction. Accordingly, the second TC receives the ninth response.

[0233] In the embodiment of the present application, the formal processing result of the second branch transaction is the processing result of the commit operation or the rollback operation performed on the second branch transaction. For example, if the second indication information is used to indicate the rollback of the global transaction (i.e., the third indication information is used to indicate the rollback operation of the second branch transaction), the second RM sends a processing result indicating whether the rollback operation of the second branch transaction is completed to the second TC.

[0234] In some possible implementations, after receiving the ninth response, the second TC may further store the official processing result of the second branch transaction. In other possible implementations, the second TC may not store the official processing result of the second branch transaction, but may instead forward it to the first TC for storage. The first TC then retrieves the official processing result of the second branch transaction from the first TC when the second TC needs to query it.

[0235] S732: The second TC sends a tenth response to the first TC based on the ninth response and the first association relationship. The tenth response is used to indicate the official processing result of the second branch transaction. Accordingly, the first TC receives the tenth response.

[0236] S733: The first TC records the formal processing result of the second branch transaction.

[0237] S734: The first TC sends fourth indication information to the first RM based on the second indication information. The fourth indication information is used to indicate a commit operation or a rollback operation of the first branch transaction.

[0238] It should be noted that step S733 and step S729 may be executed simultaneously or sequentially, and the order of execution is not limited.

[0239] S735. The first RM performs a commit or rollback operation on the first branch transaction based on the fourth indication information, and sends an eleventh response to the first TC. The eleventh response is used to indicate the formal processing result of the first branch transaction. Accordingly, the first TC receives the response information.

[0240] It should be noted that the operations indicated by the first indication information, the second indication information, the third indication information, and the fourth indication information are unified, that is, they all indicate a commit operation of a transaction or a rollback operation of a transaction.

[0241] S736: The first TC records the formal processing result of the first branch transaction.

[0242] S737 : The first TC determines the processing result of the global transaction based on the formal processing result of the first branch transaction and the formal processing result of the second branch transaction, and records the correspondence between the processing result of the global transaction and the identification information of the global transaction.

[0243] S738: The first TC requests the TM to terminate the global transaction.

[0244] Understandably, in a cross-center scenario, if the initiator of a global transaction of a business is the TM corresponding to the first center, if you still refer to Figure 2 Based on Figure 2 If the processing flow shown is used for cross-center transaction processing, the branch transactions of other centers involved in the business will not be able to complete the commit and rollback operations.

[0245] For example, refer again to Figure 3 TM initiates a commit or rollback operation on the global transaction to TC1 in the trading center. However, since TC1 only manages branch transaction information within its own center, it cannot commit or rollback another branch transaction of the same business initiated by credit centers TC2 and RM2. In other words, the cross-center transaction commit or rollback operation fails, and transaction consistency cannot be guaranteed.

[0246] However, this application Figure 7 In the provided transaction processing method, a first TC records a third association based on a first registration message. After receiving second indication information from a TM indicating initiation of a commit or rollback operation for a global transaction, the first TC sends the first indication information to a second TC based on the third association (which can also be understood as forwarding the commit or rollback operation of the global transaction). The second TC then sends the third indication information to a second RM, thereby successfully completing the unified management of cross-center transaction commit or rollback operations and ensuring transaction consistency.

[0247] The following combination Figure 8 introduce Figure 5 Another implementation of the method shown. Figure 8 In the transaction processing method shown, the first TC creates a second branch transaction based on the first registration message, allocates identification information to the second branch transaction, and then sends the identification information of the second branch transaction to the second TC. Figure 8 As shown, the method includes:

[0248] S801: The TM sends a second request to the first TC. The second request is used to request creation of a global transaction. Correspondingly, the first TC receives the second request.

[0249] S802: The first TC creates a global transaction based on the second request and generates identification information of the global transaction.

[0250] S803: The first TC sends a third response to the TM. The third response includes identification information of the global transaction.

[0251] S804, the TM sends first information to the second RM, where the first information is used to indicate identification information of the global transaction and identification information of the first TC. Correspondingly, the second RM receives the first information.

[0252] S805 : The second RM sends a first request to the second TC based on the first information. The first request is used to request creation of a second branch transaction of the global transaction. The first request includes the first information. Accordingly, the second TC receives the first request.

[0253] The description of steps S801-S805 can refer to the above steps S501-S505 and will not be described in detail here.

[0254] S806: The second TC sends a first registration message to the first TC. The first registration message is used to request creation of a second branch transaction of the global transaction. Correspondingly, the first TC receives the first registration message.

[0255] In an embodiment of the present application, the first registration message includes identification information of the global transaction.

[0256] The first registration message is generated by the second TC based on the first request received from the second RM.

[0257] Regarding how the second TC obtains the communication address of the first TC, reference may be made to the relevant description in step S506 above, which will not be described in detail here.

[0258] S807: The first TC creates the second branch transaction based on the first registration message, generates identification information of the second branch transaction, and records the third association relationship.

[0259] In the embodiment of the present application, the third association relationship includes an association relationship among the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC.

[0260] S808: The first TC sends a second response to the second TC. The second response includes identification information of the second branch transaction. Correspondingly, the second TC receives the second response.

[0261] In this embodiment of the present application, after the first TC creates the second branch transaction, it sends the second response to the second TC. The order in which the first TC records the third association relationship and the first TC sends the second response to the second TC can be performed simultaneously or sequentially, and the order of execution is not limited.

[0262] In some other possible implementations, after receiving the second response, the second TC may record the first association relationship, where the first association relationship includes the association relationship between the identification information of the second branch transaction and the identification information of the first TC. In some other possible implementations, the first association relationship includes the association relationship between the identification information of the second branch transaction, the identification information of the first TC, and the identification information of the global transaction.

[0263] It should be noted that, in some other possible implementations, the second response may be omitted. For details, please refer to the relevant description of step S507, which will not be described in detail here.

[0264] S809: The second TC sends a first response to the second RM based on the second response. The first response includes identification information of the second branch transaction. Correspondingly, the second RM receives the first response.

[0265] exist Figure 8 Based on the transaction processing method provided, combined with some other processing processes involved in the entire life cycle of the global transaction, including the transaction processing method for the first branch transaction creation operation initiated by the first RM in the first center and the pre-processing operation, commit or rollback operation of the first branch transaction and the second branch transaction, you can refer to Figure 7 The description of the relevant steps in the global transaction creation process, the first branch transaction creation process, the second branch transaction pre-processing process, and the formal processing process of the global transaction will not be repeated here.

[0266] By adopting the transaction processing method provided in the embodiment of the present application, after the first TC creates the second branch transaction, the identification information of the second branch transaction is sent to the second TC through the second response. That is, the branch transactions related to the above-mentioned global transaction are all managed by the main center. Then, for the signaling messages related to the second branch transaction, such as the request signaling of the second RM requesting to create the second branch transaction of the global transaction managed by the first TC, or the response signaling returned by the second TC indicating the successful registration of the second branch transaction, the second TC can directly forward them to the first TC or the second RM after identification, without further understanding the management action or matter of the second branch transaction, thereby reducing the repeated operations of the same management action for the branch transaction in the second TC. For example, there is no need to repeatedly store the association between the identification information of the second branch transaction and the identification information of the global transaction in the second TC, and there is no need to repeatedly store the pre-processing results and formal processing results of the second branch transaction in the second TC.

[0267] The present application also provides a transaction processing method, which is applied to a transaction processing system, wherein the transaction processing system includes a first center and a second center, wherein the first center includes a transaction manager TM, a first transaction coordinator TC, and a first resource manager RM, and the second center includes a second TC and a second RM; the method includes: the TM sending a second request to the first TC, wherein the second request is used to request the creation of a global transaction; the first TC creates the global transaction based on the second request and determines the identification information of the global transaction; the first TC sends a third response to the TM, wherein the third response includes the identification information of the global transaction; after receiving the third response, the TM sends a first message to the second RM, wherein the first message is used to indicate the identification information of the first TC and the identification information of the global transaction; the second The RM sends a first request to the second TC based on the first information, where the first request includes the first information and is used to request creation of a second branch transaction of the global transaction; the second TC sends a first registration message to the first TC based on the identification information of the first TC, where the first registration message is used to request registration of the second branch transaction of the global transaction; the first TC records a third association relationship based on the first registration message, where the third association relationship includes an association relationship between the identification information of the global transaction, the identification information of the second branch transaction, and the identification information of the second TC, where the identification information of the second branch transaction is generated by the first TC or the second TC; and the second TC sends a first response to the second RM, where the first response includes the identification information of the second branch transaction.

[0268] In some possible implementations, the identification information of the second branch transaction is generated by the second TC based on the first request, and the first registration message includes the identification information of the global transaction and the identification information of the second branch transaction. In some possible implementations, before the second TC sends the first response to the second RM, the method further includes: the first TC sending a second response to the second TC, where the second response is used to indicate that the second branch transaction was successfully registered.

[0269] In some other possible implementations, the first registration message is used to request the first TC to create a second branch transaction of the global transaction, the identifier of the second branch transaction is generated by the first TC based on the first registration message, and before sending the first response to the second RM, the method further includes: the first TC sending a second response to the second TC, the second response including identifier information of the second branch transaction, and the second response indicating that the second branch transaction is successfully registered.

[0270] In some possible implementations, the first registration message further includes identification information of the second TC, which is used to indicate that the first registration message originates from the second TC.

[0271] In some possible implementations, a fourth association relationship is configured in the second TC, and the fourth association relationship includes an association relationship between the identification information of the first TC and the communication address of the first TC. The second TC sends the first registration message to the first TC based on the identification information of the first TC, including: the second TC determines the communication address of the first TC based on the identification information of the first TC and the fourth association relationship; and the second TC sends the first registration message to the first TC based on the communication address of the first TC.

[0272] In some possible implementations, the first registration message also includes identification information of the second TC, a fifth association relationship is configured in the first TC, the fifth association relationship includes an association relationship between the identification information of the second TC and the communication address of the second TC, and the first TC sends a second response to the second TC including: the first TC determines the communication address of the second TC based on the identification information of the second TC and the fifth association relationship; and the first TC sends the second response to the second TC based on the communication address of the second TC.

[0273] In some possible implementations, the method further includes recording a first association relationship in the second TC, the first association relationship including an association relationship between identification information of the second branch transaction and identification information of the first TC, and the method further includes: the second RM preprocessing the second branch transaction based on the identification information of the second branch transaction to obtain a preprocessing result of the second branch transaction; the second RM sending the preprocessing result of the second branch transaction to the second TC; the second TC sending the preprocessing result of the second branch transaction to the first TC based on the first association relationship, and the first TC recording the preprocessing result of the second branch transaction.

[0274] In some possible implementations, the method further includes: the first TC receiving second indication information from the TM, the second indication information being used to instruct execution of the global transaction or to instruct cancellation of execution of the global transaction; the first TC sending first indication information to the second TC based on the second indication information and the third association relationship, the first indication information being used to instruct execution of the second branch transaction or to instruct cancellation of execution of the second branch transaction; the second TC sending third indication information to the second RM based on the first indication information and the first association relationship, the third indication information being used to instruct execution of the second branch transaction or to instruct cancellation of execution of the second branch transaction; and the second RM executing the second branch transaction or canceling execution of the second branch transaction based on the third indication information.

[0275] Based on the same concept of the above transaction processing method, the present application also provides the following transaction processing device:

[0276] Figure 9 FIG1 shows a schematic diagram of a possible transaction processing device. It is understood that the transaction processing device 90 includes necessary means such as modules, units, components, circuits, or interfaces, which are appropriately configured together to implement the present solution. The transaction processing device 90 may be Figure 1 The RAN node or terminal device in the embodiment, or a component (e.g., a chip) in such device, is used to implement the method described in the above method embodiment. The transaction processing device 90 includes one or more processors 91 (one processor is shown in the figure). The processor 91 can be a general-purpose processor or a dedicated processor. For example, it can be a baseband processor or a central processing unit. The baseband processor can be used to process communication protocols and communication data, and the central processing unit can be used to control the transaction processing device (e.g., RAN node, terminal device, or chip), execute software programs, and process software program data.

[0277] Optionally, in one design, the processor 91 may include a program 93 (sometimes also referred to as code or instruction), which may be executed on the processor 91 to enable the transaction processing device 90 to perform the method described in the above embodiment. In another possible design, the transaction processing device 90 includes a circuit ( Figure 9 (not shown), the circuit is used to implement the functions of the network device or terminal device in the above embodiments.

[0278] Optionally, the transaction processing device 90 may include one or more memories 92 (one memory is shown in the figure), on which a program 94 (sometimes also referred to as code or instructions) is stored. The program 94 can be run on the processor 91, so that the transaction processing device 90 executes the method described in the above method embodiment.

[0279] Optionally, the processor 91 and / or the memory 92 may include artificial intelligence (AI) modules 97 and 98, which are used to implement AI-related functions. The AI ​​module can be implemented through software, hardware, or a combination of software and hardware. For example, the AI ​​module may include a radio access network intelligent controller (RAN intelligent controller, RIC) module. For example, the AI ​​module may be a near real-time RIC or a non-real-time RIC.

[0280] Optionally, data may also be stored in the processor 91 and / or the memory 92. The processor and the memory may be provided separately or integrated together.

[0281] Optionally, the transaction processing device 90 may further include a transceiver 95 and / or an antenna 96. The processor 91, sometimes also referred to as a processing unit, controls the transaction processing device (e.g., a RAN node or terminal device). The transceiver 95, sometimes also referred to as a transceiver unit, a transceiver, a transceiver circuit, or a transceiver, is configured to implement the transceiver functions of the transaction processing device via the antenna 96. For example, the transceiver 95 may include a receiver and a transmitter, which may be integrated or independent components.

[0282] As an example, when the transaction processing device 90 is used to implement the function of the second TC, the receiver is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the second TC implements the receiving action, and the transmitter is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the second TC implements the sending action, and the memory 92 is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the second TC implements the storage action. For example, the receiver is used to implement Figure 5 In the embodiment shown, the transmitter is used to implement the action of receiving in step S505. Figure 5 In the embodiment shown, the sending action in steps S506 and S508 is implemented by the memory. Figure 7The storage action in step S715 in the illustrated embodiment.

[0283] As another example, when the transaction processing device 90 is used to implement the function of the first TC, the receiver is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the receiving action, and the transmitter is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the sending action, and the memory is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the storage action. For example, the receiver is used to implement Figure 5 In the embodiment shown, the transmitter is used to implement the actions received in steps S501 and S506. Figure 6 In the embodiment shown, the sending action in step S609 is implemented by the memory. Figure 5 The storage action in step S507 in the illustrated embodiment.

[0284] As an example, the transaction processing device 90 can also be used to implement the function of TM, or to implement the function of the first RM, or to implement the function of the second RM, which will not be described in detail here.

[0285] like Figure 10 As shown, it is a structural diagram of another transaction processing device provided in an embodiment of the present application, and the transaction processing device 1000 includes a processor 1001. Optionally, the transaction processing device 1000 may further include an interface circuit 1002 (indicated by a dotted line in the figure), and the processor 1001 and the interface circuit 1002 are coupled to each other. It can be understood that the interface circuit 1002 can be a transceiver or an input-output interface. Optionally, the transaction processing device 1000 may further include a memory 1003 (indicated by a dotted line in the figure), and the memory 1003 is used to store instructions executed by the processor 1001, or to store input data required for the processor 1001 to run instructions, or to store data generated after the processor 1001 runs instructions. Among them, the processor 1001 is used to implement the above Figure 9 The functions of the processor 91 in the embodiment shown; and the interface circuit 1002 is used to implement the above Figure 9 Functionality of transceiver 95 in the embodiment shown.

[0286] As an example, when the transaction processing device 1000 is a chip used in a second transaction controller (TC), the chip implements the functions of the second TC in the above method embodiments. The chip receives information from other modules (such as a radio frequency module or antenna) in the second TC, where the information is sent from the first TC or the second managed resource manager (RM); or the chip sends information from the second TC to the first TC or the second managed resource manager (RM) via other modules (such as a radio frequency module or antenna).

[0287] As another example, when the transaction processing device 1000 is a chip implemented in a first transaction controller (TC), the chip implements the functions of the first TC in the above method embodiments. The chip receives information from other modules (e.g., a radio frequency module or antenna) within the first TC, where the information is sent to the first TC by a second TC, a first managed resource manager (RM), or a managed transaction manager (TM); or the chip sends information via other modules (e.g., a radio frequency module or antenna) where the information is sent to the second TC, a first managed resource manager (RM), or a managed transaction manager (TM).

[0288] As another example, the transaction processing device 1000 may also be a chip applied to the TM, or may also be a chip applied to the first RM, or may also be a chip applied to the second RM, which will not be described in detail here.

[0289] In addition, it should be noted that the aforementioned transceiver unit and / or processing unit may be implemented through virtual modules, for example, the processing unit may be implemented through a software function unit or a virtual device, and the transceiver unit may be implemented through a software function or a virtual device. Alternatively, the processing unit or transceiver unit may also be implemented through a physical device, for example, if the device is implemented using a chip / chip circuit, the transceiver unit may be an input / output circuit and / or a communication interface, performing input operations (corresponding to the aforementioned receiving operations) and output operations (corresponding to the aforementioned sending operations); the processing unit is an integrated processor or microprocessor or integrated circuit.

[0290] like Figure 11 FIG. 1 is a structural diagram of another transaction processing device provided in an embodiment of the present application. The transaction processing device 1100 includes a transceiver unit 1101 and a processing unit 1102.

[0291] Illustratively, the transceiver unit 1101 may include a receiving unit and a sending unit. The receiving unit and the sending unit may be a whole or independent units.

[0292] As an example, when the transaction processing device 1100 is used to implement the function of the second TC, the receiving unit is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the second TC implements the receiving action, and the sending unit is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the sending action of the embodiment shown, the processing unit can be used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 The storage action implemented by the second TC in the embodiment shown, or implemented by an additional memory Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the second TC implements the storage action. For example, the receiving unit is used to implement Figure 5 In the embodiment shown, the sending unit is used to implement the action of receiving in step S505. Figure 5 In the embodiment shown, the sending action in steps S506 and S508 is implemented by the processing unit or the additional memory. Figure 7 The storage action in step S715 in the illustrated embodiment.

[0293] As another example, when the transaction processing device 1100 is used to implement the function of the first TC, the receiving unit is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the receiving action, and the sending unit is used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the sending action, and the processing unit can be used to implement Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 The storage action implemented by the first TC in the embodiment shown, or implemented by an additional memory Figure 5 、 Figure 6 、 Figure 7 ,or Figure 8 In the embodiment shown, the first TC implements the storage action. For example, the receiving unit is used to implement Figure 5 In the embodiment shown, the sending unit is used to implement the action of receiving in step S505. Figure 5 In the embodiment shown, the sending action in steps S506 and S508 is implemented by the processing unit or the additional memory. Figure 7 The storage action in step S715 in the illustrated embodiment.

[0294] As an example, the transaction processing device 1100 can also be used to implement the function of TM, or to implement the function of the first RM, or to implement the function of the second RM, which will not be described in detail here.

[0295] For the implementation of the above-mentioned transceiver unit 1101 and processing unit 1102, please refer to Figure 3-Figure 11 Related description in the illustrated embodiment.

[0296] The division of modules in this application is illustrative and represents only a logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the examples of this application may be integrated into a single processor, exist physically as separate modules, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in either hardware or software functional modules.

[0297] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.

[0298] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program or instruction is stored. When the computer program or instruction is executed, the method in the above embodiment is implemented.

[0299] An embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method in the above embodiment.

[0300] An embodiment of the present application also provides a transaction processing system, including the above-mentioned transaction processing device.

[0301] An embodiment of the present application also provides a transaction processing system, which includes a first center and a second center, the first center including a transaction manager TM, a first transaction coordinator TC and a first resource manager RM, the second center including a second TC and a second RM, the second TC being used to implement the steps or methods performed by the second TC in the method of the above embodiment, the first TC being used to implement the steps or methods performed by the first TC in the method of the above embodiment, the TM being used to implement the steps or methods performed by the TM in the method of the above embodiment, the first RM being used to implement the steps or methods performed by the first RM in the method of the above embodiment, and the second RM being used to implement the steps or methods performed by the second RM in the method of the above embodiment.

[0302] The present application also provides a circuit, which is coupled to a memory and is used to execute the method shown in the above embodiment. The circuit may include a chip circuit.

[0303] An embodiment of the present application also provides a chip device, including a processor, configured to call a computer program or computer instruction stored in the memory so that the processor executes the method provided in any one of the above embodiments.

[0304] In a possible implementation, the input of the chip device corresponds to the receiving operation in any of the foregoing embodiments, and the output of the chip device corresponds to the sending operation in any of the foregoing embodiments.

[0305] Optionally, the processor is coupled to the memory via an interface.

[0306] Optionally, the chip device further includes a memory, in which computer programs or computer instructions are stored.

[0307] It should be noted that the above units or one or more of the units can be implemented by software, hardware, or a combination of the two. When any of the above units or units is implemented by software, the software exists in the form of computer program instructions and is stored in a memory, and a processor can be used to execute the program instructions and implement the above method flow.

[0308] In this application, a processor may be a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field-programmable gate array or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component, and may implement or execute the methods, steps, and logic block diagrams disclosed in this application. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in this application may be directly executed by a hardware processor, or by a combination of hardware and software modules within the processor.

[0309] When the above units or units are implemented in hardware, the hardware can be any one or any combination of a CPU, a microprocessor, a digital signal processing (DSP) chip, a microcontroller unit (MCU), an artificial intelligence processor, an ASIC, a SoC, an FPGA, a PLD, a dedicated digital circuit, a hardware accelerator or a non-integrated discrete device, which can run the necessary software or not rely on the software to execute the above method flow.

[0310] Optionally, an embodiment of the present application further provides a chip system, comprising: at least one processor and an interface, wherein the at least one processor is coupled to a memory via the interface, and when the at least one processor executes a computer program or instruction in the memory, the chip system executes the method in any of the above method embodiments. Optionally, the chip system may be composed of a chip, or may include a chip and other discrete devices, which is not limited in the embodiments of the present application.

[0311] The memory in this application may also be a circuit or any other device capable of implementing a storage function for storing program instructions and / or data. A memory is any other medium that can be used to carry or store desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. For example, the memory may be a non-volatile memory, such as a digital versatile disc (DVD), a hard disk drive (HDD), or a solid-state drive (SSD), or a volatile memory (volatile memory), such as a random-access memory (RAM).

[0312] It is understood that, in this application, "indication" can include direct indication, indirect indication, explicit indication, and implicit indication. When describing a certain indication information as indicating A, it can be understood that the indication information carries A, directly indicates A, or indirectly indicates A. In this application, the information indicated by the indication information is referred to as the information to be indicated. During implementation, there are many ways to indicate the information to be indicated. For example, but not limited to, the information to be indicated can be directly indicated, such as the information to be indicated itself or an index of the information to be indicated, or it can be indirectly indicated by indicating other information, where the other information is associated with the information to be indicated. It is also possible to indicate only a portion of the information to be indicated, while the rest of the information to be indicated is known or agreed upon in advance. For example, it is also possible to indicate specific information by using a pre-agreed (e.g., protocol-specified) order of arrangement of various information, thereby reducing the indication overhead to a certain extent. The information to be indicated can be sent as a whole or divided into multiple sub-information and sent separately, and the sending period and / or sending timing of these sub-information can be the same or different. This application does not limit the detailed sending method. The sending period and / or sending timing of these sub-information may be predefined, for example, predefined according to a protocol, or may be configured by the transmitting end device by sending configuration information to the receiving end device.

[0313] The at least one (item) involved in this application indicates one (item) or more (items). More than one (item) refers to two (items) or more than two (items). "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. In addition, it should be understood that although the terms first, second, etc. may be used to describe each object in this application, these objects should not be limited to these terms. These terms are only used to distinguish each object from each other.

[0314] The terms "including" and "having" mentioned above and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any method or design described in this application as "exemplary" or "for example" should not be interpreted as being more preferred or more advantageous than other methods or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a more detailed manner.

[0315] A node in a transaction processing system (TM, RM, or TC can all be referred to as a node) can send signals to another node or receive signals from another network element. Signals can include information, signaling, or data. The term "node" can also be replaced by an entity, network entity, device, terminal device, communication module, communication node, etc. This application uses the specific names of nodes as examples for description.

[0316] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode.

[0317] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art can understand and implement other changes to the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "a" or "an" does not exclude multiple situations. A single processor or other unit can implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0318] It will be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. The size of the sequence numbers of the above-mentioned processes does not mean the order of execution, and the order of execution of each process should be determined by its function and internal logic. In the above-mentioned embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The components in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs. Those skilled in the art can combine or combine the different embodiments described in this specification and the features of the different embodiments.

[0319] In this application, under the premise of no logical contradiction, the examples can reference each other, for example, the methods and / or terms between method embodiments can reference each other, for example, the functions and / or terms between device embodiments can reference each other, for example, the functions and / or terms between device examples and method examples can reference each other.

Claims

1. A transaction processing method, characterized in that: The method is applied to a second transaction coordinator TC in a transaction processing system, wherein the transaction processing system includes a first center and a second center, wherein the first center includes a transaction manager TM, a first TC, and a first resource manager RM, and the second center includes a second RM and the second TC. The method includes: The second TC receives a first request from the second RM, where the first request is used to request creation of a branch transaction of a global transaction, the global transaction is created by the first TC, and the branch transaction belongs to the first TC. The first request includes first information, where the first information is used to indicate identification information of the first TC and identification information of the global transaction. The second TC sends a first registration message to the first TC based on the identification information of the first TC, where the first registration message is used to request registration of a branch transaction of the global transaction; The second TC sends a first response to the second RM, where the first response includes identification information of the branch transaction, where the identification information of the branch transaction is generated by the first TC or the second TC.

2. The method according to claim 1, characterized in that The identification information of the branch transaction is generated by the second TC based on the first request, and the first registration message includes the identification information of the global transaction and the identification information of the branch transaction.

3. The method according to claim 2, characterized in that Before sending the first response to the second RM, the method further includes: The second TC receives a second response from the first TC, where the second response is used to indicate that the branch transaction is successfully registered.

4. The method according to claim 1, wherein The first registration message is used to request the first TC to create a branch transaction of the global transaction, and the identifier of the branch transaction is generated by the first TC based on the first registration message. Before sending the first response to the second RM, the method further includes: The second TC receives a second response from the first TC, where the second response includes identification information of the branch transaction, and the second response is used to indicate that the branch transaction is successfully registered.

5. The method according to any one of claims 1 to 4, characterized in that The second TC records a first association relationship, where the first association relationship includes an association relationship between identification information of the branch transaction and identification information of the first TC. The method further includes: The second TC receives a pre-processing result of the branch transaction from the second RM; The second TC sends the pre-processing result of the branch transaction to the first TC based on the first association relationship.

6. The method according to any one of claims 1 to 5, characterized in that The second TC records a second association relationship, where the second association relationship includes an association relationship between the identification information of the branch transaction and the identification information of the second RM. The method further includes: The second TC receives first indication information from the first TC, where the first indication information is used to instruct execution of the branch transaction or to instruct cancellation of execution of the branch transaction; The second TC sends the third indication information to the second RM based on the first indication information and the second association relationship, where the third indication information is used to instruct execution of the branch transaction or to instruct cancellation of execution of the branch transaction.

7. The method according to any one of claims 1 to 6, characterized in that The second TC is configured with a fourth association relationship, the fourth association relationship including an association relationship between the identification information of the first TC and the communication address of the first TC, and the second TC sending the first registration message to the first TC based on the identification information of the first TC includes: The second TC determines the communication address of the first TC based on the identification information of the first TC and the fourth association relationship; The second TC sends the first registration message to the first TC based on the communication address of the first TC.

8. A transaction processing method, characterized in that: The method is applied to a first transaction coordinator TC in a transaction processing system, wherein the transaction processing system includes a first center and a second center, wherein the first center includes a transaction manager TM, the first TC, and a first resource manager RM, and the second center includes a second TC and a second RM. The method includes: The first TC receives a first registration message from the second TC, where the first registration message is used to request registration of a branch transaction of a global transaction, where the global transaction is created by the first TC; The first TC records a third association relationship based on the first registration message, where the third association relationship includes an association relationship between identification information of the global transaction, identification information of the branch transaction, and identification information of the second TC, where the identification information of the branch transaction is generated by the first TC or the second TC.

9. The method according to claim 8, characterized in that The identification information of the branch transaction is generated by the second TC, and the first registration message includes the identification information of the global transaction and the identification information of the branch transaction.

10. The method according to claim 9, characterized in that After recording the third association relationship, the method further includes: The first TC sends a second response to the second TC, where the second response is used to indicate that the branch transaction is successfully registered.

11. The method according to claim 8, characterized in that The first registration message is used to request the first TC to create a branch transaction of the global transaction. The identification information of the branch transaction is generated by the first TC based on the first registration message. After recording the third association relationship, the method further includes: The first TC sends a second response to the second TC, where the second response includes identification information of the branch transaction, and the second response is used to indicate that the branch transaction is successfully registered.

12. The method according to any one of claims 8 to 11, characterized in that The method further comprises: The first TC receives the pre-processing result of the branch transaction from the second TC; The first TC records the pre-processing result of the branch transaction.

13. The method according to any one of claims 8 to 12, characterized in that: The method further comprises: The first TC receives second indication information from the TM, where the second indication information is used to instruct execution of the global transaction or to instruct cancellation of execution of the global transaction; The first TC sends first indication information to the second TC based on the second indication information and the third association relationship, where the first indication information is used to instruct execution of the branch transaction or to instruct cancellation of execution of the branch transaction.

14. The method according to any one of claims 8 to 13, characterized in that: The first registration message further includes identification information of the second TC. A fifth association relationship is configured in the first TC, the fifth association relationship including an association relationship between the identification information of the second TC and the communication address of the second TC. The first TC sending a second response to the second TC includes: The first TC determines the communication address of the second TC based on the identification information of the second TC and the fifth association relationship; The first TC sends the second response to the second TC based on the communication address of the second TC.

15. A transaction processing method, characterized in that: The method is applied to a transaction processing system, the transaction processing system including a first center and a second center, the first center including a transaction manager TM, a first transaction coordinator TC, and a first resource manager RM, the second center including a second TC and a second RM; the method includes: The TM sends a second request to the first TC, where the second request is used to request creation of a global transaction; The first TC creates the global transaction based on the second request and determines identification information of the global transaction; The first TC sends a third response to the TM, where the third response includes identification information of the global transaction; After receiving the third response, the TM sends first information to the second RM, where the first information is used to indicate the identification information of the first TC and the identification information of the global transaction; The second RM sends a first request to the second TC based on the first information, where the first request includes the first information and is used to request creation of a branch transaction of the global transaction; The second TC sends a first registration message to the first TC based on the identification information of the first TC, where the first registration message is used to request registration of a branch transaction of the global transaction; The first TC records a third association based on the first registration message, where the third association includes an association between identification information of the global transaction, identification information of the branch transaction, and identification information of the second TC, where the identification information of the branch transaction is generated by the first TC or the second TC. The second TC sends a first response to the second RM, where the first response includes identification information of the branch transaction.

16. A transaction processing system, characterized in that: The system includes a first center and a second center, the first center includes a transaction manager TM, a first transaction coordinator TC and a first resource manager RM, the second center includes a second TC and a second RM, the second TC is used to implement the method as described in any one of claims 1-6, the first TC is used to implement the method as described in any one of claims 7-12, the second RM is used to implement the method as described in claim 13, and the TM is used to implement the method as described in claim 14.

17. A transaction processing device, characterized in that: The method comprises a unit for implementing the method according to any one of claims 1 to 7, or comprises a unit for implementing the method according to any one of claims 8 to 14.

18. A transaction processing device, characterized in that: The invention comprises a processor and an interface circuit, wherein the interface circuit is used to receive signals from other transaction processing devices outside the transaction processing device and transmit them to the processor or send signals from the processor to other transaction processing devices outside the transaction processing device, and the processor is used to implement the method according to any one of claims 1 to 7 or the method according to any one of claims 8 to 14 through logic circuits or execution code instructions.

19. A computer-readable storage medium, characterized in that The computer-readable storage medium is used to store a computer program. When the computer program is executed, the method according to any one of claims 1 to 15 is performed.

20. A computer program product comprising instructions, characterized in that When the instruction is executed on a transaction processing device, the transaction processing device is caused to execute the method according to any one of claims 1 to 15.