Distributed transaction processing method and device, equipment and storage medium

By identifying key branch transactions and branch branch transactions in distributed transactions in the financial field, and processing and compensating them independently, the problems of difficulty in maintenance and coordination in the existing technology are solved, and more efficient distributed transaction management is achieved.

CN118656204APending Publication Date: 2024-09-17BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410680594.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-29
Publication Date
2024-09-17

AI Technical Summary

Technical Problem

Existing distributed transaction management methods are difficult to maintain and coordinate transactions in the financial field. They violate the single responsibility specification of the microservice architecture and are difficult to maintain consistency when subsequent business operations on key transaction nodes are complex.

Method used

By determining the key branch transaction in the target distributed transaction, the key branch transaction in the execution sequence will not be rolled back when it succeeds, and the branch branch transaction will not trigger compensation when it fails. This achieves independent processing of branch transactions, reduces the burden of the transaction coordinator, and complies with Service Single Responsibility Specification.

Benefits of technology

It reduces the difficulty of maintenance and transaction coordination of distributed transactions, improves the maintainability and stability of the system, avoids unnecessary compensation operations, and improves the processing efficiency of financial business processes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118656204A
    Figure CN118656204A
Patent Text Reader

Abstract

The embodiment of the invention provides a distributed transaction processing method and device, equipment and a storage medium, and is used for the field of distributed technologies. The method comprises the steps of determining an execution sequence of a plurality of branch transactions of a target distributed transaction based on the target distributed transaction, and identifying key branch transactions of the target distributed transaction through red line marks; in response to the service request, starting a target distributed transaction and creating a target distributed transaction flow; determining to-be-executed branch transactions one by one based on the execution sequence, creating a branch transaction pipeline of the branch transactions, and judging whether the branch transactions are key branch transactions or not based on the branch transaction pipeline; executing the branch transaction, and returning the state code after the execution of the branch transaction is finished; and when the branch transaction returns a state code representing successful execution of the branch transaction and the branch transaction is the key branch transaction, determining that the successfully executed branch transaction before the key branch transaction does not roll back. According to the method, the distributed transaction maintenance difficulty and the transaction coordination difficulty are reduced.
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 method and apparatus, device and storage medium for processing distributed transactions. Background Art

[0002] A transaction is a logical unit in the database execution process, which consists of a limited sequence of operations. The operations in the sequence of operations either succeed or fail in modifying the database. With the rise of distributed microservice architecture, most companies have or are splitting and servitizing databases. In a microservice architecture, completing a business function may span multiple services. Multiple services can operate on corresponding business libraries respectively, and multiple services must succeed or fail at the same time, otherwise data inconsistency will occur. To ensure the consistency of business data between these services, distributed transactions are involved.

[0003] In the prior art, SAGA is often used to process long-lived distributed transactions, and a distributed transaction is decomposed into multiple branch transactions. The existing distributed transaction management methods applied to the financial field do not combine the characteristics of financial business processes. For example, in the common "one debit and one loan" scenario of banking business in the financial field, credit is a key transaction and cannot be rolled back after success, but there are also operations such as "recording flow" and "sending notifications" after crediting that need to keep data consistent with debit and credit. The existing distributed transaction management methods usually encapsulate "credit", "recording flow" after crediting, "sending notifications" and other post-credit operations in a large "credit" service, and use local database transactions to manage these operations so that they succeed and fail at the same time, to avoid the situation where the credit succeeds but the subsequent operation fails and needs to compensate the credit separately; in addition, in terms of the condition judgment of triggering SAGA distributed transaction compensation, most of the existing solutions directly throw database execution failure exceptions or business failure exceptions to the transaction coordinator in the branch transaction to trigger the transaction rollback.

[0004] Encapsulating multiple functions into one service itself violates the single responsibility specification of services under the microservice architecture. Moreover, if there are many subsequent business operations on key transaction nodes that need to be consistent with them, the service will be mixed with more functions and become difficult to maintain. Directly throwing business exceptions in branch transactions to trigger distributed transaction compensation will require the transaction coordinator to handle more exception types, increasing the difficulty of implementing the transaction coordinator. In addition, the normal execution of microservices in the financial field does not mean business success. Therefore, the distributed transaction implementation solution that fully complies with SAGA is not suitable for scenarios in the financial field where some business processes are complicated and have key transaction nodes. Therefore, the existing distributed transaction management methods applied to the financial field have technical problems that violate the single responsibility specification of services, resulting in difficulty in maintenance and transaction coordination. Summary of the invention

[0005] The embodiments of the present application provide a distributed transaction processing method and apparatus, device and storage medium to solve the problems of difficult maintenance and high transaction coordination difficulty in distributed transaction management methods in the financial field.

[0006] In a first aspect, the present application provides a distributed transaction processing method, comprising:

[0007] Based on the target distributed transaction, determine the execution order of multiple branch transactions corresponding to the target distributed transaction, and identify the key branch transactions of the target distributed transaction through red line markings;

[0008] In response to the business request, start the target distributed transaction and create the target distributed transaction pipeline;

[0009] Determine branch transactions to be executed one by one based on the execution order, create branch transaction flow of the branch transactions, and judge whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0010] Execute the branch transaction, and return a status code after the execution of the branch transaction is completed, wherein the status code is used to indicate whether the execution of the branch transaction is successful or failed;

[0011] When the branch transaction is successfully executed and the branch transaction is a critical branch transaction, it is determined that the branch transaction that was successfully executed before the critical branch transaction is not rolled back, the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the critical branch transaction are updated to success, and the next branch transaction to be executed is determined based on the execution order; wherein the branch transaction corresponds to the branch transaction flow one by one, and different branch transactions correspond to different branch transaction flows.

[0012] Optionally, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, the method further includes:

[0013] Based on the execution order, determine whether the branch transaction is a minor branch transaction; wherein the minor branch transaction refers to a branch transaction that is sequenced after the key branch transaction in the execution order;

[0014] If not, the previous branch transaction of the branch transaction is reversely compensated based on the execution order to undo the operations performed when executing the previous branch transaction, and the transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure.

[0015] Optionally, when the branch transaction returns a status code indicating that the branch transaction execution failed, and the branch transaction is a branch transaction, the method further includes:

[0016] The transaction status of the branch transaction flow corresponding to the update branch transaction is failed.

[0017] Optionally, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is not a branch transaction, before reversely compensating the previous branch transaction of the branch transaction based on the execution order, the method further includes:

[0018] The status code returned by the branch transaction indicating the failure of the branch transaction execution is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution process of multiple branch transactions corresponding to the target distributed transaction based on the execution order.

[0019] Optionally, when the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is not a critical branch transaction, the method further includes:

[0020] The transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order.

[0021] Optionally, the method further comprises:

[0022] When all branch transactions corresponding to the target distributed transaction return a status code indicating successful execution of the branch transaction, the target distributed transaction is committed, and the transaction status of the target distributed transaction pipeline is updated to success.

[0023] Optionally, the method further comprises:

[0024] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is less than the preset threshold, the corresponding microservice of the branch transaction is called again;

[0025] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is greater than or equal to a preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction flow and the target distributed transaction flow corresponding to the branch transaction are updated.

[0026] In a second aspect, the present application provides a distributed transaction processing device, including:

[0027] A first processing module is used to determine, based on a target distributed transaction, an execution order of multiple branch transactions corresponding to the target distributed transaction, and to identify key branch transactions of the target distributed transaction by red line marking;

[0028] The opening module is used to respond to the business request, open the target distributed transaction and create the target distributed transaction pipeline;

[0029] A second processing module is used to determine the branch transactions to be executed one by one based on the execution order, create a branch transaction flow of the branch transaction, and determine whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0030] An execution module, used for executing the branch transaction and returning a status code after the execution of the branch transaction is completed, wherein the status code is used for indicating whether the execution of the branch transaction is successful or failed;

[0031] The third processing module is used to, when the branch transaction is successfully executed and the branch transaction is a critical branch transaction, determine that the branch transaction that was successfully executed before the critical branch transaction is not rolled back, update the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the critical branch transaction to success, and determine the next branch transaction to be executed based on the execution order; wherein the branch transaction corresponds to the branch transaction flow one by one, and different branch transactions correspond to different branch transaction flows.

[0032] Optionally, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, the device is further configured to:

[0033] Based on the execution order, determine whether the branch transaction is a minor branch transaction; wherein the minor branch transaction refers to a branch transaction that is sequenced after the key branch transaction in the execution order;

[0034] If not, the previous branch transaction of the branch transaction is reversely compensated based on the execution order to undo the operations performed when executing the previous branch transaction, and the transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure.

[0035] Optionally, when the branch transaction returns a status code indicating that the branch transaction execution fails, and the branch transaction is a branch transaction, the device is further configured to:

[0036] The transaction status of the branch transaction flow corresponding to the update branch transaction is failed.

[0037] Optionally, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is not a branch transaction, before reversely compensating the previous branch transaction of the branch transaction based on the execution order, the device is further configured to:

[0038] The status code returned by the branch transaction indicating the failure of the branch transaction execution is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution process of multiple branch transactions corresponding to the target distributed transaction based on the execution order.

[0039] Optionally, when the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is not a critical branch transaction, the device is further configured to:

[0040] The transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order.

[0041] Optionally, the device is also used for:

[0042] When all branch transactions corresponding to the target distributed transaction return a status code indicating successful execution of the branch transaction, the target distributed transaction is committed, and the transaction status of the target distributed transaction pipeline is updated to success.

[0043] Optionally, the device is also used for:

[0044] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is less than the preset threshold, the corresponding microservice of the branch transaction is called again;

[0045] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is greater than or equal to a preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction flow and the target distributed transaction flow corresponding to the branch transaction are updated.

[0046] In a third aspect, the present application provides an electronic device, including a processor and a memory storing execution instructions. When the processor executes the execution instructions stored in the memory, the processor executes the distributed transaction processing method as in the first aspect.

[0047] In a fourth aspect, the present application provides a readable storage medium, comprising computer execution instructions. When a processor of an electronic device executes the computer execution instructions, the electronic device executes the distributed transaction processing method as in the first aspect.

[0048] In a fifth aspect, the present application provides a program product, which includes a computer program, and the computer program is executed by a processor to implement the distributed transaction processing method as in the first aspect.

[0049] The distributed transaction processing method, apparatus, device and storage medium provided by the present application determine the key branch transaction among multiple branch transactions of the target distributed transaction. When the key branch transaction is successfully executed, it is determined that the target distributed transaction is not rolled back and the next branch transaction is executed. When the branch branch transaction whose execution order is after the key branch transaction fails to execute, the target distributed transaction is not rolled back and the corresponding branch transaction flow means is updated. The key branch transaction and the branch branch transaction whose execution order is after the key branch transaction are not packaged into a large service. The failure of the branch branch transaction to execute does not affect the success of the target distributed transaction. Only the failure of the branch branch transaction to execute is recorded in the corresponding branch transaction flow, which complies with the single responsibility specification of the service and reduces the difficulty of distributed transaction maintenance. In terms of the condition judgment of triggering distributed transaction compensation, compensation is not triggered when the branch branch transaction fails to execute. When the non-branch branch transaction fails to execute, the previous branch transaction is reversely compensated based on the execution order, which reduces the transaction coordination difficulty of the transaction coordinator. Therefore, the technical effect of reducing the difficulty of distributed transaction maintenance and transaction coordination is achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0051] Figure 1 This is a schematic diagram of the process of the distributed transaction processing method of the embodiment of the present application. Figure 1 ;

[0052] Figure 2 This is a schematic diagram of the process of the distributed transaction processing method of the embodiment of the present application. Figure 2 ;

[0053] Figure 3 The following is a flow chart of a distributed transaction processing method according to an embodiment of the present application. Figure 3 ;

[0054] Figure 4 The following is a flow chart of a distributed transaction processing method according to an embodiment of the present application. Figure 4 ;

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

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

[0057] Figure 7 A schematic diagram of the structure of a distributed transaction processing device provided in an embodiment of the present application.

[0058] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0059] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0060] It should be noted that the method and device for processing distributed transactions of the present application can be used in the field of distributed technology, and can also be used in any field except the financial field. The application field of the method and device for processing distributed transactions of the present application is not limited.

[0061] First, let us explain the terms used in this application:

[0062] Distributed transaction: refers to a distributed microservice architecture environment in which transaction participants, transaction-supporting servers, resource servers, and transaction managers are distributed on different machine nodes and generally belong to different applications. Distributed transactions must ensure that all operations on different machine nodes succeed or fail.

[0063] SAGA: refers to an open source distributed transaction solution for processing long-lived distributed transactions. SAGA decomposes a distributed transaction into multiple branch transactions. Each branch transaction in the distributed transaction will return a status code indicating the successful execution of the branch transaction or a status code indicating the failure of the execution. When a branch transaction of a distributed transaction fails to execute, the successfully executed branch transactions will be compensated in turn.

[0064] Transaction coordinator: refers to the program module that coordinates and controls the rollback and state flow of distributed transactions. It is used to coordinate the execution process of transactions in distributed transactions, including the opening and submission of distributed transactions, the opening and submission of branch transactions, and compensation for the previous branch transaction when the branch transaction returns a status code indicating execution failure. During the entire process of coordinating transaction processing, the transaction coordinator will call the transaction manager to record and update the flow of distributed transactions and corresponding branch transactions.

[0065] Aspect Oriented Programming (AOP) refers to a technology that achieves unified maintenance of program functions through pre-compilation and dynamic proxy during runtime. It defines distributed transaction annotations @GlobalTransaction and branch transaction annotations @BranchTransaction based on Spring annotations, and uses AOP to integrate the processing logic of opening, committing and rolling back distributed transactions into the business execution process.

[0066] Annotation: also called metadata, is a code-level description that can be declared in front of packages, classes, fields, methods, local variables, method parameters, etc. to describe and annotate these elements; Java provides some native annotations, such as @Override @Deprecated, etc.

[0067] Custom annotations: refers to annotations defined by users themselves using Java annotation definition method for their own needs.

[0068] In the prior art, SAGA is used to divide long-lived transactions into short transaction management, and the key transaction node and the branch transaction node whose execution order is after the key transaction node are encapsulated together. The key transaction node and the branch transaction node after the key transaction node are managed using local database transactions to make them succeed or fail at the same time, so as to avoid the situation where the key transaction node is executed successfully but the subsequent branch transaction fails to execute. This violates the specification of single responsibility of service under the microservice architecture, and when the subsequent branch transaction of the key transaction node is large, the services corresponding to the key transaction node and the branch transaction node after the key transaction node are mixed with too many functions and difficult to maintain; the prior art throws the branch transaction that fails or is abnormal to the transaction coordinator based on the database to trigger the transaction rollback, thereby triggering the compensation of the branch transaction that has been executed successfully, which increases the implementation difficulty of the transaction coordinator; therefore, the distributed transaction management method that fully complies with the SAGA distributed transaction implementation scheme has the technical problem of violating the single responsibility specification of service, resulting in difficulty in maintenance and transaction coordination.

[0069] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0070] Figure 1 This is a schematic diagram of the process of the distributed transaction processing method of the embodiment of the present application. Figure 1 .like Figure 1As shown, the distributed transaction processing method of the embodiment of the present application includes:

[0071] S101. Based on a target distributed transaction, determine the execution order of multiple branch transactions corresponding to the target distributed transaction, and identify key branch transactions of the target distributed transaction by red line marking;

[0072] In this embodiment, the target distributed transaction is a distributed transaction, and application scenarios of the distributed transaction include: cross-database distributed transaction, cross-service distributed transaction and hybrid distributed transaction.

[0073] In this embodiment, the distributed transaction processing method provided by the present application can be based on SAGA, and the target distributed transaction can be divided into multiple branch transactions for management; in a specific example, the target distributed transaction includes branch transaction A, branch transaction B, branch transaction C and branch transaction D, among which branch transaction C is a key branch transaction.

[0074] There is a sequential execution order between the branch transactions, for example, the execution order is: branch transaction A→branch transaction B→branch transaction C→branch transaction D.

[0075] S102: In response to the business request, start a target distributed transaction and create a target distributed transaction pipeline.

[0076] In this embodiment, before executing the target distributed transaction, a target distributed transaction is first opened, and a target distributed transaction flow is established through the target distributed transaction. In this way, during the execution of the target distributed transaction, the target distributed transaction flow can be updated to record the problems encountered during the execution of the target distributed transaction, such as the failure of the target distributed transaction to execute or the success of the target distributed transaction flow.

[0077] S103, determining branch transactions to be executed one by one based on the execution order, creating branch transaction flow of the branch transactions, and judging whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0078] In this embodiment, before executing a branch transaction, a branch transaction flow of the branch transaction is created. After executing the branch transaction, the transaction status of the corresponding branch transaction flow is updated based on the status code. The transaction status may be a successful execution or a failed execution, or a timeout of calling the corresponding microservice of the branch transaction.

[0079] In this embodiment, different scenarios correspond to different operation processes. Assuming that each operation process has several branch transactions to be processed, there may be some relatively important key branch transactions among these branch transactions, and the key branch transactions can be marked with red lines. In this way, during the execution of the entire operation process, it can be distinguished whether the currently executed branch transaction is a key branch transaction.

[0080] Before executing a branch transaction, whether the branch transaction is a critical branch transaction is determined based on whether there is a field marked with a red line in the branch transaction flow. If the corresponding field in the branch transaction flow indicates that the branch transaction has a red line mark, then the branch transaction is a critical branch transaction.

[0081] S104: Execute the branch transaction and return a status code after the branch transaction is executed.

[0082] Among them, the status code is used to indicate the success or failure of the branch transaction execution;

[0083] In this embodiment, when there are multiple branch transactions, each branch transaction will return a status code after execution. The branch transaction can be successfully executed by returning the status code "00", and the branch transaction can be failed by returning the business status code "01". When the microservice corresponding to the branch transaction returns "00" and the branch transaction is not a critical branch transaction, the branch transaction pipeline is updated and the next branch transaction is executed.

[0084] S105. When the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is a critical branch transaction, it is determined that the branch transaction that was successfully executed before the critical branch transaction is not rolled back, the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the critical branch transaction are updated to success, and the next branch transaction to be executed is determined based on the execution order; wherein the branch transaction corresponds to the branch transaction flow one by one, and different branch transactions correspond to different branch transaction flows.

[0085] In this embodiment, when a branch transaction is executed successfully, the branch transaction is committed and the corresponding branch transaction flow is updated, and the next branch transaction is executed based on the forward interface of the service corresponding to the next branch transaction. When all branch transactions are executed successfully, the distributed transaction is committed and the distributed transaction flow is updated in the distributed transaction aspect; when it is determined that a branch transaction is a key branch transaction, the branch transaction whose execution order is after the key branch transaction is a minor branch transaction.

[0086] In this embodiment, the execution interface of the service corresponding to each branch transaction includes a forward interface and a reverse interface. When the branch transaction is executed successfully, the next branch transaction is executed one by one according to the execution order based on the forward interface of the corresponding service; when the branch transaction fails to execute and the branch transaction is not a branch transaction, the previous branch transaction is reversely compensated according to the execution order based on the reverse interface of the corresponding service, the distributed transaction is started and the key branch transaction is determined based on the transaction coordinator, and the distributed transaction flow and the branch transaction flow are recorded and updated based on the transaction manager.

[0087] In this embodiment, when the key branch transaction is executed successfully, it is determined that the target distributed transaction is not rolled back and the branch transaction flow and the target distributed transaction flow are updated. When the branch transaction after the key branch transaction fails to execute, the status code returned by the branch transaction that represents the failure of the branch transaction execution is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution process of the branch transaction corresponding to the target distributed transaction based on the execution order, but the transaction compensation logic is not triggered, and only the branch transaction flow corresponding to the branch transaction is updated.

[0088] The distributed transaction processing method provided by the present application determines the key branch transaction among multiple branch transactions of the target distributed transaction. When executing branch transactions before the key branch transaction, if these branch transactions fail to execute, they can be rolled back. After successfully executing the key branch transaction, other branch transactions after the key branch transaction continue to be executed. If these transaction branches after the key branch transaction fail to execute, they will not be rolled back. In addition, when the key branch transaction is successfully executed, the next branch transaction will continue to be executed. When a branch transaction whose execution order is after the key branch transaction fails, the target distributed transaction is not rolled back and the corresponding branch transaction flow is updated, so that the key branch transaction and the branch transaction whose execution order is after the key branch transaction are not packaged into a large service, and the failure of the branch transaction does not affect the success of the target distributed transaction. Only the failure of the branch transaction is recorded in the corresponding branch transaction flow, which complies with the service single responsibility specification and reduces the difficulty of distributed transaction maintenance. In terms of the condition judgment of triggering distributed transaction compensation, compensation is not triggered when the branch transaction fails. When the non-branch branch transaction fails, the previous branch transaction is reversely compensated based on the execution order, which reduces the transaction coordination difficulty of the transaction coordinator. Therefore, the technical effect of reducing the difficulty of distributed transaction maintenance and transaction coordination is achieved.

[0089] Figure 2 This is a schematic diagram of the process of the distributed transaction processing method of the embodiment of the present application. Figure 2 .like Figure 2 As shown, the distributed transaction processing method of the embodiment of the present application includes:

[0090] S201. Based on a target distributed transaction, determine the execution order of multiple branch transactions corresponding to the target distributed transaction, and identify key branch transactions of the target distributed transaction by red line marking;

[0091] S202: In response to the business request, start a target distributed transaction and create a target distributed transaction pipeline;

[0092] S203, determining branch transactions to be executed one by one based on the execution order, creating branch transaction flow of the branch transactions, and judging whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0093] S204: Execute the branch transaction, and return a status code representing the execution result of the branch transaction after the execution of the branch transaction is completed;

[0094] S205. When the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is a critical branch transaction, determine that the target distributed transaction is not rolled back, update the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the critical branch transaction to success, and determine the next branch transaction to be executed based on the execution order; wherein the branch transaction corresponds to the branch transaction flow one by one, and different branch transactions correspond to different branch transaction flows;

[0095] In this embodiment, the status code returned by the branch transaction indicating the failure of the branch transaction execution can be represented by the business status code "01", wherein the judgment of the branch transaction needs to be performed in combination with the execution order; in a specific embodiment, the branch transaction returns the status code "01" indicating the failure of the execution, and only the branch transaction flow is updated, and the target distributed transaction is not rolled back accordingly.

[0096] In this embodiment, if the forward interface of the corresponding service of the branch transaction returns the business status code "01" indicating the execution failure, the compensation trigger packages the failed status code into a custom exception based on the returned status code, and throws it to the transaction coordinator in the distributed transaction aspect, thereby interrupting the execution process of the distributed transaction and triggering the transaction compensation logic; the transaction coordinator reversely calls the reverse interface of the corresponding service of the previous successfully executed branch transaction based on the execution order, and compensates the previous branch transaction to realize compensation processing of the distributed transaction.

[0097] S206: When the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is not a critical branch transaction, the transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order;

[0098] S207: When the branch transaction returns a status code indicating that the branch transaction has failed to execute, determine whether the branch transaction is a minor branch transaction based on the execution order; wherein the minor branch transaction refers to a branch transaction that is ranked after the key branch transaction in the execution order;

[0099] S208. When the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is not a branch transaction, the status code indicating that the branch transaction has failed to execute returned by the branch transaction is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution of multiple branch transactions corresponding to the target distributed transaction based on the execution order, and reversely compensate the previous branch transaction of the branch transaction based on the execution order to cancel the operation performed when executing the previous branch transaction, and update the transaction status of the branch transaction flow corresponding to the branch transaction to failure;

[0100] In this embodiment, the custom exception refers to the information representing the branch transaction status code added in the SAGA model based on the present application, which is used to determine whether the branch transaction is executed successfully.

[0101] S209: When the branch transaction returns a status code indicating that the branch transaction execution failed, and the branch transaction is a branch transaction, the transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure;

[0102] S210: When a call timeout occurs during the execution of a branch transaction, if the number of calls to the branch transaction is less than a preset threshold, the corresponding microservice of the branch transaction is called again; if the number of calls to the branch transaction is greater than or equal to the preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction flow and the target distributed transaction flow corresponding to the branch transaction is updated;

[0103] S211. When all branch transactions corresponding to the target distributed transaction return a status code indicating successful execution of the branch transaction, the target distributed transaction is committed, and the transaction status of the target distributed transaction flow is updated to success.

[0104] Through the above S201 to S211, it can be achieved that the failure of the branch transaction execution does not affect the success of the target distributed transaction, and the failure of the branch transaction execution is only recorded in the corresponding branch transaction flow, which complies with the service single responsibility specification and reduces the difficulty of distributed transaction maintenance; in terms of the condition judgment for triggering distributed transaction compensation, compensation is not triggered when the branch transaction execution fails, and when the non-branch branch transaction fails, the previous branch transaction is reversely compensated based on the execution order, thereby reducing the transaction coordination difficulty of the transaction coordinator.

[0105] Figure 3 The following is a flow chart of a distributed transaction processing method according to an embodiment of the present application. Figure 3 , Figure 4 The following is a flow chart of a distributed transaction processing method according to an embodiment of the present application. Figure 4 .like Figure 3 and Figure 4 As shown, the distributed transaction processing method provided by the present application is based on the SAGA distributed transaction implementation solution. The branch transactions corresponding to the target distributed transaction include branch transaction A, branch transaction B, branch transaction C and branch transaction D, wherein branch transaction C is a key branch transaction. The status code returned after the branch transaction is executed includes a status code "00" representing a successful execution and a status code "01" representing a failed execution. The execution interface of the service corresponding to each branch transaction includes a forward interface and a reverse interface. When the branch transaction is successfully executed, the next branch transaction is executed one by one according to the execution order based on the forward interface of the corresponding service. When the branch transaction fails to execute, the previous branch transaction is reversely compensated according to the execution order based on the reverse interface of the corresponding service. The distributed transaction is started and the key branch transaction is determined based on the transaction coordinator. The distributed transaction and the branch transaction flow are recorded and updated based on the transaction manager. The method includes:

[0106] S301: Based on the target distributed transaction, determine that the execution order of multiple branch transactions corresponding to the target distributed transaction is branch transaction A, branch transaction B, branch transaction C, and branch transaction D, and mark branch transaction C as a key branch transaction through a red line;

[0107] In this embodiment, the aspects of the target distributed transaction and the branch transaction can be implemented, the annotations of the target distributed transaction and the branch transaction can be defined using Spring annotations, and the processing logic of starting, committing and rolling back the distributed transaction can be integrated into the business processing flow using aspect-oriented programming.

[0108] In this embodiment, the implementation process of the target distributed transaction can be used as the main business process. In this embodiment, four branch transactions are defined, including branch transaction A, branch transaction B, branch transaction C, and branch transaction D, among which branch transaction C is the key branch transaction, and annotations of the target distributed transaction and the branch transaction are added to the method of the main business process of the target distributed transaction and the forward and interface corresponding to the branch transaction, respectively.

[0109] S302: In response to the business request, start a target distributed transaction and create a target distributed transaction pipeline;

[0110] S303, determining branch transactions to be executed one by one based on the execution order, creating branch transaction flow of the branch transactions, and judging whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0111] S304: Execute the branch transaction, and return a status code representing the execution result of the branch transaction after the execution of the branch transaction is completed;

[0112] S305. When the branch transaction returns a status code "00" indicating successful execution of the branch transaction, and the branch transaction is branch transaction C, determine that the target distributed transaction is not rolled back, update the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the key branch transaction to success, and determine that the next branch transaction to be executed is branch transaction D based on the execution order;

[0113] S306: When the branch transaction returns a status code "00" indicating successful execution of the branch transaction, and the branch transaction is not branch transaction C, the transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order;

[0114] In this embodiment, branch transaction annotations can be added to the forward interfaces of the services corresponding to branch transactions A, B, C, and D, such as the @BranchTransaction annotation, and the redFlag attribute of the annotation redline mark field of the service corresponding to branch transaction C is set to true, that is, branch transaction C is marked with a red line and set as a critical branch transaction, and the redline mark field attributes of other branch transactions are not set.

[0115] S307: When the branch transaction returns the status code "01" indicating that the branch transaction execution failed, determine whether the branch transaction is a branch transaction, that is, branch transaction D, based on the execution order;

[0116] In this embodiment, the judgment of the branch transaction, i.e., branch transaction D, needs to be combined with the execution order; in a specific embodiment, branch transaction D returns a status code indicating execution failure, only updates the branch transaction flow, does not trigger the compensation logic, and does not roll back the target distributed transaction. That is, since the key branch transaction is branch transaction C, and branch transaction C has been successfully executed, when continuing to execute branch transaction D, if branch transaction D fails to execute, then the previously successfully executed branch transactions A, branch transaction B, and branch transaction C will not be rolled back. If branch transaction C or branch transaction A or branch transaction B before branch transaction C fails to execute, then a rollback operation can be performed.

[0117] S308. When the branch transaction returns a status code "01" indicating that the branch transaction has failed to execute, and the branch transaction is not branch transaction D, the status code "01" indicating that the branch transaction has failed to execute returned by the branch transaction is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution of multiple branch transactions corresponding to the target distributed transaction based on the execution order, and reversely compensate the previous branch transaction of the branch transaction based on the execution order to cancel the operation performed when executing the previous branch transaction, and update the transaction status of the branch transaction flow corresponding to the branch transaction to failure;

[0118] In this embodiment, the custom exception refers to the information representing the branch transaction status code added in the SAGA model of this application, which is used to determine whether the branch transaction is successfully executed; in this embodiment, an exception class is customized, and there is a state attribute in the exception class. After determining that the branch transaction execution fails, the failed business status code "01" is assigned to the state attribute, and the exception class is thrown to terminate the execution process of the branch transaction corresponding to the target distributed transaction based on the execution order. The target distributed transaction aspect captures the exception and determines whether to trigger the transaction compensation logic according to the value of the state attribute in the exception object, that is, whether to reversely compensate the previous branch transaction of the branch transaction based on the execution order;

[0119] In this embodiment, when the branch transaction is branch transaction A, branch transaction B or branch transaction C, it is necessary to assign the status code returned by it to the status attribute of the exception class, and send the exception class to the transaction coordinator to trigger the transaction compensation logic.

[0120] In this embodiment, if branch transaction B fails to execute, when it is determined through the exception class and the target distributed transaction aspect that the previous branch transaction of the branch transaction needs to be reversely compensated based on the execution order, return to the previous branch transaction, that is, branch transaction A, and undo the operations when executing branch transaction A, and restore the service status to the status before branch transaction A was executed.

[0121] S309: When the branch transaction returns a status code indicating that the branch transaction execution failed, and the branch transaction is a branch transaction, the transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure;

[0122] S310: When a call timeout occurs during the execution of a branch transaction, if the number of calls to the branch transaction is less than a preset threshold, the corresponding microservice of the branch transaction is called again; if the number of calls to the branch transaction is greater than or equal to the preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction flow and the target distributed transaction flow corresponding to the branch transaction is updated;

[0123] In this embodiment, a threshold may be preset based on the type of distributed transaction or user requirements to determine the number of times the service call corresponding to the branch transaction can be re-called after a timeout.

[0124] S311. When branch transaction A, branch transaction B, branch transaction C, and branch transaction D all return the status code "00" indicating successful execution of the branch transaction, it is determined that the target distributed transaction is successfully executed, and the transaction status of the target distributed transaction pipeline is updated to success.

[0125] The distributed transaction processing method provided by the present application determines a key branch transaction among multiple branch transactions of a target distributed transaction. When the key branch transaction is successfully executed, it is determined that the target distributed transaction is not rolled back and the next branch transaction is executed. When the branch transaction fails to execute, the compensation logic is triggered, and the previous branch transaction is undo. When the branch transaction is a branch transaction after the key branch transaction, if the execution is successful, the next branch transaction is continued to be executed. If the execution fails, the compensation logic is not triggered, and the branch transaction flow is updated based on the status code of the branch transaction. When the branch transaction after the key branch transaction fails to execute, the target distributed transaction is not rolled back and the corresponding branch transaction is updated. The transaction flow method ensures that the key branch transaction and the branch transactions that follow the key branch transaction in the order of execution are not packaged into a large service. The failure of the branch transaction execution does not affect the success of the target distributed transaction. The failure of the branch transaction execution is only recorded in the corresponding branch transaction flow, which complies with the service single responsibility specification and reduces the difficulty of distributed transaction maintenance. In terms of the condition judgment for triggering distributed transaction compensation, compensation is not triggered when the branch transaction fails to execute. When a non-branch branch transaction fails to execute, the previous branch transaction is reversely compensated based on the execution order, which reduces the transaction coordination difficulty of the transaction coordinator. Therefore, the technical effect of reducing the difficulty of distributed transaction maintenance and transaction coordination is achieved.

[0126] Figure 5 The structure diagram of a distributed transaction processing device provided in an embodiment of the present application is shown in FIG. The device of this embodiment may be in the form of software and / or hardware. Figure 5 As shown, a distributed transaction processing device 500 provided in an embodiment of the present application includes: a first processing module 501, an opening module 502, a second processing module 503, an execution module 504 and a third processing module 505.

[0127] The first processing module 501 is used to determine the execution order of multiple branch transactions corresponding to the target distributed transaction based on the target distributed transaction, and identify the key branch transactions of the target distributed transaction by red line marking;

[0128] The start module 502 is used to start the target distributed transaction and create the target distributed transaction pipeline in response to the business request;

[0129] The second processing module 503 is used to determine the branch transactions to be executed one by one based on the execution order, create a branch transaction flow of the branch transaction, and determine whether the branch transaction is a key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has a red line mark;

[0130] The execution module 504 is used to execute the branch transaction and return a status code after the branch transaction is executed. The status code is used to indicate whether the branch transaction is executed successfully or failed;

[0131] The third processing module 505 is used to determine that the branch transaction that was successfully executed before the critical branch transaction is not rolled back when the branch transaction is successfully executed and the branch transaction is a critical branch transaction, update the transaction status of the target distributed transaction flow and the branch transaction flow corresponding to the critical branch transaction to success, and determine the next branch transaction to be executed based on the execution order; wherein the branch transaction corresponds to the branch transaction flow one by one, and different branch transactions correspond to different branch transaction flows.

[0132] In a possible implementation, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, the device is further configured to:

[0133] Based on the execution order, determine whether the branch transaction is a minor branch transaction; wherein the minor branch transaction refers to a branch transaction that is sequenced after the key branch transaction in the execution order;

[0134] If not, the previous branch transaction of the branch transaction is reversely compensated based on the execution order to undo the operations performed when executing the previous branch transaction, and the transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure.

[0135] In a possible implementation, when the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is a branch transaction, the device is further configured to:

[0136] The transaction status of the branch transaction flow corresponding to the update branch transaction is failed.

[0137] In a possible implementation, when a branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is not a branch transaction, before reversely compensating a previous branch transaction of the branch transaction based on the execution order, the device is further configured to:

[0138] The status code returned by the branch transaction indicating the failure of the branch transaction execution is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution process of multiple branch transactions corresponding to the target distributed transaction based on the execution order.

[0139] In a possible implementation, when the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is not a critical branch transaction, the device is further configured to:

[0140] The transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order.

[0141] In a possible implementation, the device is further used for:

[0142] When all branch transactions corresponding to the target distributed transaction return a status code indicating successful execution of the branch transaction, the target distributed transaction is committed, and the transaction status of the target distributed transaction pipeline is updated to success.

[0143] In a possible implementation, the device is further used for:

[0144] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is less than the preset threshold, the corresponding microservice of the branch transaction is called again;

[0145] If a call timeout occurs during the execution of a branch transaction and the number of calls to the branch transaction is greater than or equal to a preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction flow and the target distributed transaction flow corresponding to the branch transaction are updated.

[0146] Figure 6 A schematic diagram of the structure of a distributed transaction processing device provided in an embodiment of the present application, wherein the distributed transaction processing device 600 includes:

[0147] Processor 601 and memory 602;

[0148] Memory stores computer-executable instructions;

[0149] The processor executes the computer execution instructions stored in the memory 602, so that the electronic device executes the processing method of the distributed service as described above.

[0150] Figure 7 A schematic diagram of the structure of a distributed transaction processing device provided in an embodiment of the present application is shown in FIG. Figure 7 As shown, it includes a transaction coordinator, a transaction manager, a transaction compensation trigger module and a transaction aspect.

[0151] Among them, the distributed transaction coordinator is mainly used to coordinate the transaction execution process, such as the opening and submission of global transactions (that is, opening the target distributed transaction), the opening and submission of branch transactions, the control of transaction compensation logic after branch transaction failure, and the processing of keeping distributed transactions from rolling back after transaction failure after the red line node.

[0152] When coordinating the execution of transactions, the transaction coordinator needs to call the transaction manager to record and update the corresponding transaction flow. For example, when starting\committing a transaction, the corresponding transaction flow record will be inserted and updated.

[0153] The transaction manager is a set of application programming interfaces (APIs) for data persistence and data update, which are called by the transaction coordinator. The transaction opening, submission and status transfer process all require the transaction coordinator to persist records and update transaction flow through the transaction manager.

[0154] The transaction compensation trigger module is mainly used to determine whether the branch transaction is executed successfully. If the branch transaction is executed successfully, the next branch transaction will be executed. If the branch transaction fails to execute, the transaction coordinator needs to be notified to enter the transaction compensation phase.

[0155] The transaction aspect is mainly used to use aspect-oriented programming (AOP) to integrate the processing logic of opening, committing and rolling back distributed transactions into the business execution flow. The specific process is: using Spring annotations to define the global transaction annotation @GlobalTransaction and the branch transaction annotation @BranchTransaction, and using AOP aspect-oriented programming to integrate the processing logic of opening, committing and rolling back distributed transactions into the business execution flow.

[0156] The embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, a method for processing distributed transactions is implemented.

[0157] An embodiment of the present disclosure provides a computer program product, including a computer program, which implements the above-mentioned distributed transaction processing method when executed by a processor.

[0158] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0159] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A distributed transaction processing method, characterized in that: The method comprises: Based on the target distributed transaction, determine the execution order of multiple branch transactions corresponding to the target distributed transaction, and identify the key branch transactions of the target distributed transaction by red line marking; In response to the business request, start the target distributed transaction and create the target distributed transaction pipeline; Determine the branch transactions to be executed one by one based on the execution order, create a branch transaction flow of the branch transaction, and determine whether the branch transaction is the key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has the red line mark; Execute the branch transaction, and return a status code after the execution of the branch transaction is completed, wherein the status code is used to indicate whether the execution of the branch transaction is successful or failed; When the branch transaction is executed successfully and the branch transaction is a critical branch transaction, it is determined that the branch transaction that was successfully executed before the critical branch transaction is not rolled back, the transaction status of the target distributed transaction pipeline and the branch transaction pipeline corresponding to the critical branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order; wherein the branch transaction corresponds to the branch transaction pipeline one by one, and different branch transactions correspond to different branch transaction pipelines.

2. The processing method according to claim 1, characterized in that: When the branch transaction returns a status code indicating that the branch transaction has failed to execute, the method further includes: Based on the execution order, determining whether the branch transaction is a minor branch transaction; wherein the minor branch transaction refers to a branch transaction that is sequenced after the key branch transaction in the execution order; If not, the previous branch transaction of the branch transaction is reversely compensated based on the execution order to cancel the operation performed when the previous branch transaction is executed, and the transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to failure.

3. The processing method according to claim 2, characterized in that: When the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is the branch transaction, the method further includes: The transaction status of the branch transaction flow corresponding to the branch transaction is updated to failure.

4. The processing method according to claim 3, characterized in that: When the branch transaction returns a status code indicating that the branch transaction has failed to execute, and the branch transaction is not the branch transaction, before reversely compensating the previous branch transaction of the branch transaction based on the execution order, the method further includes: The status code returned by the branch transaction and indicating the failure of the branch transaction execution is packaged into a custom exception, and the custom exception is sent to the transaction coordinator of the target distributed transaction to terminate the execution process of the multiple branch transactions corresponding to the target distributed transaction based on the execution order.

5. The processing method according to claim 1, characterized in that: When the branch transaction returns a status code indicating that the branch transaction is successfully executed, and the branch transaction is not the key branch transaction, the method further includes: The transaction status of the branch transaction pipeline corresponding to the branch transaction is updated to success, and the next branch transaction to be executed is determined based on the execution order.

6. The processing method according to claim 1, characterized in that: The method further comprises: When all the branch transactions corresponding to the target distributed transaction return a status code indicating that the branch transaction is successfully executed, the target distributed transaction is committed, and the transaction status of the target distributed transaction pipeline is updated to success.

7. The processing method according to any one of claims 1 to 6, characterized in that: The method further comprises: If a call timeout occurs during the execution of the branch transaction and the number of calls to the branch transaction is less than a preset threshold, re-call the microservice corresponding to the branch transaction; When a call timeout occurs during the execution of the branch transaction and the number of calls to the branch transaction is greater than or equal to the preset threshold, the target distributed transaction is suspended and the transaction status of the branch transaction pipeline and the target distributed transaction pipeline corresponding to the branch transaction are updated.

8. A distributed transaction processing device, comprising: A first processing module is used to determine, based on a target distributed transaction, an execution order of multiple branch transactions corresponding to the target distributed transaction, and to identify key branch transactions of the target distributed transaction by red line marking; The start module is used to start the target distributed transaction and create the target distributed transaction pipeline in response to the business request; A second processing module is configured to determine the branch transactions to be executed one by one based on the execution order, create a branch transaction flow of the branch transaction, and determine whether the branch transaction is the key branch transaction based on the branch transaction flow; wherein the branch transaction flow includes a field for indicating whether the branch transaction has the red line mark; An execution module, used for executing the branch transaction and returning a status code after the execution of the branch transaction is completed, wherein the status code is used for indicating whether the execution of the branch transaction is successful or failed; The third processing module is used to, when the branch transaction is successfully executed and the branch transaction is a critical branch transaction, determine that the branch transaction that was successfully executed before the critical branch transaction is not rolled back, update the transaction status of the target distributed transaction pipeline and the branch transaction pipeline corresponding to the critical branch transaction to success, and determine the next branch transaction to be executed based on the execution order; wherein the branch transaction corresponds to the branch transaction pipeline one by one, and different branch transactions correspond to different branch transaction pipelines.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the distributed transaction processing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the distributed transaction processing method according to any one of claims 1 to 7.