Distributed transaction processing method, device, equipment, storage medium and program product

By selecting the available distributed transaction manager between multiple processing centers, the problem that traditional solutions cannot handle distributed transactions across multiple centers is solved, and high availability and data consistency of distributed transactions is achieved, ensuring business Continuity.

CN114237832BActive Publication Date: 2024-12-17SHANGHAI PUDONG DEVELOPMENT BANK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111412221.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-25
Publication Date
2024-12-17
Estimated Expiration
2041-11-25

AI Technical Summary

Technical Problem

Traditional distributed transaction processing solutions only support distributed transactions in a single center and cannot handle distributed transactions across two or more centers, resulting in data consistency and business continuity problems in high availability and disaster recovery application systems.

Method used

By selecting the available distributed transaction managers among multiple processing centers, the management and processing of distributed transactions is implemented, ensuring that when the distributed transaction manager in one center is down, the request can be routed to another center for processing. Ensure business continuity and data consistency.

Benefits of technology

It realizes distributed transaction processing across multiple centers, ensures the routing and data consistency of business requests in the event of a distributed transaction manager failure, and improves the system's availability and disaster recovery capabilities.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237832B_ABST
    Figure CN114237832B_ABST
Patent Text Reader

Abstract

The present application relates to a distributed transaction processing method, apparatus, device, storage medium and program product. The method comprises: receiving a distributed transaction processing request and determining whether the corresponding distributed transaction manager is available; when the corresponding distributed transaction manager is unavailable, selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers. The use of this method can ensure that when the distributed transaction manager of one center goes down, the service request can be routed to another center for distributed transaction processing, thereby ensuring the continuity of the service and ultimately ensuring data consistency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of distributed technology, and in particular to a distributed transaction processing method, apparatus, device, storage medium and program product. Background Art

[0002] Currently, commonly used solutions for distributed transactions include: XA database two-phase commit protocol, TCC (Try-Confirm-Cancel) lock-free solution, and Saga long-lived transaction solution.

[0003] The XA solution relies on the database and is divided into a transaction manager (TM) and a local resource manager (RM). The application (APP) applies to the TM to start a distributed transaction, the APP accesses the RM, the RM registers branch transactions with the TM, the APP executes the local transaction but does not commit it. When all branches succeed, the APP initiates a distributed transaction commit to the TM, and the TM notifies each RM to commit. If a branch fails, the APP initiates a distributed transaction rollback to the TM, and the TM notifies each RM to roll back.

[0004] The TCC solution mainly divides the business into three stages: Try, Confirm, and Cancel. Try is only used to reserve resources for the business and record related logs. If the above resource reservation is successful, the Confirm operation is performed, otherwise the Cancel operation is performed.

[0005] The Saga long-lived transaction solution is a compensatory transaction. After the business executes the forward operation, if there is no exception in the request link, the distributed transaction will be committed. Otherwise, the reverse operation is called, which is equivalent to restoring the changes made in the forward operation.

[0006] Traditional application systems are generally built based on two remote data centers for high availability and disaster recovery. The three traditional distributed transaction processing solutions only support distributed transactions in one center, and cannot handle distributed transactions across two or more centers. Summary of the invention

[0007] Based on this, it is necessary to provide a distributed transaction processing method, device, equipment, storage medium and program product that can support multiple centers in order to solve the above technical problems.

[0008] In a first aspect, the present application provides a distributed transaction processing method, which is applied to a transaction resource manager, and the method includes: receiving a distributed transaction processing request, and determining whether the corresponding distributed transaction manager is available; when the corresponding distributed transaction manager is not available, selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

[0009] In one of the embodiments, when the distributed transaction processing request is in the commit stage, after selecting a corresponding another distributed transaction manager from the normal distributed transaction managers stored locally, it includes: starting a local branch transaction and executing corresponding business processing; registering the branch transaction with the selected distributed transaction manager so that the distributed transaction manager registers the registered branch transaction.

[0010] In one of the embodiments, the executing the corresponding business processing includes: when the business processing calls another transaction resource manager, sending the selected distributed transaction manager to the other transaction resource manager so that the other transaction resource manager starts the corresponding branch transaction, and registering the branch transaction with the selected distributed transaction manager so that the distributed transaction manager registers the registered branch transaction.

[0011] In one of the embodiments, when the distributed transaction processing request is in the rollback phase, after selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, it includes: receiving a branch transaction rollback request sent by the selected distributed transaction manager; starting the rollback of the local branch transaction, and committing the rollback result of the local branch transaction after modifying the branch transaction status.

[0012] In one of the embodiments, the method further includes: receiving a branch transaction processing request sent by the selected distributed transaction manager, wherein the selected distributed transaction manager determines whether a transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, routing the branch transaction processing request to a normal transaction resource manager of the corresponding center.

[0013] In one of the embodiments, before receiving the branch transaction processing request sent by the selected distributed transaction manager, it also includes: sending a transaction commit request to the selected distributed transaction manager; receiving the branch transaction processing request sent by the selected distributed transaction manager includes: receiving the transaction commit request sent by the selected distributed transaction manager, and the transaction commit request is sent to the normal transaction resource manager of the corresponding center selected according to a preset algorithm when any transaction resource manager corresponding to the branch transaction fails.

[0014] In one of the embodiments, before receiving the branch transaction processing request sent by the selected distributed transaction manager, it also includes: sending a transaction rollback request to the distributed transaction manager; the receiving the branch transaction processing request sent by the selected distributed transaction manager includes: receiving the branch transaction rollback request sent by the selected distributed transaction manager, the branch transaction rollback request is that when the distributed transaction manager receives the transaction rollback request, it determines whether the transaction resource manager corresponding to the branch transaction is abnormal, and when the transaction resource manager is abnormal, the branch rollback request corresponding to the branch transaction is routed to the normal transaction resource manager of the corresponding center.

[0015] In one of the embodiments, the method also includes: obtaining the center identifier of the current processing center, sending the center identifier to the distributed transaction manager, and receiving the center identifier of the processing center corresponding to the distributed transaction manager; storing the center identifier of the current processing center and the center identifier of the processing center corresponding to the distributed transaction manager.

[0016] In a second aspect, the present application provides a distributed transaction processing method, which is applied to a distributed transaction manager, and the method includes: receiving a distributed transaction processing request sent by a transaction resource manager, the distributed transaction processing request is for the transaction resource manager to determine whether the corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, and sending it to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers; and processing the distributed transaction according to the distributed transaction processing request.

[0017] In one of the embodiments, when the distributed transaction processing request is in the commit stage, processing the distributed transaction according to the distributed transaction processing request includes: registering distributed transaction information according to the distributed transaction processing request, and after successful registration, sending a distributed transaction start request to the transaction resource manager, wherein the distributed transaction start request is used to instruct the transaction resource manager to start a local branch transaction, execute corresponding business processing, and send branch transaction information to another selected distributed transaction manager; registering the received branch transaction information; receiving a branch transaction commit request sent by the transaction resource manager, and updating the status of the corresponding branch transaction based on the branch transaction commit request.

[0018] In one of the embodiments, when the distributed transaction processing request is in the rollback phase, processing the distributed transaction according to the distributed transaction processing request includes: sending a branch transaction rollback request to the corresponding transaction resource manager, wherein the branch transaction rollback request is used to instruct the corresponding transaction resource manager to start the rollback of the local branch transaction and commit the rollback result of the local branch transaction.

[0019] In one of the embodiments, the method further includes: determining whether a transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, routing the branch transaction processing request to a normal transaction resource manager of the corresponding center.

[0020] In one of the embodiments, when the branch transaction processing request is in the commit stage, after routing the branch transaction processing request to the normal transaction resource manager of the corresponding center, it includes: receiving the branch transaction commit request sent by the normal transaction resource manager, and updating the transaction status of the corresponding distributed transaction according to the branch transaction commit request.

[0021] In one of the embodiments, when the branch transaction processing request is in the rollback stage, routing the branch transaction processing request to the normal transaction resource manager of the corresponding center includes: routing the rollback request corresponding to the branch transaction to the normal transaction resource manager of the corresponding center, and the rollback request corresponding to the branch transaction is used to instruct the normal transaction resource manager of the corresponding center to start a local rollback transaction and commit the local rollback result.

[0022] In a third aspect, the present application provides a distributed transaction processing device, applied to a transaction resource manager, the device comprising:

[0023] A first receiving module, configured to receive a distributed transaction processing request and determine whether a corresponding distributed transaction manager is available;

[0024] A transaction manager selection module is used to select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally when the corresponding distributed transaction manager is unavailable; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

[0025] In a fourth aspect, the present application provides a distributed transaction processing device, which is applied to a distributed transaction manager, and the device includes:

[0026] a second receiving module, configured to receive a distributed transaction processing request sent by a transaction resource manager, wherein the distributed transaction processing request is for the transaction resource manager to determine whether a corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, to select another corresponding distributed transaction manager from locally stored normal distributed transaction managers, and to send the request to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers;

[0027] A distributed transaction processing module is used to process the distributed transaction according to the distributed transaction processing request.

[0028] In a fifth aspect, the present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.

[0029] In a sixth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method described in any one of the above embodiments are implemented.

[0030] In a seventh aspect, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the method described in any one of the above embodiments.

[0031] The above-mentioned distributed transaction processing method, apparatus, device, storage medium and program product, after receiving a distributed transaction processing request, determine whether the corresponding distributed transaction manager is available. If it is not available, another corresponding distributed transaction manager is selected from the normal distributed transaction managers stored locally to process the distributed transaction. In this way, when the distributed transaction manager of one center goes down, the business request can be routed to another center for distributed transaction processing, thereby ensuring the continuity of the business and ultimately ensuring data consistency. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1An application environment diagram of a distributed transaction processing method in one embodiment;

[0033] Figure 2 A schematic diagram of a distributed transaction processing method in one embodiment;

[0034] Figure 3 A processing flow chart of a distributed transaction submission step in one embodiment;

[0035] Figure 4 A flowchart of a branch transaction rollback step in one embodiment;

[0036] Figure 5 is a flow chart of a distributed transaction initiation process in one embodiment;

[0037] Figure 6 A schematic diagram of a distributed transaction processing method according to another embodiment;

[0038] Figure 7 is a timing diagram of a distributed transaction startup phase in one embodiment;

[0039] Figure 8 is a timing diagram of a distributed transaction commit phase in one embodiment;

[0040] Fig. 9 is a timing diagram of a distributed transaction rollback phase in one embodiment;

[0041] Fig.10 is a structural block diagram of a distributed transaction processing device in one embodiment;

[0042] Fig.11 is a structural block diagram of a distributed transaction processing device in another embodiment;

[0043] Fig.12 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0045] The distributed transaction processing method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. In this application, multiple processing centers are provided, one of which is a basic processing center, which includes a transaction resource manager cluster, a distributed transaction manager cluster, a database of the transaction manager cluster, a distributed application cluster, and a database of distributed applications, wherein the transaction resource manager cluster is included in the distributed application cluster, and other processing centers include a transaction resource manager cluster, a distributed transaction manager cluster, a distributed application cluster, and a database of distributed applications, wherein the transaction resource manager cluster is included in the distributed application cluster. In order to illustrate the situation, in Figure 1 Only two processing centers are used as an example. The transaction resource manager receives the distributed transaction processing request and determines whether the corresponding distributed transaction manager is available; when the corresponding distributed transaction manager is not available, another corresponding distributed transaction manager is selected from the normal distributed transaction managers stored locally; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers. The transaction resource manager receives the branch transaction processing request sent by the selected distributed transaction manager. The branch transaction processing request is when the selected distributed transaction manager determines whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, the branch transaction processing request is routed to the normal transaction resource manager of the corresponding center. In this way, when the distributed transaction manager of one center goes down, the business request can be routed to another center for distributed transaction processing, which ensures the continuity of the business and ultimately ensures data consistency.

[0046] In one embodiment, Figure 2 As shown, a distributed transaction processing method is provided, which is applied to Figure 1 The transaction resource manager in the example is used to illustrate the process, including the following steps:

[0047] S202: Receive a distributed transaction processing request, and determine whether the corresponding distributed transaction manager is available.

[0048] Specifically, the distributed transaction processing request may include a commit request and a rollback request of the distributed transaction, which is not specifically limited herein. The corresponding distributed transaction manager refers to the one corresponding to the transaction resource manager. By default, the distributed transaction manager corresponding to the transaction resource manager is located in the same processing center. In other embodiments, the default distributed transaction manager corresponding to the transaction resource manager may also be located in a different processing center.

[0049] The distributed transaction processing request may be sent by the application system to the transaction resource manager, such as a distributed transaction processing request, or may be actively initiated by the transaction resource manager, such as a distributed transaction rollback request.

[0050] In actual applications, the transaction resource manager pre-stores various available distributed transaction managers and determines a default distributed transaction manager, so that after receiving a distributed transaction processing request, the transaction resource manager determines whether the default distributed transaction manager is available.

[0051] S204: When the corresponding distributed transaction manager is unavailable, select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

[0052] Specifically, when the transaction resource manager determines that the corresponding distributed transaction manager is unavailable, it selects another corresponding distributed transaction manager from the normal distributed transaction managers stored locally according to a preset algorithm, for example, obtaining the corresponding distributed transaction manager in another center by polling. Specifically, when the transaction resource manager first determines that all servers in the distributed transaction manager cluster corresponding to the current processing center are unavailable, it can obtain available servers in the distributed transaction manager cluster in another processing center to process the distributed transactions of the transaction resource manager.

[0053] The distributed transaction manager processes distributed transactions by registering distributed transaction information according to the central identifier of the distributed transaction manager, saving branch transaction information, notifying each transaction resource manager to commit when submitting a distributed transaction, and notifying each transaction resource manager to roll back in reverse order when rolling back a distributed transaction. This ensures that when a distributed transaction manager in one center crashes, business requests can be routed to another center for distributed transaction processing, ensuring business continuity and ultimately data consistency.

[0054] The above-mentioned distributed transaction processing method, after receiving a distributed transaction processing request, determines whether the corresponding distributed transaction manager is available. If it is not available, another corresponding distributed transaction manager is selected from the normal distributed transaction managers stored locally to process the distributed transaction. In this way, when the distributed transaction manager of one center goes down, the business request can be routed to another center for distributed transaction processing, thereby ensuring the continuity of the business and ultimately ensuring data consistency.

[0055] In one of the embodiments, when a distributed transaction processing request is in the commit phase, after selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, it includes: starting a local branch transaction and executing corresponding business processing; registering the branch transaction with the selected distributed transaction manager so that the distributed transaction manager registers the registered branch transaction.

[0056] In one of the embodiments, executing the corresponding business processing includes: when the business processing calls another transaction resource manager, sending the selected distributed transaction manager to the other transaction resource manager so that the other transaction resource manager starts the corresponding branch transaction, and registering the branch transaction with the selected distributed transaction manager so that the distributed transaction manager registers the registered branch transaction.

[0057] Specifically, combined Figure 3 As shown, Figure 3 The present invention is a processing flow chart of a distributed transaction submission step in an embodiment. In this embodiment, when a distributed transaction submission request is sent to a distributed application server in center 1, the transaction resource manager starts a distributed transaction. At this time, the distributed transaction manager in center 1 is down and unavailable. When a subsequent message of the distributed transaction submission request is sent to the distributed application server, the transaction resource manager determines whether its own center identifier is consistent with that of the distributed transaction manager (that is, determines whether the corresponding distributed transaction manager is available). If not, it uses a polling algorithm to route to the distributed transaction manager in center 2 based on the information stored in the distributed transaction server. In this way, the transaction resource manager in center 1 can start a distributed transaction in the distributed transaction manager in center 2.

[0058] Specifically, transaction resource manager 1 starts a local transaction, executes business SQL, registers a branch in the distributed transaction manager of center 2, registers the branch details and the center identifier of the distributed transaction manager in the database of the distributed transaction manager, and finally registers the branch transaction rollback log. In this way, when the transaction resource manager commits the local transaction, the distributed transaction manager can update the status of the distributed transaction in the database of the distributed transaction manager, for example, modify it to the completed status during the commit phase.

[0059] Among them, when transaction resource manager 1 executes a branch transaction, it may use transaction resource manager 2. Transaction resource manager 1 propagates the unique sequence and central identifier of the distributed transaction, opens a local transaction in transaction resource manager 2, and the transaction resource manager registers a branch in the distributed transaction manager. The branch details are registered in the database of the distributed transaction manager, and finally the branch transaction rollback log is registered.

[0060] Finally, in the absence of any exception, the transaction resource manager 1 in the center 1 initiates the distributed transaction commit, commits all branch transactions, and the distributed transaction is completed.

[0061] In one of the embodiments, when a distributed transaction processing request is in the rollback phase, after selecting another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, it includes: receiving a branch transaction rollback request sent by the selected distributed transaction manager; starting the rollback of the local branch transaction, and committing the rollback result of the local branch transaction after modifying the branch transaction status.

[0062] Specifically, the distributed application initiates a distributed transaction rollback through the transaction resource manager. When the distributed transaction manager of center 1 is down and unavailable, it cannot match the distributed transaction manager of this center, and will use the polling algorithm to route to the distributed transaction manager of center 2. After transaction resource manager 1 receives the rollback request of the branch transaction, it starts the local transaction, executes the rollback log SQL, modifies the branch transaction status, and commits the local transaction; when the distributed transaction manager checks that all branch transactions have been rolled back, the distributed transaction manager modifies the distributed transaction status, and the distributed transaction ends.

[0063] Specifically, the above embodiment mainly provides that when a distributed transaction manager fails, a distributed transaction manager of another center is selected to continue to manage distributed transactions, so that when a distributed transaction manager of a center is down, the business request can be routed to another center for distributed transaction processing, ensuring the continuity of the business and ultimately ensuring data consistency. In one embodiment, the above distributed transaction processing method also includes: when a transaction resource manager is down, another transaction resource manager in the cluster is selected to process the branch transaction to be processed by the downed transaction resource manager. Specifically, the method includes: receiving a branch transaction processing request sent by the selected distributed transaction manager, the branch transaction processing request is when the selected distributed transaction manager determines whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, routing the branch transaction processing request to the normal transaction resource manager of the corresponding center.

[0064] Specifically, the distributed transaction manager can send a branch transaction processing request to the transaction resource manager, such as a commit request or a rollback request. Before sending, the distributed transaction manager can determine whether the transaction resource manager corresponding to the branch transaction processing request is abnormal. If it is abnormal, it will be routed to the normal transaction resource manager of the corresponding center, so as to ensure that the branch transaction can be processed normally.

[0065] In one of the embodiments, before receiving the branch transaction processing request sent by the selected distributed transaction manager, it also includes: sending a transaction commit request to the selected distributed transaction manager; receiving the branch transaction processing request sent by the selected distributed transaction manager, including: receiving the transaction commit request sent by the selected distributed transaction manager, the transaction commit request is sent to the normal transaction resource manager of the corresponding center selected according to the preset algorithm when the transaction resource manager corresponding to any branch transaction fails.

[0066] Specifically, taking a transaction commit request as an example, the transaction resource manager sends a transaction commit request to the selected distributed transaction manager and receives the transaction commit request sent by the selected distributed transaction manager. When the transaction resource manager corresponding to any branch transaction fails, the transaction commit request is sent to the normal transaction resource manager of the corresponding center selected according to a preset algorithm. That is to say, when one of the distributed application servers is down and unavailable, the distributed transaction manager uses a random algorithm to select a transaction resource manager on another distributed application server to initiate a commit.

[0067] In one of the embodiments, before receiving the branch transaction processing request sent by the selected distributed transaction manager, it also includes: sending a transaction rollback request to the distributed transaction manager; receiving the branch transaction processing request sent by the selected distributed transaction manager, including: receiving the branch transaction rollback request sent by the selected distributed transaction manager, the branch transaction rollback request is that when the distributed transaction manager receives the transaction rollback request, it determines whether the transaction resource manager corresponding to the branch transaction is abnormal, and when the transaction resource manager is abnormal, the branch rollback request corresponding to the branch transaction is routed to the normal transaction resource manager of the corresponding center.

[0068] Specifically, in conjunction with Figure 4 As shown, Figure 4 The flowchart is a branch transaction rollback step in an embodiment. In this embodiment, the distributed application initiates a distributed transaction rollback through the transaction resource manager. When the distributed transaction manager of center 1 is down and unavailable, it cannot match the distributed transaction manager of this center, and it will be routed to the distributed transaction manager of center 2 using a polling algorithm. When the rollback request of the branch transaction is sent to the transaction resource manager 1 of center 1, the transaction resource manager 1 is down and unavailable, and the rollback request of the branch transaction is routed to the transaction resource manager 2 using a random algorithm. After the transaction resource manager 2 receives the rollback request of the branch transaction, it starts a local transaction, executes the rollback log SQL, modifies the branch transaction status, and commits the local transaction; when the distributed transaction manager checks that all branch transactions have been rolled back, the distributed transaction manager modifies the distributed transaction status, and the distributed transaction ends.

[0069] In one of the embodiments, the above-mentioned distributed transaction processing method also includes: obtaining the central identifier of the current processing center, sending the central identifier to the distributed transaction manager, and receiving the central identifier of the processing center corresponding to the distributed transaction manager; storing the central identifier of the current processing center and the central identifier of the processing center corresponding to the distributed transaction manager.

[0070] Specifically, combined Figure 5 As shown, Figure 5 The flowchart of the distributed transaction startup process in one embodiment, in which the startup phase mainly includes the central identification exchange between the transaction resource manager and the distributed transaction manager, and the registration of the basic information of the distributed transaction manager, wherein the transaction resource manager is integrated in the distributed application server. The transaction resource manager sends its own central identification to the distributed transaction manager, and similarly, the distributed transaction manager also transmits its own central identification to the transaction resource manager, thus achieving a preliminary central identification handshake. If an abnormality occurs in one of the central distributed transaction managers or transaction resource managers, the exchanged central identification will be updated, thereby ensuring the continuity of the business; the distributed transaction manager registers its own information in the storage device for the subsequent distributed transaction submission and rollback phases.

[0071] In one embodiment, Figure 6 As shown, a distributed transaction processing method is provided, which is applied to Figure 1 The distributed transaction manager in is used as an example to illustrate the process, including the following steps:

[0072] S602: receiving a distributed transaction processing request sent by a transaction resource manager, wherein the distributed transaction processing request is for the transaction resource manager to determine whether the corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, to select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, and send the request to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers.

[0073] Specifically, the distributed transaction processing request may include a commit request and a rollback request of the distributed transaction, which is not specifically limited herein. The corresponding distributed transaction manager refers to the one corresponding to the transaction resource manager. By default, the distributed transaction manager corresponding to the transaction resource manager is located in the same processing center. In other embodiments, the default distributed transaction manager corresponding to the transaction resource manager may also be located in a different processing center.

[0074] The distributed transaction processing request may be sent by the application system to the transaction resource manager, such as a distributed transaction processing request, or may be actively initiated by the transaction resource manager, such as a distributed transaction rollback request.

[0075] In actual applications, the transaction resource manager pre-stores various available distributed transaction managers and determines a default distributed transaction manager, so that after receiving a distributed transaction processing request, the transaction resource manager determines whether the default distributed transaction manager is available.

[0076] Specifically, when the transaction resource manager determines that the corresponding distributed transaction manager is unavailable, it selects another corresponding distributed transaction manager from the normal distributed transaction managers stored locally according to a preset algorithm, for example, obtaining the corresponding distributed transaction manager in another center by polling. Specifically, when the transaction resource manager first determines that all servers in the distributed transaction manager cluster corresponding to the current processing center are unavailable, it can obtain available servers in the distributed transaction manager cluster in another processing center to process the distributed transactions of the transaction resource manager.

[0077] The distributed transaction manager processes distributed transactions by registering distributed transaction information according to the central identifier of the distributed transaction manager, saving branch transaction information, notifying each transaction resource manager to commit when submitting a distributed transaction, and notifying each transaction resource manager to roll back in reverse order when rolling back a distributed transaction. This ensures that when a distributed transaction manager in one center crashes, business requests can be routed to another center for distributed transaction processing, ensuring business continuity and ultimately data consistency.

[0078] S604: Process the distributed transaction according to the distributed transaction processing request.

[0079] Specifically, the distributed transaction processing performed by the distributed management server is mainly to register distributed transaction information in the transaction manager database, register branch transaction information, and update the status of the distributed transaction according to the branch transaction information, for example, updating it to the processing completion status after submission, and updating it to the rollback completion status during rollback.

[0080] The above-mentioned distributed transaction processing method, after receiving a distributed transaction processing request, determines whether the corresponding distributed transaction manager is available. If it is not available, another corresponding distributed transaction manager is selected from the normal distributed transaction managers stored locally to process the distributed transaction. In this way, when the distributed transaction manager of one center goes down, the business request can be routed to another center for distributed transaction processing, thereby ensuring the continuity of the business and ultimately ensuring data consistency.

[0081] In one of the embodiments, when a distributed transaction processing request is in the commit phase, a distributed transaction is processed according to the distributed transaction processing request, including: registering distributed transaction information according to the distributed transaction processing request, and after successful registration, sending a distributed transaction start request to the transaction resource manager, the distributed transaction start request is used to instruct the transaction resource manager to start a local branch transaction, execute corresponding business processing, and send branch transaction information to another selected distributed transaction manager; registering the received branch transaction information; receiving a branch transaction commit request sent by the transaction resource manager, and updating the status of the corresponding branch transaction based on the branch transaction commit request.

[0082] Specifically, when a distributed transaction submission request is sent to the distributed application server of center 1, the transaction resource manager starts the distributed transaction. At this time, the distributed transaction manager of center 1 is down and unavailable. When subsequent messages of the distributed transaction submission request are sent to the distributed application server, the transaction resource manager will determine whether its own central identifier is consistent with that of the distributed transaction manager (that is, whether the corresponding distributed transaction manager is available). If not, it will use a polling algorithm to route to the distributed transaction manager of center 2 based on the information stored in the distributed transaction server. In this way, the transaction resource manager of center 1 can start a distributed transaction in the distributed transaction manager of center 2.

[0083] Specifically, transaction resource manager 1 starts a local transaction, executes business SQL, registers a branch in the distributed transaction manager of center 2, registers the branch details and the center identifier of the distributed transaction manager in the database of the distributed transaction manager, and finally registers the branch transaction rollback log. In this way, when the transaction resource manager commits the local transaction, the distributed transaction manager can update the status of the distributed transaction in the database of the distributed transaction manager, for example, modify it to the completed status during the commit phase.

[0084] In one of the embodiments, when a distributed transaction processing request is in the rollback phase, the distributed transaction is processed according to the distributed transaction processing request, including: sending a branch transaction rollback request to the corresponding transaction resource manager, the branch transaction rollback request is used to instruct the corresponding transaction resource manager to start the rollback of the local branch transaction and commit the rollback result of the local branch transaction.

[0085] Specifically, the distributed application initiates a distributed transaction rollback through the transaction resource manager. When the distributed transaction manager of center 1 is down and unavailable, it cannot match the distributed transaction manager of this center, and will use the polling algorithm to route to the distributed transaction manager of center 2. After transaction resource manager 1 receives the rollback request of the branch transaction, it starts the local transaction, executes the rollback log SQL, modifies the branch transaction status, and commits the local transaction; when the distributed transaction manager checks that all branch transactions have been rolled back, the distributed transaction manager modifies the distributed transaction status, and the distributed transaction ends.

[0086] Specifically, the above embodiment mainly provides that when a distributed transaction manager fails, a distributed transaction manager of another center is selected to continue to manage distributed transactions, so that when a distributed transaction manager of a center is down, the business request can be routed to another center for distributed transaction processing, ensuring the continuity of the business and ultimately ensuring data consistency. In one embodiment, the above distributed transaction processing method also includes: when a transaction resource manager is down, another transaction resource manager in the cluster is selected to process the branch transaction to be processed by the downed transaction resource manager. Specifically, the method includes: determining whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, routing the branch transaction processing request to the normal transaction resource manager of the corresponding center.

[0087] In one of the embodiments, when a branch transaction processing request is in the commit stage, after routing the branch transaction processing request to a normal transaction resource manager of a corresponding center, the process includes: receiving a branch transaction commit request sent by the normal transaction resource manager, and updating the transaction status of the corresponding distributed transaction according to the branch transaction commit request.

[0088] Specifically, taking a transaction commit request as an example, the transaction resource manager sends a transaction commit request to the selected distributed transaction manager and receives the transaction commit request sent by the selected distributed transaction manager. When the transaction resource manager corresponding to any branch transaction fails, the transaction commit request is sent to the normal transaction resource manager of the corresponding center selected according to a preset algorithm. That is to say, when one of the distributed application servers is down and unavailable, the distributed transaction manager uses a random algorithm to select a transaction resource manager on another distributed application server to initiate a commit.

[0089] In one of the embodiments, when a branch transaction processing request is in the rollback phase, the branch transaction processing request is routed to a normal transaction resource manager of a corresponding center, including: routing the rollback request corresponding to the branch transaction to the normal transaction resource manager of the corresponding center, the rollback request corresponding to the branch transaction is used to instruct the normal transaction resource manager of the corresponding center to start a local rollback transaction and commit the local rollback result.

[0090] Specifically, the distributed application initiates a distributed transaction rollback through the transaction resource manager. When the distributed transaction manager of center 1 is down and unavailable, it cannot match the distributed transaction manager of this center, and will use the polling algorithm to route to the distributed transaction manager of center 2. When the rollback request of the branch transaction is sent to transaction resource manager 1 of center 1, transaction resource manager 1 is down and unavailable, and the rollback request of the branch transaction is routed to transaction resource manager 2 using a random algorithm. After transaction resource manager 2 receives the rollback request of the branch transaction, it starts a local transaction, executes the rollback log SQL, modifies the branch transaction status, and commits the local transaction; when the distributed transaction manager checks that all branch transactions have been rolled back, the distributed transaction manager modifies the distributed transaction status, and the distributed transaction ends.

[0091] Specifically, in order to enable those skilled in the art to fully understand the present application, Figures 7 to 9 As shown, Figure 7 is a timing diagram of the distributed transaction startup phase in one embodiment, Figure 8 is a timing diagram of the distributed transaction commit phase in one embodiment, Fig. 9 This is a timing diagram of the distributed transaction rollback phase in an embodiment. The distributed transaction processing method involved in this application includes the startup phase, the commit phase, and the rollback phase. In each phase, there are several types of entity devices, including a distributed transaction manager, a transaction resource manager, a distributed transaction server, and a distributed application server. The distributed transaction processing method at different stages is described below.

[0092] In this embodiment, first combine Figure 7 As shown, the startup phase mainly includes the exchange of central identifiers between the transaction resource manager and the distributed transaction manager, and the registration of basic information of the distributed transaction manager, wherein the transaction resource manager is integrated in the distributed application server. The transaction resource manager sends its own central identifier to the distributed transaction manager. Similarly, the distributed transaction manager also transmits its own central identifier to the transaction resource manager, thus achieving a preliminary central identifier handshake. If an abnormality occurs in one of the central distributed transaction managers or transaction resource managers, the exchanged central identifier will be updated to ensure business continuity; the distributed transaction manager registers its own information in the storage device for subsequent distributed transaction commit and rollback stages. As shown Figure 7 In FIG. 1 , the interaction process between the distributed transaction manager, the transaction resource manager, the transaction manager database storage device of the center 1, and the distributed transaction manager entity of the center 2 is shown. In the startup phase, the available distributed transaction managers and transaction resource managers are registered with each other. During the operation, the registered information is updated in real time to ensure that the distributed transaction managers and transaction resource managers that can be used normally are registered normally.

[0093] Combination Figure 8 As shown, it includes the distributed application module (Client), the distributed transaction manager of center 1, the transaction resource manager, the distributed application database (DB1, DB2), the transaction manager database (DB), and the interaction process between the distributed transaction manager entities of center 2. The submission phase of distributed transaction processing includes the following operations:

[0094] First, the front end sends the request to center 1 by default. The request processing of center 1 is handled by the transaction resource manager of the center, and the transactions involved in the transaction resource manager of center 1 are handled by the distributed transaction manager of center 1.

[0095] When a request is sent to the distributed application server of center 1, the transaction resource manager starts a distributed transaction. At this time, the distributed transaction manager of center 1 is down and unavailable. When the subsequent message of the request is sent to the distributed application server, the transaction resource manager will determine whether its own center identifier is consistent with that of the distributed transaction manager. If not, it will use the polling algorithm to route to the distributed transaction manager of center 2 based on the information stored in the distributed transaction server. In other words, if all nodes of the distributed transaction manager cluster of center 1 are unavailable, a distributed transaction manager node of center 2 will be selected using the polling algorithm to perform distributed transaction management on the request received by the corresponding transaction resource manager in center 1.

[0096] In this way, the transaction resource manager 1 of center 1 starts a distributed transaction in the distributed transaction manager of center 2, which may include: transaction resource manager 1 starts a local transaction, registers a branch in the distributed transaction manager, registers the branch details in the storage device, and finally registers the branch transaction rollback log; the business calls to transaction resource manager 2, propagates the distributed transaction unique sequence and center identifier, starts a local transaction in transaction resource manager 2, registers a branch in the distributed transaction manager, registers the branch details in the storage device, and finally registers the branch transaction rollback log.

[0097] When there is no abnormality, the transaction resource manager 1 of center 1 initiates a distributed transaction commit, including: the distributed transaction manager of center 2 queries all branch information belonging to the distributed transaction under the storage device and initiates the call in reverse order; when one of the distributed application servers is down and unavailable, the distributed transaction manager uses a random algorithm to select a transaction resource manager on another distributed application server to initiate the commit, and the commit completes all branch transactions, and the distributed transaction is completed.

[0098] The registration mentioned above means that when the transaction resource manager processes a transaction, it will register the transaction as a branch transaction in the database of the distributed transaction manager. The registration rollback means that the reverse execution log of the branch transaction will be registered in the database of the distributed application.

[0099] Specifically, combined Fig. 9 As shown, Fig. 9 The interactive process includes the distributed transaction manager of center 1, transaction resource manager 1, transaction resource manager 1', transaction resource manager 2, distributed application databases (DB1, DB2), transaction manager database (DB), and distributed transaction manager entities of center 2. Among them, transaction resource manager 1 and transaction resource manager 1' operate the same business database, and for the distributed transaction manager, they can be represented by the same transaction resource name; transaction resource manager 1 and transaction resource manager 2 operate different business databases, and for the distributed transaction manager, they can be represented by two transaction resource names. Fig. 9 The timing diagram of the distributed transaction rollback phase is shown. The rollback phase includes the following operations:

[0100] Distributed applications initiate distributed transaction rollbacks through transaction resource managers. When the distributed transaction manager of center 1 is down and unavailable, it cannot match the distributed transaction manager of this center, and will be routed to the distributed transaction manager of center 2 using a polling algorithm. When the rollback request of a branch transaction is sent to transaction resource manager 1 of center 1, transaction resource manager 1 is down and unavailable, and the rollback request of the branch transaction is routed to transaction resource manager 2 using a random algorithm. After transaction resource manager 2 receives the rollback request of the branch transaction, it starts a local transaction, executes the rollback log SQL, modifies the branch transaction status, and commits the local transaction; when the distributed transaction manager checks that all branch transactions have been rolled back, it modifies the distributed transaction status, and the distributed transaction ends.

[0101] That is to say, when a distributed transaction is rolled back, it is rolled back in reverse order according to the registered distributed transaction and branch transaction information. When the rollback request is sent to transaction resource manager 1, transaction resource manager 1 is unavailable, and the request is forwarded to transaction resource manager 1'. Transaction resource manager 1 and transaction resource manager 1' belong to the same cluster, so they are the same center.

[0102] In the above embodiment, the distributed transaction processing method provided in this embodiment ensures data consistency. The distributed transaction resource manager is integrated on the distributed application server. When opening, submitting, and rolling back distributed transactions, a default route to the distributed transaction manager of this center is provided. If the center cannot be matched, it is forwarded to the distributed transaction manager of another center for processing using polling or a random algorithm. The distributed transaction manager is integrated on the distributed transaction server. After scanning all branch transactions, the rollback message of each branch transaction is forwarded to the transaction resource manager identified by the default center for branch transaction rollback. When the distributed application server integrated with the transaction resource manager is abnormal, it will be forwarded to other transaction resource managers of this center using a random algorithm for branch rollback processing.

[0103] Compared with the existing distributed transaction processing methods, distributed transactions can span two or even multiple centers, and support exceptions in the distributed transaction manager of a certain center. New requests will be automatically routed to the distributed transaction manager of another center for processing. When used in different business scenarios, the routing algorithm can also be configured and expanded to ensure business availability and ultimately ensure data consistency.

[0104] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0105] Based on the same inventive concept, the embodiment of the present application also provides a distributed transaction processing device for implementing the above-mentioned distributed transaction processing method. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above-mentioned method, so the specific limitations in one or more distributed transaction processing device embodiments provided below can refer to the above-mentioned limitations on the distributed transaction processing method, and will not be repeated here.

[0106] In one embodiment, Fig.10 As shown, a distributed transaction processing device is provided, including: a first receiving module 1001 and a transaction manager selection module 1002, wherein:

[0107] The first receiving module 1001 is used to receive a distributed transaction processing request and determine whether the corresponding distributed transaction manager is available;

[0108] The transaction manager selection module 1002 is used to select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally when the corresponding distributed transaction manager is unavailable; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

[0109] In one embodiment, the distributed transaction processing device includes:

[0110] A first local branch transaction processing module, used to start a local branch transaction and execute corresponding business processing;

[0111] The first registration module is used to register the branch transaction with the selected distributed transaction manager, so that the distributed transaction manager registers the registered branch transaction.

[0112] In one of the embodiments, the first local branch transaction processing module is used to send the selected distributed transaction manager to the other transaction resource manager when the business processing calls the other transaction resource manager, so that the other transaction resource manager starts the corresponding branch transaction, and registers the branch transaction with the selected distributed transaction manager, so that the distributed transaction manager registers the registered branch transaction.

[0113] In one embodiment, the distributed transaction processing device includes:

[0114] A third receiving module, configured to receive a branch transaction rollback request sent by the selected distributed transaction manager;

[0115] The first rollback module is used to start the rollback of the local branch transaction, and submit the rollback result of the local branch transaction after modifying the branch transaction state.

[0116] In one embodiment, the distributed transaction processing device includes:

[0117] The fourth receiving module is used to receive a branch transaction processing request sent by the selected distributed transaction manager. The branch transaction processing request is used by the selected distributed transaction manager to determine whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, the branch transaction processing request is routed to the normal transaction resource manager of the corresponding center.

[0118] In one embodiment, the distributed transaction processing device includes:

[0119] A first transaction commit request sending module, used to send a transaction commit request to the selected distributed transaction manager;

[0120] The fourth receiving module is used to receive a transaction commit request sent by the selected distributed transaction manager. When the transaction resource manager corresponding to any branch transaction fails, the transaction commit request is sent to a normal transaction resource manager of the corresponding center selected according to a preset algorithm.

[0121] In one embodiment, the distributed transaction processing device includes:

[0122] A first rollback request sending module, used to send a transaction rollback request to the distributed transaction manager;

[0123] The fourth receiving module is used to receive a branch transaction rollback request sent by the selected distributed transaction manager. The branch transaction rollback request is when the distributed transaction manager receives the transaction rollback request, it determines whether the transaction resource manager corresponding to the branch transaction is abnormal, and when the transaction resource manager is abnormal, it routes the branch rollback request corresponding to the branch transaction to the normal transaction resource manager of the corresponding center.

[0124] In one embodiment, the distributed transaction processing device includes:

[0125] An identification acquisition module, used to acquire the center identification of the current processing center, send the center identification to the distributed transaction manager, and receive the center identification of the processing center corresponding to the distributed transaction manager;

[0126] The first storage module is used to store the center identifier of the current processing center and the center identifier of the processing center corresponding to the distributed transaction manager.

[0127] In one embodiment, Fig.11 As shown, a distributed transaction processing device is provided, including: a second receiving module 1101 and a distributed transaction processing module 1102, wherein:

[0128] The second receiving module 1101 is used to receive a distributed transaction processing request sent by a transaction resource manager, wherein the distributed transaction processing request is for the transaction resource manager to determine whether the corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, to select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, and send the request to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers;

[0129] The distributed transaction processing module 1102 is used to process distributed transactions according to distributed transaction processing requests.

[0130] In one embodiment, the distributed transaction processing module 1102 is used to register distributed transaction information according to a distributed transaction processing request, and after successful registration, send a distributed transaction start request to the transaction resource manager, the distributed transaction start request is used to instruct the transaction resource manager to start a local branch transaction, execute corresponding business processing, and send branch transaction information to another selected distributed transaction manager; register the received branch transaction information; receive a branch transaction commit request sent by the transaction resource manager, and update the status of the corresponding branch transaction based on the branch transaction commit request.

[0131] In one embodiment, the distributed transaction processing module 1102 is used to send a branch transaction rollback request to the corresponding transaction resource manager, and the branch transaction rollback request is used to instruct the corresponding transaction resource manager to start the rollback of the local branch transaction and submit the rollback result of the local branch transaction.

[0132] In one embodiment, the above device further comprises:

[0133] A judgment module, used to judge whether the transaction resource manager corresponding to the branch transaction processing request is abnormal;

[0134] The routing module is used to route the branch transaction processing request to the normal transaction resource manager of the corresponding center when the transaction resource manager is abnormal.

[0135] In one embodiment, the above device further comprises:

[0136] The fifth receiving module is used to receive a branch transaction commit request sent by a normal transaction resource manager, and update the transaction state of the corresponding distributed transaction according to the branch transaction commit request.

[0137] In one of the embodiments, the routing module is used to route the rollback request corresponding to the branch transaction to the normal transaction resource manager of the corresponding center, and the rollback request corresponding to the branch transaction is used to instruct the normal transaction resource manager of the corresponding center to start a local rollback transaction and submit the local rollback result.

[0138] Each module in the above-mentioned distributed transaction processing device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.

[0139] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.12 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a distributed transaction processing method is implemented.

[0140] Those skilled in the art will understand that Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0141] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0142] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0143] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0144] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0145] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0146] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A distributed transaction processing method, characterized in that: Applied to a transaction resource manager, the method comprises: Receive distributed transaction processing requests and determine whether the corresponding distributed transaction manager is available; When the corresponding distributed transaction manager is unavailable, another corresponding distributed transaction manager is selected from the normal distributed transaction managers stored locally; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

2. The method according to claim 1, characterized in that When the distributed transaction processing request is in the commit phase, after selecting another corresponding distributed transaction manager from the locally stored normal distributed transaction managers, the method includes: Open local branch transactions and execute corresponding business processing; The branch transaction is registered with the selected distributed transaction manager, so that the distributed transaction manager registers the registered branch transaction.

3. The method according to claim 2, characterized in that The executing corresponding business processing includes: When the business process calls another transaction resource manager, the selected distributed transaction manager is sent to the other transaction resource manager so that the other transaction resource manager starts the corresponding branch transaction, and registers the branch transaction with the selected distributed transaction manager so that the distributed transaction manager registers the registered branch transaction.

4. The method according to claim 1, characterized in that When the distributed transaction processing request is in the rollback phase, after selecting another corresponding distributed transaction manager from the locally stored normal distributed transaction managers, the method includes: Receiving a branch transaction rollback request sent by the selected distributed transaction manager; Enable the rollback of the local branch transaction, and commit the rollback result of the local branch transaction after modifying the branch transaction status.

5. The method according to claim 1, characterized in that The method further comprises: Receive a branch transaction processing request sent by the selected distributed transaction manager, wherein the selected distributed transaction manager determines whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; when the transaction resource manager is abnormal, route the branch transaction processing request to the normal transaction resource manager of the corresponding center.

6. The method according to claim 5, characterized in that Before receiving the branch transaction processing request sent by the selected distributed transaction manager, the method further includes: Sending a transaction commit request to the selected distributed transaction manager; The receiving the branch transaction processing request sent by the selected distributed transaction manager includes: A transaction commit request sent by the selected distributed transaction manager is received, and when a transaction resource manager corresponding to any of the branch transactions fails, the transaction commit request is sent to a normal transaction resource manager of a corresponding center selected according to a preset algorithm.

7. The method according to claim 5, characterized in that Before receiving the branch transaction processing request sent by the selected distributed transaction manager, the method further includes: Sending a transaction rollback request to the distributed transaction manager; The receiving the branch transaction processing request sent by the selected distributed transaction manager includes: Receive a branch transaction rollback request sent by the selected distributed transaction manager, wherein the distributed transaction manager determines whether the transaction resource manager corresponding to the branch transaction is abnormal when receiving the transaction rollback request, and when the transaction resource manager is abnormal, routes the branch rollback request corresponding to the branch transaction to the normal transaction resource manager of the corresponding center.

8. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Obtaining a center identifier of a current processing center, sending the center identifier to a distributed transaction manager, and receiving a center identifier of a processing center corresponding to the distributed transaction manager; The center identifier of the current processing center and the center identifier of the processing center corresponding to the distributed transaction manager are stored.

9. A distributed transaction processing method, characterized in that: Applied to a distributed transaction manager, the method comprises: receiving a distributed transaction processing request sent by a transaction resource manager, the transaction resource manager determining whether the corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, the transaction resource manager selecting another corresponding distributed transaction manager from locally stored normal distributed transaction managers, and the transaction resource manager sending the distributed transaction processing request to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers; The distributed transaction is processed according to the distributed transaction processing request.

10. The method according to claim 9, characterized in that When the distributed transaction processing request is in the commit phase, processing the distributed transaction according to the distributed transaction processing request includes: Registering distributed transaction information according to the distributed transaction processing request, and after successful registration, sending a distributed transaction start request to the transaction resource manager, wherein the distributed transaction start request is used to instruct the transaction resource manager to start a local branch transaction, execute corresponding business processing, and send the branch transaction information to another selected distributed transaction manager; Registering the received branch transaction information; A branch transaction commit request sent by the transaction resource manager is received, and a state of a corresponding branch transaction is updated based on the branch transaction commit request.

11. The method according to claim 9, characterized in that When the distributed transaction processing request is in the rollback phase, processing the distributed transaction according to the distributed transaction processing request includes: A branch transaction rollback request is sent to the corresponding transaction resource manager, where the branch transaction rollback request is used to instruct the corresponding transaction resource manager to start the rollback of the local branch transaction and submit the rollback result of the local branch transaction.

12. The method according to claim 9, characterized in that The method further comprises: Determine whether the transaction resource manager corresponding to the branch transaction processing request is abnormal; When the transaction resource manager is abnormal, the branch transaction processing request is routed to a normal transaction resource manager of the corresponding center.

13. The method according to claim 12, characterized in that When the branch transaction processing request is in the commit stage, after routing the branch transaction processing request to the normal transaction resource manager of the corresponding center, the method includes: A branch transaction commit request sent by a normal transaction resource manager is received, and a transaction state of a corresponding distributed transaction is updated according to the branch transaction commit request.

14. The method according to claim 12, characterized in that When the branch transaction processing request is in the rollback phase, routing the branch transaction processing request to a normal transaction resource manager of a corresponding center includes: The rollback request corresponding to the branch transaction is routed to the normal transaction resource manager of the corresponding center, and the rollback request corresponding to the branch transaction is used to instruct the normal transaction resource manager of the corresponding center to start a local rollback transaction and submit a local rollback result.

15. A distributed transaction processing device, characterized in that: Applied to a transaction resource manager, the device comprises: A first receiving module, configured to receive a distributed transaction processing request and determine whether a corresponding distributed transaction manager is available; A transaction manager selection module is used to select another corresponding distributed transaction manager from the normal distributed transaction managers stored locally when the corresponding distributed transaction manager is unavailable; the selected distributed transaction manager is used to manage the distributed transactions of the transaction resource manager; different distributed transaction managers are located in different processing centers.

16. A distributed transaction processing device, characterized in that: Applied to a distributed transaction manager, the device comprises: a second receiving module, configured to receive a distributed transaction processing request sent by a transaction resource manager, wherein the transaction resource manager determines whether the corresponding distributed transaction manager is available, and when the corresponding distributed transaction manager is not available, the transaction resource manager selects another corresponding distributed transaction manager from the normal distributed transaction managers stored locally, and the transaction resource manager sends the distributed transaction processing request to the selected another distributed transaction manager; different distributed transaction managers are located in different processing centers; A distributed transaction processing module is used to process the distributed transaction according to the distributed transaction processing request.

17. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 or the steps of the method according to any one of claims 9 to 14 are implemented.

18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method of any one of claims 1 to 8 or the steps of the method of any one of claims 9 to 14 are implemented.

19. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 or the steps of the method according to any one of claims 9 to 14 are implemented.