Distributed transaction processing method and device, storage medium and electronic equipment

By obtaining the identification information and processing status of distributed transactions, querying and executing the corresponding processing flow from the local control table, the consistency problem in the distributed transaction processing process is solved, and efficient, transparent and correct transaction processing is achieved.

CN114371918BActive Publication Date: 2026-03-24INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-10
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

In existing technologies, distributed transactions suffer from poor consistency during processing and are prone to errors.

Method used

By obtaining the identification information of the distributed transaction, the corresponding control table of the distributed transaction is queried from multiple local control tables to determine its processing status. The distributed transaction is then processed according to the processing status and the preset processing flow, including the orderly execution of positive transactions, confirmation transactions, and compensation transactions.

Benefits of technology

It enables efficient and orderly processing of distributed transactions, improves the accuracy and efficiency of transaction processing, and ensures the security and transparency of transaction funds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114371918B_ABST
    Figure CN114371918B_ABST
Patent Text Reader

Abstract

The application discloses a processing method and device of a distributed transaction, a storage medium and an electronic device. It relates to the field of cloud computing, and the method comprises the following steps: acquiring identification information of a distributed transaction; querying a control table corresponding to the distributed transaction from a plurality of control tables in the local according to the identification information, and determining a processing state of the distributed transaction recorded in the control table of the distributed transaction, wherein the control table corresponds to the distributed transaction uniquely, the control table comprises identification information of the distributed transaction, and the current processing state of the distributed transaction is recorded; and processing the distributed transaction according to the processing state and a preset processing flow of the distributed transaction, wherein the processing flow comprises a next processing operation corresponding to the processing state. Through the application, the problem that the consistency of the distributed transaction is poor and errors are prone to occur in the processing process in the related art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of cloud computing, in particular to a distributed transaction processing method and device, a storage medium and an electronic equipment. BACKGROUND

[0002] At present, the development of the Internet industry is in full swing, and most companies have carried out database cluster splitting and micro-service transformation. In this case, completing a transaction changes from a local transaction to a distributed transaction between multiple database clusters and multiple services. A distributed transaction, spanning multiple database clusters and multiple services, needs to ensure the consistency of the transaction, and the operations within the transaction are either all successful or all failed. Common technical solution models include SAGA (also known as long-running transaction) transaction mode and 2-phase TCC transaction mode. The 2-phase TCC transaction mode, i.e. Try-Confirm-Cancel, detects- confirms-compensation (or cancellation), i.e. compensation transaction, Try operation as the first phase, responsible for resource checking and reservation; Confirm operation as the second phase commit operation, executes the real business; Cancel is the cancellation of reserved resources. However, the existing technology is prone to out-of-order problems between the normal transaction and the compensation transaction (or confirmation transaction), causing data inconsistency.

[0003] In view of the poor consistency of the distributed transaction in the related art in the processing process, and the problem that errors are prone to occur, no effective solution has been proposed so far. SUMMARY

[0004] The main purpose of the present application is to provide a distributed transaction processing method, device, storage medium and electronic equipment to solve the problem of poor consistency of the distributed transaction in the related art in the processing process, and the problem that errors are prone to occur.

[0005] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a distributed transaction processing method is provided, comprising: obtaining the identification information of a distributed transaction; querying the control table corresponding to the distributed transaction from the local multiple control tables according to the identification information, and determining the processing state of the distributed transaction recorded in the control table of the distributed transaction, wherein the control table corresponds to the distributed transaction uniquely, and the control table includes the identification information of the distributed transaction and the current processing state of the distributed transaction recorded; processing the distributed transaction according to the processing state and the preset processing flow of the distributed transaction, wherein the processing flow includes the next processing operation corresponding to the processing state.

[0006] Optionally, after processing the distributed transaction according to the processing state and the processing flow preset for the distributed transaction, the method further comprises: determining a processing result of the distributed transaction after the processing of the distributed transaction is completed; updating the processing state in the control table in a case where the processing result is that the processing of the distributed transaction is successful; and rolling back the distributed transaction in a case where the processing result is that the processing of the distributed transaction fails.

[0007] Optionally, the distributed transaction comprises a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; wherein the positive transaction sub-transaction and the confirmation transaction sub-transaction are executed according to a processing logic; the positive transaction sub-transaction is used to extract transaction fund data from a transaction funding party account; the confirmation transaction sub-transaction is used to send the transaction fund data extracted by the positive transaction sub-transaction to a transaction receiving party account; and the compensation transaction sub-transaction is used to return the extracted transaction fund data to the transaction funding party account in a case where the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

[0008] Optionally, the processing state comprises transaction execution in progress, transaction execution success, transaction execution failure, transaction compensation in progress, transaction compensation success, transaction compensation failure, empty rollback, transaction confirmation in progress, transaction confirmation success, transaction confirmation failure, and record nonexistence.

[0009] Optionally, in a case where the distributed transaction is the positive transaction sub-transaction, processing the distributed transaction according to the processing state and the processing flow preset for the distributed transaction comprises: in a case where the processing state is record nonexistence or transaction execution in progress, inserting a record with a processing state of transaction execution in progress, and entering a first processing flow of the positive transaction sub-transaction; and in a case where the processing state is another state, rejecting processing of the positive transaction sub-transaction, returning an error, and triggering the compensation transaction sub-transaction.

[0010] Optionally, in a case where the distributed transaction is the confirmation transaction sub-transaction, processing the distributed transaction according to the processing state and the processing flow preset for the distributed transaction comprises: in a case where the processing state is transaction confirmation success, directly returning processing success of the confirmation transaction sub-transaction; in a case where the processing state is transaction execution success, updating the processing state to transaction confirmation in progress, and entering a second processing flow of the confirmation transaction sub-transaction; and in a case where the processing state is another state, rejecting processing of the confirmation transaction sub-transaction, returning an error, and triggering the compensation transaction sub-transaction.

[0011] Optionally, when the distributed transaction is the compensation transaction sub-transaction, processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction includes: when the processing status is that the record does not exist or the transaction is in progress, updating the processing status to empty rollback and returning the processing success of the compensation transaction sub-transaction; when the processing status is empty rollback or transaction compensation is successful, directly returning the processing success of the confirmation transaction sub-transaction; when the processing status is that the transaction is successfully executed, updating the processing status to transaction compensation in progress and entering the third processing flow of the compensation transaction sub-transaction; when the processing status is other statuses, rejecting the processing of the compensation transaction sub-transaction and returning an error.

[0012] To achieve the above objectives, according to another aspect of this application, a distributed transaction processing apparatus is provided, comprising: an acquisition module for acquiring identification information of a distributed transaction; a query and determination module for querying a corresponding control table of the distributed transaction from multiple local control tables based on the identification information, and determining the processing status of the distributed transaction recorded in the control table, wherein the control table uniquely corresponds to the distributed transaction, and the control table includes the identification information of the distributed transaction and the recorded current processing status of the distributed transaction; and a processing module for processing the distributed transaction according to the processing status and a preset processing flow of the distributed transaction, wherein the processing flow includes a next processing operation corresponding to the processing status.

[0013] To achieve the above objectives, according to another aspect of this application, a computer-readable storage medium is provided, characterized in that the storage medium is used to store a program, wherein the program executes the distributed transaction processing method described in any one of the above claims when it runs.

[0014] To achieve the above objectives, according to another aspect of this application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the distributed transaction processing method described in any one of the above.

[0015] This application employs the following steps: obtaining the identification information of a distributed transaction; querying the corresponding distributed transaction control table from multiple local control tables based on the identification information, and determining the processing status of the distributed transaction recorded in the control table, wherein the control table uniquely corresponds to the distributed transaction, and includes the identification information of the distributed transaction and the recorded current processing status; processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, wherein the processing flow includes the next processing operation corresponding to the processing status. By using the identification information and establishing a transaction control table, distributed transactions are processed efficiently and orderly, solving the problems of poor consistency and easy errors in the processing of distributed transactions in related technologies. This ultimately improves transaction processing efficiency and accuracy. Attached Figure Description

[0016] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0017] Figure 1 This is a flowchart of a distributed transaction processing method provided according to an embodiment of this application;

[0018] Figure 2 This is a schematic diagram of the system structure provided according to the embodiments of this application;

[0019] Figure 3 This is a control flow chart of a positive transaction provided according to the embodiments of this application;

[0020] Figure 4 This is a control flowchart for confirming transaction transactions provided according to the embodiments of this application;

[0021] Figure 5 This is a control flowchart of compensation transaction provided according to the embodiments of this application;

[0022] Figure 6 This is a schematic diagram of a distributed transaction processing apparatus provided according to an embodiment of this application;

[0023] Figure 7 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0024] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] For ease of description, the following explains some of the nouns or terms used in the embodiments of this application:

[0028] Idempotency: For the same transaction, repeated calls will only succeed once. Furthermore, the business result of each repeated call should be the same as the result of the first call.

[0029] Empty rollback: In a branch transaction, if the compensation transaction of the second phase of the transaction occurs before the positive transaction of the first phase, the transaction should be allowed to close normally.

[0030] Anti-hanging: After a branch transaction rollback, when the first-stage active transaction resumes after a network outage, the business application should be able to refuse to handle the returned exception.

[0031] The present invention will now be described in conjunction with preferred implementation steps. Figure 1 This is a flowchart of a distributed transaction processing method provided according to an embodiment of this application, such as... Figure 1 As shown, the method includes the following steps:

[0032] Step S101: Obtain the identification information of the distributed transaction;

[0033] Step S102: Based on the identification information, query the corresponding control table of the distributed transaction from multiple control tables in the local area, and determine the processing status of the distributed transaction recorded in the control table of the distributed transaction. The control table is uniquely associated with the distributed transaction, and includes the identification information of the distributed transaction and the current processing status of the distributed transaction.

[0034] Step S103: Process the distributed transaction according to the processing status and the preset processing flow of the distributed transaction. The processing flow includes the next processing operation corresponding to the processing status.

[0035] The above steps can be executed by a processor or controller. Through these steps, the identification information of the distributed transaction is obtained. Based on the identification information, the corresponding distributed transaction control table is queried from multiple local control tables, and the processing status of the distributed transaction recorded in the control table is determined. Each control table uniquely corresponds to a distributed transaction and includes the distributed transaction's identification information and its current processing status. Based on the processing status and the distributed transaction's preset processing flow, the distributed transaction is processed. The processing flow includes the next processing operation corresponding to the processing status. By using identification information and establishing a transaction control table, distributed transactions are processed efficiently and orderly, solving the problems of poor consistency and error susceptibility in the processing of distributed transactions in related technologies. This improves both transaction processing efficiency and accuracy.

[0036] The aforementioned distributed transaction can be a single transaction, such as account A transferring 100 units of funds to account B. It can also be a sub-transaction of this single transaction, including a positive sub-transaction retrieving 100 units of funds from account A, a confirmation sub-transaction sending the retrieved 100 units of funds to account B, and a compensation sub-transaction returning the retrieved 100 units of funds to account A after the single transaction is interrupted. All of these transactions and sub-transactions can be considered distributed transactions. The aforementioned identification information can be a unique encoding identifier for the distributed transaction. It can identify a single transaction or any sub-transaction within a transaction. By obtaining the identification information of the distributed transaction, it is possible to quickly find and confirm the distributed transaction.

[0037] The aforementioned control table uniquely corresponds to each distributed transaction. This control table can include the aforementioned identification information, allowing for the lookup and identification of transactions or sub-transactions. The control table can also record the transaction processing status of any transaction within the distributed transaction. The processing status can be: transaction in progress, transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, or record not found. By using the identification information and processing status information in the control table, the next step in the specific distributed transaction processing flow can be determined, improving the overall distributed transaction processing flow and solving the problems of opaque transaction processing flows and the potential for out-of-order transaction execution in existing technologies.

[0038] Based on the aforementioned distributed transaction, which can be categorized into positive transaction sub-transactions, confirmation transaction sub-transactions, and compensation transaction sub-transactions, the processing flow of a distributed transaction can be divided into positive transaction sub-transaction flow, confirmation transaction sub-transaction flow, and compensation transaction sub-transaction flow. To ensure the orderly and efficient processing of distributed transactions, the current processing status and the next processing operation can be determined based on the processing status in the control table and the preset processing flow of the distributed transaction. When the processing result is that the distributed transaction is successfully processed, the processing status in the control table can be updated; when the processing result is that the distributed transaction fails, a rollback operation can be performed on the distributed transaction, thereby realizing the processing flow of the distributed transaction.

[0039] By using identification information and establishing empty transaction tables, distributed transactions are processed efficiently and orderly, solving the problems of poor consistency and susceptibility to errors in related technologies. This ultimately improves both transaction processing efficiency and accuracy.

[0040] Optionally, after processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, the method further includes: determining the processing result of the distributed transaction after the distributed transaction is completed; updating the processing status in the control table if the processing result is that the distributed transaction is successful; and rolling back the distributed transaction if the processing result is that the distributed transaction fails.

[0041] The control table mentioned above can be used to record the basic transaction information of any sub-transaction of a distributed transaction. To facilitate the search of transaction records, the transaction number can also be recorded as the global transaction number address information of the transaction transaction in the distributed transaction, as well as the number address information of the sub-transactions under the global transaction. In addition, to facilitate the monitoring of the processing status of sub-transactions, the processing status of transactions can also be recorded.

[0042] After a distributed transaction is completed, such as after the execution of a positive transaction sub-transaction, a confirmation transaction sub-transaction, or a compensation transaction sub-transaction, the processing status can be queried to determine the result of the distributed transaction. If the result is a successful distributed transaction, the processing status in the control table can be updated: if the transaction is a positive transaction sub-transaction, the status can be updated to "Transaction executed successfully"; if the transaction is a compensation transaction, the status can be updated to "Transaction compensation successful"; if the transaction is a confirmation transaction, the status can be updated to "Transaction confirmation successful". If the result is a failed distributed transaction, to prevent the data generated by the failed transaction from affecting the correctness of the distributed transaction, the distributed transaction can be rolled back, returning the execution process to the initial state of the transaction.

[0043] Based on the processing status in the control table and the pre-set processing flow of distributed transactions, the problem of easily disordered processing order in distributed transactions in existing technologies is solved, and the technical effect of ensuring efficient and orderly processing of distributed transactions is achieved.

[0044] Optionally, the distributed transaction includes: a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; wherein, the positive transaction sub-transaction and the confirmation transaction sub-transaction are executed sequentially according to the processing logic. The positive transaction sub-transaction is used to extract transaction funds data from the transaction funder's account, the confirmation transaction sub-transaction is used to send the transaction funds data extracted by the positive transaction sub-transaction to the transaction recipient's account, and the compensation transaction sub-transaction is used to return the extracted transaction funds data to the transaction funder's account if the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

[0045] Distributed transactions can include: positive transaction sub-transactions, confirmation transaction sub-transactions, and compensation transaction sub-transactions. The positive transaction sub-transaction can be used to extract transaction funds data from the transaction funder's account. The confirmation transaction sub-transaction is used to send the transaction funds data extracted by the positive transaction sub-transaction to the transaction recipient's account. The compensation transaction sub-transaction can be used to return the extracted transaction funds data to the transaction funder's account when the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

[0046] By implementing positive transaction sub-transactions, confirming transaction sub-transactions, and compensating transaction sub-transactions, the problem of transaction funds being easy to recover but difficult to recover when a transaction fails in the existing technology is solved, thus achieving the technical effect of ensuring the security of transaction funds.

[0047] Optionally, the processing status includes: transaction in progress, transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, and record does not exist.

[0048] To facilitate monitoring of the processing status of sub-transactions, these statuses can be stored in a control table. The processing status of a positive transaction sub-transaction can be: transaction in progress, transaction successful, or transaction failed. The processing status of a compensation transaction sub-transaction can be: transaction compensation in progress, transaction compensation failed, or empty rollback. The processing status of a confirmation transaction sub-transaction can be: transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, or record not found. If any of these records do not exist, it means that the corresponding processing status for this distributed transaction does not exist in the control table, indicating that the distributed transaction has just been created and has not yet entered the processing flow.

[0049] By adding the aforementioned transaction processing status, the problem of opaque transaction processing in existing technologies is solved, and the technical effect of improving the transparency of transaction process processing is achieved.

[0050] Optionally, when the distributed transaction is a positive transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: when the processing status is that the record does not exist or the transaction is being executed, inserting a record with the processing status of being executed and entering the first processing flow of the positive transaction sub-transaction; when the processing status is other, rejecting the processing of the positive transaction sub-transaction, returning an error, and triggering a compensation transaction sub-transaction.

[0051] In the case of a positive transaction sub-transaction within a distributed transaction, the processing status can be: transaction in progress, transaction successful, or transaction failed. If the positive transaction sub-transaction is in progress and the processing status record for the positive transaction sub-transaction does not exist in the control table, a record with the processing status of "transaction in progress" can be inserted into the control table, and the first processing flow of the positive transaction sub-transaction can be initiated. If the processing status of the transaction in the control table is in other states, such as: transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, or transaction confirmation failed, the processing of the positive transaction sub-transaction can be rejected, and the error information of the positive transaction sub-transaction can be returned, triggering the compensation transaction sub-transaction to return the extracted transaction funds data to the transaction fund provider's account.

[0052] For example, after the caller initiates a call, it enters the service aspect, where deduplication is performed on the unique transaction code. If successful, it enters the distributed transaction aspect, where a pre-enhancement module for distributed transactions is added. This module obtains the transaction ID and sub-transaction ID of the distributed transaction, queries the control table, and retrieves control information. When the transaction control status is: transaction successful, transaction failed, transaction in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, or transaction confirmation failed, the execution of the current transaction business process is rejected, the transaction returns an error, and the compensation transaction for the distributed transaction is initiated. If the transaction control record does not exist, or the transaction control status is "in progress," a "transaction in progress" transaction control record is inserted. After successful insertion, the business process begins processing. After the business process is processed, the post-enhancement module is executed. If the transaction ends normally, the transaction control status is updated to "transaction successful"; otherwise, an exception is thrown, triggering a local transaction rollback, rolling back the business logic processing and transaction control information.

[0053] By querying the transaction processing status records in the control table in a timely manner, the next processing step can be determined, thus ensuring the efficient and orderly execution of positive transactions and achieving the technical effect of improving the transparency and efficiency of positive transactions.

[0054] Optionally, when the distributed transaction is a confirmation transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: if the processing status is "transaction confirmation successful", directly return "processing success of confirmation transaction sub-transaction"; if the processing status is "transaction execution successful", update the processing status to "transaction confirmation in progress" and enter the second processing flow of confirmation transaction sub-transaction; if the processing status is other, refuse to process confirmation transaction sub-transaction, return an error, and trigger compensation transaction sub-transaction.

[0055] In the case of a distributed transaction confirming a sub-transaction, its processing status can be: transaction confirming, transaction confirming successfully, or transaction confirming failed. Based on the above processing status and the pre-defined processing flow of the distributed transaction, when the processing status is "transaction confirming successfully," the transaction confirming sub-transaction can be returned directly as successful, and the processing status of the transaction confirming sub-transaction in the control table can be updated to "transaction confirming successfully." When the processing status in the control table is "transaction confirming successfully executed," the second processing flow of the transaction confirming sub-transaction is entered, and the processing status can be "transaction confirming," with "transaction confirming in progress" inserted into the control table. When the processing status is in other states, such as: transaction executing, transaction failing, transaction compensating, transaction compensating successfully, transaction compensating failed, empty rollback, transaction confirming, or transaction confirming failed, the processing of the transaction confirming sub-transaction can be rejected, and an error message for the transaction confirming sub-transaction can be returned, triggering a compensation transaction sub-transaction to return the extracted transaction funds to the transaction fund provider's account.

[0056] For example, after initiating a call, the distributed transaction aspect is entered, where a pre-enhancement module for distributed transactions is added. This module obtains the transaction ID and sub-transaction ID of the distributed transaction, queries the control table, and retrieves control information. If the transaction control record does not exist, or the transaction control status is: transaction in progress, transaction execution failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, or transaction confirmation failed, the execution of the transaction business process is rejected, an error is returned, and the compensation transaction of the distributed transaction is triggered. If the transaction control status is "transaction confirmation successful," success is returned directly without initiating confirmation business process processing again. If the transaction control status is "transaction execution successful," the control record status is updated to "transaction confirmation in progress." After successful update, business process processing begins. After business process processing, the post-enhancement module is executed. If the transaction ends normally, the transaction control status is updated to "transaction confirmation successful"; otherwise, an exception is thrown, triggering the rollback of the local transaction, rolling back the business logic processing and transaction control information.

[0057] By querying the transaction processing status records in the control table in a timely manner, the next processing step can be determined, thus ensuring the efficient and orderly execution of confirmation transactions and achieving the technical effect of improving the transparency and efficiency of confirmation transactions.

[0058] Optionally, when the distributed transaction is a compensation transaction sub-transaction, the distributed transaction is processed according to its processing status and the preset processing flow of the distributed transaction, including: if the processing status is "record does not exist" or "transaction is in progress", the processing status is updated to "empty rollback" and a success message is returned for the compensation transaction sub-transaction; if the processing status is "empty rollback" or "transaction compensation is successful", a success message is returned for the confirmation transaction sub-transaction; if the processing status is "transaction execution is successful", the processing status is updated to "transaction compensation is in progress" and the third processing flow of the compensation transaction sub-transaction is entered; if the processing status is any other, the processing of the compensation transaction sub-transaction is rejected and an error is returned.

[0059] In the case of a compensation transaction sub-transaction within a distributed transaction, based on the processing status and the pre-defined processing flow of the distributed transaction, if the processing status is "record does not exist" or "compensation transaction is in progress," the processing status of the control table can be updated to "empty rollback," and a success message for the compensation transaction sub-transaction can be returned. If the processing status is "empty rollback" or "transaction compensation successful," a success message for the confirmation transaction sub-transaction can be returned directly. If the processing status is "transaction execution successful," the processing status of the control table can be updated to "transaction compensation in progress," and the third processing flow of the compensation transaction sub-transaction can be entered. If the processing status is in other states, such as "compensation transaction execution failed," "transaction compensation in progress," "transaction compensation failed," "transaction confirmation in progress," "transaction confirmation successful," or "transaction confirmation failed," the processing of the compensation transaction sub-transaction is rejected, an error is returned, and a transaction rollback is triggered, returning the transaction to its initial state.

[0060] For example, after initiating a call, the distributed transaction aspect is entered, where a pre-enhancement module for distributed transactions is added. This module obtains the transaction ID and sub-transaction ID of the distributed transaction, queries the control table, and retrieves control information. When the transaction control status is: transaction execution failed, transaction compensation in progress, transaction compensation failed, transaction confirmation in progress, transaction confirmation successful, or transaction confirmation failed, the execution of the compensation transaction business process is rejected, and an error is returned. When the transaction control record does not exist or the control status is "transaction in progress," a control record with a status of "empty rollback" is inserted, and success is returned; no compensation business process is initiated. When the transaction control status is "empty rollback" and transaction compensation is successful, success is returned directly, and no compensation business process is initiated. When the transaction control status is "transaction execution successful," the control record status is updated to "transaction compensation in progress." After a successful update, business process processing begins. After business process processing, the post-enhancement module is executed. Upon normal completion, the transaction control status is updated to "transaction compensation successful"; otherwise, an exception is thrown, triggering a local transaction rollback, rolling back the business logic processing and transaction control information.

[0061] By querying the transaction processing status records in the control table in a timely manner, the next processing step can be determined, thus ensuring the efficient and orderly execution of compensation transactions and achieving the technical effect of improving the transparency and efficiency of compensation transactions.

[0062] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0063] This embodiment also provides an optional implementation method, which will be described in detail below.

[0064] This implementation addresses the need for distributed transactions to support idempotency, null rollback, and anti-hanging mechanisms. It ensures transaction consistency even in abnormal scenarios where the transaction processing order is disrupted, providing a zero-intrusion solution for business processes. This transaction mechanism is transparent to business function processes, allowing developers to focus more on business process development. The main idea of ​​this implementation is to implement aspect-oriented programming before and after the start and end of distributed transactions, adding pre-enhancement and post-enhancement modules. These modules maintain the application's local transaction control table, and by checking the status of the control table, transaction management is achieved.

[0065] Figure 2 This is a schematic diagram of the system structure provided according to the embodiments of this application. The overall system structure is as follows: Figure 2 As shown.

[0066] Table 1 is the local transaction control table. The main fields of the local transaction control table are shown in Table 1. In order to avoid the control table having a suspicious state and introducing the complexity of transaction problem investigation, the control table must be in the same local transaction as the transaction and committed together with the local transaction. In each business database that needs to use distributed transactions, a local transaction control table as shown in Table 1 must be established.

[0067] Table 1 Local Transaction Control Table

[0068]

[0069]

[0070] The global transaction ID (encoding) + sub-transaction ID (encoding) form a unique index. In distributed transactions, for the three transaction types—positive transaction, confirmation transaction, and compensation transaction—the respective transaction control is as follows:

[0071] 1. Positive transaction:

[0072] Figure 3 This is a control flow chart of a positive transaction provided according to the embodiments of this application. A positive transaction is as follows: Figure 3 As shown, after the caller initiates the call, it enters the service aspect. In the aspect, deduplication is performed on the unique code of the transaction. If successful, it enters the distributed transaction aspect, where a pre-enhancement module for distributed transactions is added. This module obtains the transaction ID and sub-transaction ID of the distributed transaction, queries the control table, and retrieves the control information.

[0073] When the transaction control status is as follows: transaction execution successful, transaction execution failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, or transaction confirmation failed, the execution of the current transaction business process is rejected, the transaction returns an error, and the compensation transaction of the distributed transaction is triggered.

[0074] If a transaction control record does not exist, or if the transaction control status is "in execution", then insert a transaction control record that is "in execution". After successful insertion, proceed with the business process.

[0075] After the business process is completed, the post-enhancement module is executed. If it ends normally, the transaction control status is updated to "transaction executed successfully"; otherwise, an exception is thrown, triggering the rollback of the local transaction, which rolls back the business logic processing and transaction control information.

[0076] 2. Confirm Transaction:

[0077] Figure 4 The control flowchart for confirming transaction transactions provided in the embodiments of this application confirms the transaction as follows: Figure 4As shown, after the call is initiated, the distributed transaction aspect will be entered, where a distributed transaction pre-enhancement module will be added. The module will obtain the transaction ID and sub-transaction ID of the distributed transaction, query the control table, and obtain control information.

[0078] If the transaction control record does not exist, or if the transaction control status is: transaction in progress, transaction execution failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, or transaction confirmation failed, then the execution of the transaction business process will be rejected, the transaction will return an error, and the compensation transaction of the distributed transaction will be initiated.

[0079] When the transaction control status is "transaction confirmed successfully", it will directly return success and will not initiate the business process processing for confirmation again.

[0080] When the transaction control status is "transaction executed successfully", the control record status is updated to "transaction confirmed". After the update is successful, the business process begins.

[0081] After the business process is completed, the post-enhancement module is executed. If it ends normally, the transaction control status is updated to "transaction confirmed successfully"; otherwise, an exception is thrown, triggering the rollback of the local transaction, which rolls back the business logic processing and transaction control information.

[0082] 3. Compensation Transaction:

[0083] Figure 5 This is a control flowchart of a compensation transaction provided according to an embodiment of this application. The compensation transaction is as follows: Figure 5 As shown, after the call is initiated, the distributed transaction aspect will be entered, where a distributed transaction pre-enhancement module will be added. The module will obtain the transaction ID and sub-transaction ID of the distributed transaction, query the control table, and obtain control information.

[0084] When the transaction control status is: transaction execution failed, transaction compensation in progress, transaction compensation failed, transaction confirmation in progress, transaction confirmation successful, or transaction confirmation failed, the execution of the compensation transaction business process is rejected, and the transaction returns an error.

[0085] If the transaction control record does not exist or the control status is "transaction in progress", then insert a control record with the status "empty rollback" and return success, without initiating compensation business process processing.

[0086] When the transaction control status is empty and rollback is successful, or when transaction compensation is successful, a success message is returned directly without initiating any compensation-related business process.

[0087] When the transaction control status is "transaction executed successfully", the control record status is updated to "transaction compensation in progress". After the update is successful, the business process is initiated.

[0088] After the business process is completed, the post-enhancement module is executed. If the process ends normally, the transaction control status is updated to "transaction compensation successful"; otherwise, an exception is thrown, triggering the rollback of the local transaction, which rolls back the business logic processing and transaction control information.

[0089] This implementation achieves the following effects by adding pre-enhancement and post-enhancement modules for processing and control before and after distributed transactions: First, it ensures compatibility in abnormal scenarios such as network latency by maintaining the execution order of the positive transaction, confirmation transaction, and compensation transaction within the distributed transaction process, thus guaranteeing the consistency of the distributed transaction. Second, this invention reduces the need for compatibility considerations for abnormal scenarios in distributed transactions within the business process. Furthermore, because transaction control is based on aspects, it is transparent to the business process, achieving zero intrusion into the business process.

[0090] This application also provides a distributed transaction processing apparatus. It should be noted that the distributed transaction processing apparatus of this application can be used to execute the distributed transaction processing method provided in this application. The distributed transaction processing apparatus provided in this application will be described below.

[0091] Figure 6 This is a schematic diagram of a distributed transaction processing apparatus according to an embodiment of this application. Figure 6 As shown, the device includes: an acquisition module 62, a query and determination module 64, and a processing module 66. The device will be described in detail below.

[0092] The acquisition module 62 acquires the identification information of the distributed transaction; the query and determination module 64, connected to the acquisition module 62, queries the corresponding control table of the distributed transaction from multiple local control tables based on the identification information, and determines the processing status of the distributed transaction recorded in the control table. Each control table uniquely corresponds to a distributed transaction and includes the identification information of the distributed transaction and the recorded current processing status; the processing module 66, connected to the query and determination module 64, processes the distributed transaction according to the processing status and the preset processing flow of the distributed transaction. The processing flow includes the next processing operation corresponding to the processing status.

[0093] Through the aforementioned apparatus, the acquisition module 62 acquires the identification information of the distributed transaction; the query and determination module 64 queries the corresponding distributed transaction control table from multiple local control tables based on the identification information, and determines the processing status of the distributed transaction recorded in the control table. The control table uniquely corresponds to each distributed transaction and includes the identification information of the distributed transaction and the recorded current processing status; the processing module 66 processes the distributed transaction according to the processing status and the preset processing flow, where the processing flow includes the next processing operation corresponding to the processing status. By using the identification information and establishing a transaction control table, the distributed transaction is processed efficiently and orderly, solving the problems of poor consistency and error susceptibility during the processing of distributed transactions in related technologies. This achieves the effect of improving transaction processing efficiency and accuracy.

[0094] The distributed transaction processing device includes a processor and a memory. The aforementioned acquisition module 62, query determination module 64, and processing module 66 are all stored in the memory as program units. The processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0095] The processor contains a kernel, which retrieves the corresponding program units from memory. One or more kernels can be configured. By adjusting kernel parameters, the target object detection model can be used to detect whether a target object exists in the image. If a target object is present, the model can identify whether the target object's pose is abnormal.

[0096] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0097] This invention provides a computer-readable storage medium storing a program that, when executed by a processor, implements the distributed transaction processing method.

[0098] This invention provides a processor for running a program, wherein the program executes the distributed transaction processing method during runtime.

[0099] like Figure 7 As shown, an embodiment of the present invention provides an electronic device 70, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps:

[0100] Obtain the identification information of the distributed transaction; query the corresponding distributed transaction control table from multiple local control tables based on the identification information, and determine the processing status of the distributed transaction recorded in the control table. The control table uniquely corresponds to the distributed transaction and includes the identification information of the distributed transaction and the current processing status of the distributed transaction. Process the distributed transaction according to the processing status and the preset processing flow of the distributed transaction. The processing flow includes the next processing operation corresponding to the processing status.

[0101] Optionally, after processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, the method further includes: determining the processing result of the distributed transaction after the distributed transaction is completed; updating the processing status in the control table if the processing result is that the distributed transaction is successful; and rolling back the distributed transaction if the processing result is that the distributed transaction fails.

[0102] Optionally, the distributed transaction includes: a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; wherein, the positive transaction sub-transaction and the confirmation transaction sub-transaction are executed sequentially according to the processing logic. The positive transaction sub-transaction is used to extract transaction funds data from the transaction funder's account, the confirmation transaction sub-transaction is used to send the transaction funds data extracted by the positive transaction sub-transaction to the transaction recipient's account, and the compensation transaction sub-transaction is used to return the extracted transaction funds data to the transaction funder's account if the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

[0103] Optionally, the processing status includes: transaction in progress, transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, and record does not exist.

[0104] Optionally, when the distributed transaction is a positive transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: when the processing status is that the record does not exist or the transaction is being executed, inserting a record with the processing status of being executed and entering the first processing flow of the positive transaction sub-transaction; when the processing status is other, rejecting the processing of the positive transaction sub-transaction, returning an error, and triggering a compensation transaction sub-transaction.

[0105] Optionally, when the distributed transaction is a confirmation transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: if the processing status is "transaction confirmation successful", directly return "processing success of confirmation transaction sub-transaction"; if the processing status is "transaction execution successful", update the processing status to "transaction confirmation in progress" and enter the second processing flow of confirmation transaction sub-transaction; if the processing status is other, refuse to process confirmation transaction sub-transaction, return an error, and trigger compensation transaction sub-transaction.

[0106] Optionally, when the distributed transaction is a compensation transaction sub-transaction, the distributed transaction is processed according to its processing status and the preset processing flow of the distributed transaction, including: if the processing status is "record does not exist" or "transaction is in progress", the processing status is updated to "empty rollback" and a success message is returned for the compensation transaction sub-transaction; if the processing status is "empty rollback" or "transaction compensation is successful", a success message is returned for the confirmation transaction sub-transaction; if the processing status is "transaction execution is successful", the processing status is updated to "transaction compensation is in progress" and the third processing flow of the compensation transaction sub-transaction is entered; if the processing status is any other, the processing of the compensation transaction sub-transaction is rejected and an error is returned.

[0107] The devices mentioned in this article can be servers, PCs, tablets, mobile phones, etc.

[0108] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: obtaining the identification information of a distributed transaction; querying the corresponding control table of the distributed transaction from multiple local control tables based on the identification information, and determining the processing status of the distributed transaction recorded in the control table, wherein the control table uniquely corresponds to the distributed transaction, and the control table includes the identification information of the distributed transaction and the recorded current processing status of the distributed transaction; processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, wherein the processing flow includes the next processing operation corresponding to the processing status.

[0109] Optionally, after processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, the method further includes: determining the processing result of the distributed transaction after the distributed transaction is completed; updating the processing status in the control table if the processing result is that the distributed transaction is successful; and rolling back the distributed transaction if the processing result is that the distributed transaction fails.

[0110] Optionally, the distributed transaction includes: a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; wherein, the positive transaction sub-transaction and the confirmation transaction sub-transaction are executed sequentially according to the processing logic. The positive transaction sub-transaction is used to extract transaction funds data from the transaction funder's account, the confirmation transaction sub-transaction is used to send the transaction funds data extracted by the positive transaction sub-transaction to the transaction recipient's account, and the compensation transaction sub-transaction is used to return the extracted transaction funds data to the transaction funder's account if the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

[0111] Optionally, the processing status includes: transaction in progress, transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, and record does not exist.

[0112] Optionally, when the distributed transaction is a positive transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: when the processing status is that the record does not exist or the transaction is being executed, inserting a record with the processing status of being executed and entering the first processing flow of the positive transaction sub-transaction; when the processing status is other, rejecting the processing of the positive transaction sub-transaction, returning an error, and triggering a compensation transaction sub-transaction.

[0113] Optionally, when the distributed transaction is a confirmation transaction sub-transaction, the distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, including: if the processing status is "transaction confirmation successful", directly return "processing success of confirmation transaction sub-transaction"; if the processing status is "transaction execution successful", update the processing status to "transaction confirmation in progress" and enter the second processing flow of confirmation transaction sub-transaction; if the processing status is other, refuse to process confirmation transaction sub-transaction, return an error, and trigger compensation transaction sub-transaction.

[0114] Optionally, when the distributed transaction is a compensation transaction sub-transaction, the distributed transaction is processed according to its processing status and the preset processing flow of the distributed transaction, including: if the processing status is "record does not exist" or "transaction is in progress", the processing status is updated to "empty rollback" and a success message is returned for the compensation transaction sub-transaction; if the processing status is "empty rollback" or "transaction compensation is successful", a success message is returned for the confirmation transaction sub-transaction; if the processing status is "transaction execution is successful", the processing status is updated to "transaction compensation is in progress" and the third processing flow of the compensation transaction sub-transaction is entered; if the processing status is any other, the processing of the compensation transaction sub-transaction is rejected and an error is returned.

[0115] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0116] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0117] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0118] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0119] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0120] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0121] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0122] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0123] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for processing distributed transactions, characterized in that, include: Obtain the identification information of the distributed transaction, wherein the distributed transaction includes: a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; Based on the identification information, the corresponding control table of the distributed transaction is queried from multiple control tables locally, and the processing status of the distributed transaction recorded in the control table of the distributed transaction is determined. The control table is uniquely associated with the distributed transaction, and the control table includes the identification information of the distributed transaction and the current processing status of the distributed transaction. The distributed transaction is processed according to the processing status and the preset processing flow of the distributed transaction, wherein the processing flow includes the next processing operation corresponding to the processing status. When the distributed transaction is a compensation transaction sub-transaction, the processing of the distributed transaction according to the processing status and the preset processing flow of the distributed transaction includes: when the processing status is "record does not exist" or "transaction is in progress", updating the processing status to "empty rollback" and returning "processing success of the compensation transaction sub-transaction"; when the processing status is "empty rollback" or "transaction compensation successful", directly returning "processing success of the confirmation transaction sub-transaction"; when the processing status is "transaction execution successful", updating the processing status to "transaction compensation in progress" and entering the third processing flow of the compensation transaction sub-transaction; when the processing status is other statuses, rejecting the processing of the compensation transaction sub-transaction and returning an error.

2. The method according to claim 1, characterized in that, After processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, the method further includes: After the distributed transaction processing is completed, the processing result of the distributed transaction is determined; If the processing result indicates that the distributed transaction processing is successful, the processing status in the control table is updated. If the processing result indicates that the distributed transaction processing has failed, the distributed transaction shall be rolled back.

3. The method according to claim 2, characterized in that, The positive transaction sub-transaction and the confirmation transaction sub-transaction are executed sequentially according to the processing logic. The positive transaction sub-transaction is used to extract transaction funds data from the transaction fund provider's account. The confirmation transaction sub-transaction is used to send the transaction funds data extracted by the positive transaction sub-transaction to the transaction recipient's account. The compensation transaction sub-transaction is used to return the extracted transaction funds data to the transaction fund provider's account if the positive transaction sub-transaction or the confirmation transaction sub-transaction fails.

4. The method according to claim 3, characterized in that, The processing status includes: transaction in progress, transaction successful, transaction failed, transaction compensation in progress, transaction compensation successful, transaction compensation failed, empty rollback, transaction confirmation in progress, transaction confirmation successful, transaction confirmation failed, and record does not exist.

5. The method according to claim 4, characterized in that, When the distributed transaction is the positive sub-transaction, processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction includes: If the processing status is either "record does not exist" or "transaction is in progress", insert a record with a processing status of "transaction is in progress" and proceed to the first processing flow of the positive transaction sub-transaction. If the processing status is other than the specified status, the processing of the positive transaction sub-transaction is rejected, an error is returned, and a compensation transaction sub-transaction is triggered.

6. The method according to claim 4, characterized in that, When the distributed transaction is the confirmed transaction sub-transaction, processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction includes: If the processing status is "transaction confirmed successfully", the processing success of the confirmed transaction sub-transaction is returned directly. If the processing status is "transaction executed successfully", update the processing status to "transaction confirmation in progress" and enter the second processing flow of the confirmation transaction sub-transaction; If the processing status is other than the specified status, the processing of the confirmation transaction sub-transaction is rejected, an error is returned, and a compensation transaction sub-transaction is triggered.

7. A distributed transaction processing apparatus, characterized in that, include: The acquisition module acquires the identification information of the distributed transaction, wherein the distributed transaction includes: a positive transaction sub-transaction, a confirmation transaction sub-transaction, and a compensation transaction sub-transaction; The query determination module queries the corresponding distributed transaction control table from multiple local control tables based on the identification information, and determines the processing status of the distributed transaction recorded in the control table of the distributed transaction. The control table is uniquely associated with the distributed transaction, and the control table includes the identification information of the distributed transaction and the current processing status of the distributed transaction. The processing module processes the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, wherein the processing flow includes the next processing operation corresponding to the processing status. The processing device further includes: when the distributed transaction is a compensation transaction sub-transaction, processing the distributed transaction according to the processing status and the preset processing flow of the distributed transaction, including: when the processing status is that the record does not exist or the transaction is executing, updating the processing status to empty rollback and returning the processing success of the compensation transaction sub-transaction; when the processing status is empty rollback or transaction compensation is successful, directly returning the processing success of the confirmation transaction sub-transaction; when the processing status is that the transaction is successfully executed, updating the processing status to transaction compensation in progress and entering the third processing flow of the compensation transaction sub-transaction; when the processing status is other statuses, rejecting the processing of the compensation transaction sub-transaction and returning an error.

8. A computer-readable storage medium, characterized in that, The storage medium is used to store a program, wherein the program executes the distributed transaction processing method according to any one of claims 1 to 6 when it runs.

9. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the distributed transaction processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Distributed transaction processing method and system

    CN106775959A