Distributed accounting consistency method and device based on global link tracking number

By designing the accounting consistency control layer in a distributed system and using global link tracing numbers to achieve accounting consistency, the problem of accounting consistency processing in a distributed system is solved, and efficient and accurate accounting consistency control and compensation are achieved.

CN119579173APending Publication Date: 2025-03-07CCB FINTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411737097.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-07

AI Technical Summary

Technical Problem

In distributed systems, it is difficult for the prior art to achieve efficient and accurate accounting consistency processing, especially in complex network environments, how to ensure fund security is an important issue.

Method used

By abstractly refining and designing the account consistency control layer on the original linear account call process, the global link tracing number is used to achieve distributed account consistency. The method includes generating a correction request, recording the location and status of the account-related transaction, and performing synchronous or asynchronous compensation according to the consistency strategy to achieve final consistency of the transaction.

Benefits of technology

Account consistency control and accounting compensation are realized, avoiding interspersed with exception handling codes in normal business transaction lines, reducing code coupling, and improving system stability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119579173A_ABST
    Figure CN119579173A_ABST
Patent Text Reader

Abstract

The invention discloses a distributed accounting consistency method and device based on a global link tracking number, and relates to the technical field of big data. The method comprises the following steps: taking a business subsystem of a business transaction line as a business logic layer, generating a reversal request in the business logic layer, and pushing the reversal request to an accounting consistency control layer; the accounting consistency control layer is decoupled based on a software hierarchical design and the business logic layer, and is configured to receive a reversal request including a global link tracking number, record the position and the transaction state of an accounting transaction of the reversal request in a transaction line, and perform synchronous or asynchronous compensation according to a consistency strategy to realize final consistency of the transaction. And pushing a transaction result to the business logic layer as a response to the reversal request. According to the embodiment provided by the invention, the code coupling degree of the exception handling code and the original business transaction line is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and specifically to a distributed account consistency method based on a global link tracking number, a distributed account consistency device based on a global link tracking number, a computer-readable storage medium, and a computer program product. Background Art

[0002] In the distributed field, there are usually transaction scenarios where accounting is done across different components. In order to ensure the security of funds in a complex network environment, it is necessary to process all online transactions consistently. How to achieve accounting consistency processing efficiently and accurately is an important topic in the distributed field.

[0003] In distributed systems, there are three main solutions for implementing data consistency: 1. Eventual consistency based on message engines; 2. Strong consistency based on database XA transactions; 3. Eventual consistency based on reverse reversal transactions. However, each of these solutions has its own drawbacks. Summary of the invention

[0004] The purpose of the implementation mode of this application is to provide a distributed account consistency method and device based on a global link tracking number, abstract and refine the original linear account calling process, and design an account consistency control layer, and realize the consistency of distributed accounts based on the newly added account consistency control layer, so as to at least solve some technical problems in the background technology.

[0005] In order to achieve the above-mentioned purpose, the first aspect of the present application provides a distributed account consistency method based on a global link tracking number, the method comprising: using the business subsystem of the business transaction line as the business logic layer, and generating a reversal request in the business logic layer and pushing it to the account consistency control layer; the account consistency control layer is decoupled from the business logic layer based on software layered design, and is configured to: receive a reversal request including a global link tracking number, record the position and transaction status of the account transaction involved in the reversal request in the transaction line, perform synchronous or asynchronous compensation according to the consistency strategy, achieve the final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

[0006] Optionally, the consistency strategy is used for compensatory processing of account-related transactions, including: a maximum delivery strategy for retrying configured non-business type errors; and a consistency reversal strategy for returning transaction failure in real time when an error occurs in an accounting transaction, and asynchronously and concurrently compensating for other accounting transactions on the transaction line.

[0007] Optionally, recording the position and transaction status of the account-related transaction in the reversal request in the transaction line includes: recording the position and transaction status of the account-related transaction in the reversal request in the transaction line through a platform transaction sheet and a compensation control table; the platform transaction sheet adopts an AB table mode to record the original information of all account-related transactions in the upper business function integration layer; the compensation control table is used to record the compensation strategy and disposal progress of all account-related transactions of the current global tracking number in business scenarios that may lead to consistency risks.

[0008] Optionally, the account consistency control layer is further configured to: verify the uniqueness of the global link tracking number, and associate the global link tracking number with the transaction sub-sequence number after the verification, and locate the calling relationship between different business subsystems of the same transaction through the association.

[0009] Optionally, the global link tracking number in the reversal request includes: several fields for identifying the system configuration, determining that the system configuration corresponding to the field is in the current system; several fields for timestamps, determining that the difference between the timestamp and the local time is within a preset range; several fields for serial numbers, determining that the serial numbers conform to a preset serial number format; several fields for being generated by random generation functions, determining that the values ​​of the fields are between the upper and lower limits of the random generation function.

[0010] Optionally, the accounting consistency control layer is further configured to: encode the accounting error type into recoverable errors and unrecoverable errors, execute a compensation strategy for the recoverable errors, and execute a transaction recovery strategy for the unrecoverable errors; the compensation strategy includes: resending the original transaction message for recoverable error code transactions; the transaction recovery strategy includes: performing synchronous or asynchronous compensation processing if the transaction is unsuccessful.

[0011] Optionally, the account consistency control layer is further configured to: adjust the transaction type of the original transaction message with recoverable errors, and execute the compensation strategy on the adjusted original transaction message.

[0012] Optionally, the method further comprises setting up an independent account compensation pool; the account compensation pool is configured to execute the compensation strategy or the transaction recovery strategy to compensate the account.

[0013] Optionally, the synchronous or asynchronous compensation disposal performed when the transaction is unsuccessful is executed by the account compensation pool; the synchronous or asynchronous compensation disposal includes: performing real-time compensation disposal on the transactions in the platform flow table according to the configuration rules, and writing the transactions that failed to be disposed of in real time into the asynchronous compensation disposal table; capturing pending transactions from the asynchronous compensation disposal table for asynchronous compensation, wherein the capture timing is timed capture, and the number of captured pending compensation transactions is determined according to the number of idle thread pools in the compensation thread pool, and the asynchronous compensation has idempotence.

[0014] Optionally, the account consistency control layer is further configured to: obtain the processing result of the account compensation pool, and perform confidence evaluation on the processing result.

[0015] Optionally, the accounting consistency control layer is further configured to: mark the transactions processed by the accounting consistency control layer, and the mark is used to mark that the fund transaction arrangement process should follow the accounting processing principle of debiting first and then crediting.

[0016] In a second aspect of the present application, a distributed account consistency device based on a global link tracking number is also provided, the device comprising:

[0017] A business logic layer, the business logic layer includes a business subsystem of a business transaction line; the business logic layer is also configured to generate a reversal request and push it to an account consistency control layer; an account consistency control layer decoupled from the business logic layer based on a software layered design, the account consistency control layer includes: a reversal transaction module, a transaction accounting general data module and a consistency reversal control module; the reversal transaction module is used to receive a reversal request including a global link tracking number, the transaction accounting general data module is used to record the position and transaction status of the account transaction involved in the reversal request in the transaction line, the consistency reversal control module is used to perform synchronous or asynchronous compensation according to a consistency strategy to achieve final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

[0018] In the third aspect of the present application, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the aforementioned distributed account consistency method based on a global link tracking number when executing the computer program.

[0019] In a fourth aspect of the present application, a computer-readable storage medium is also provided, wherein instructions are stored in the storage medium, and when the instructions are executed on a computer, the computer executes the steps of the aforementioned distributed account consistency method based on a global link tracking number.

[0020] In a fifth aspect of the present application, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the aforementioned distributed accounting consistency method based on a global link tracking number.

[0021] The above technical solution has at least the following beneficial effects:

[0022] Based on the original linear account calling process, that is, the business logic layer, the control layer is abstracted, refined and designed, and the account compensation pool is independent, thereby realizing account consistency control and account compensation. This implementation method uses functional layering to make account consistency control and asynchronous reversal functionally independent, thereby avoiding the drawbacks of inserting exception handling code into normal business transaction lines and high code coupling.

[0023] Other features and advantages of the embodiments of the present application will be described in detail in the subsequent detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present application, but do not constitute a limitation on the embodiments of the present application. In the accompanying drawings:

[0025] Figure 1 The following is a schematic diagram showing the steps of a distributed ledger consistency method based on a global link tracking number according to an embodiment of the present application;

[0026] Figure 2 The following is a schematic diagram showing an application environment of a distributed account consistency method based on a global link tracking number according to an embodiment of the present application;

[0027] Figure 3 The schematic diagram shows the structure of a distributed account consistency device based on a global link tracking number according to an embodiment of the present application;

[0028] Figure 4 The internal structure of a computer device according to an embodiment of the present application is schematically shown. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical solutions and advantages of the implementation methods of the present application clearer, the technical solutions in the implementation methods of the present application will be clearly and completely described below in conjunction with the drawings in the implementation methods of the present application. It should be understood that the specific implementation methods described herein are only used to illustrate and explain the implementation methods of the present application, and are not used to limit the implementation methods of the present application. Based on the implementation methods in the present application, all other implementation methods obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0030] It should be noted that if the implementation methods of the present application involve directional indications (such as up, down, left, right, front, back...), such directional indications are only used to explain the relative position relationship, movement status, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication will also change accordingly.

[0031] In addition, if there are descriptions involving "first", "second", etc. in the implementation methods of this application, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or suggesting their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various implementation methods can be combined with each other, but they must be based on the ability of ordinary technicians in the field to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0032] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0033] It should be noted that in the embodiments of the present application, certain software, components, models and other existing solutions in the industry may be mentioned, and they should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of the present application, but it does not mean that the applicant has or will necessarily use the solution.

[0034] Figure 1 The following is a schematic diagram showing the steps of a distributed account consistency method based on a global link tracking number according to an embodiment of the present application. Figure 1 As shown, a distributed ledger consistency method based on a global link tracking number, the method comprising:

[0035] S01. The business subsystem of the business transaction line is used as the business logic layer, and the reversal request generated in the business logic layer is pushed to the account consistency control layer;

[0036] S02. The account consistency control layer is decoupled from the business logic layer based on software layered design, and is configured to: receive a reversal request including a global link tracking number, record the position and transaction status of the account transaction involved in the reversal request in the transaction line, perform synchronous or asynchronous compensation according to the consistency strategy to achieve the final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

[0037] In some optional implementations, different functional modules in the account consistency control layer are used to implement the corresponding steps. For example, a reversal request including a global link tracking number is received through a reversal transaction module in the layer, the position and transaction status of the account transaction involved in the reversal request in the transaction line are recorded through a transaction accounting general data module in the layer, and a consistency reversal control module in the layer performs synchronous or asynchronous compensation according to a consistency strategy to achieve final consistency of the transaction, and pushes the transaction result to the business logic layer as a response to the reversal request.

[0038] Through the above implementation, the accounting consistency control layer is abstracted and designed on the original linear accounting call process, that is, the business logic layer, thereby realizing accounting consistency control and accounting compensation. This implementation makes accounting consistency control and asynchronous reversal functionally independent through functional layering, thereby avoiding the drawbacks of inserting exception handling code in the normal business transaction line and high code coupling.

[0039] Figure 2 The following schematically shows the application environment of the distributed account consistency method based on the global link tracking number according to the implementation mode of the present application. Figure 2 As shown, the distributed ledger consistency method based on the global link tracking number provided in this application can be applied to Figure 2 In the application environment shown. The terminal 102 communicates with the server 104 through the network. The terminal 102 is the initiator of the reversal request, such as an ATM, a counter terminal or an online banking terminal, which can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server 104 can be implemented with an independent server or a server cluster composed of multiple servers, which has the software architecture of the aforementioned business logic layer and the account consistency control layer, and implements account consistency control based on the software architecture.

[0040] In some embodiments of the present application, the consistency strategy is used for compensation processing of account-related transactions, including: a maximum delivery strategy for retrying configured non-business type errors; and a consistency reversal strategy for returning transaction failure in real time when an error occurs in an accounting transaction, and asynchronously and concurrently compensating other accounting transactions on the transaction line. In the previous embodiment, the synchronous compensation or asynchronous compensation in the accounting consistency control layer needs to follow the consistency strategy. The consistency strategy includes a maximum delivery strategy for retrying configured non-business type errors. By retrying some errors, some errors caused by accidental factors can be reduced. This strategy can ensure the maximum success rate of the transaction, but the performance loss caused by the retry may reduce the system throughput. In actual scenarios, the retry process needs to be optimized according to specific parameters. The consistency reversal strategy is used to return transaction failure in real time when an error occurs in an accounting transaction, and asynchronously and concurrently compensates other accounting transactions on the transaction line. This strategy can achieve a fast response to the transaction and has good concurrent performance. This embodiment sets a consistency strategy during synchronous or asynchronous compensation, so that the accounting consistency control layer can balance the success rate and response speed.

[0041] In some embodiments of the present application, the position and transaction status of the account-related transaction of the reversal request in the transaction line are recorded, including: recording the position and transaction status of the account-related transaction of the reversal request in the transaction line through the platform flow table and the compensation control table; the platform flow table adopts the AB table mode to record the original information of all account-related transactions in the upper business function integration layer, and the compensation control table is used to record the compensation strategy and disposal progress of all account-related transactions of the current global tracking number in the business scenario with consistency risk. In this embodiment, the platform flow table in the account consistency control layer is designed with an AB table mechanism to provide data support for abnormal reversal scenarios, ensuring that all account flow records under the account line can be found in abnormal scenarios. Data AB table switching is a database management technology, which is often used in scenarios such as seamless upgrades, data migration, and data table structure changes. Its core idea is to create two tables with the same structure, namely, table A and table B, and switch after the operation is completed to ensure the continuous availability of data, reduce downtime, and improve the high availability of the system. The main advantage of this technology is that data tables can be modified and upgraded without affecting the production environment. This process can be divided into the following steps: Create a table B with the same structure as table A in the background. Make the required changes to table B, such as adding fields, modifying field types, etc. Migrate the data in table B to table A to ensure data consistency. Switch user access from table A to table B by modifying the application configuration or database view. The compensation strategy recorded in the compensation control table can reflect the compensation route and compensation measures for all transactions involving the account, and the recorded disposal progress can reflect the disposal process, disposal time point and completion status of all transactions involving the account. Through the above settings, this implementation method can provide data support for compensation and improve the integrity and completion rate of compensation processing.

[0042] In some embodiments of the present application, the accounting consistency control layer is also configured to: verify the uniqueness of the global link tracking number, and associate the global link tracking number with the transaction sub-sequence number after the verification, and locate the call relationship between different business subsystems of the same transaction through the association. Another function of the accounting consistency control layer is to detect the uniqueness of the global tracking number of the transaction to ensure the business uniqueness of the transaction, which can be implemented by a uniqueness detection module with corresponding functions. The association methods here include but are not limited to mapping relationships, string connections, and form mappings. In this embodiment, the accounting consistency control layer uniformly handles external transactions, reducing the time users wait for processing results.

[0043] In some embodiments of the present application, the uniqueness of the global link tracking number is verified, including: decomposing the global link tracking number into multiple fields according to the generation method of the global link tracking number, and making the following judgments on each of the multiple fields: if the field is used to identify the system configuration, determine that the system configuration corresponding to the field is in the system; if the field is a timestamp, determine that the difference between the timestamp and the local time is within a preset range; if the field is a sequence number, determine that the sequence number conforms to the preset sequence number format; if the field is generated by a random generation function, determine that the value of the field is between the upper and lower limits of the random generation function. For example, the generation method of the global link tracking number is: a number with a total length of 25 bits, composed of a 6-bit system number, a 3-bit host number, a 10-bit timestamp and a 6-bit sequence. According to its generation method, it is decomposed into a 6-bit field, a 3-bit field, a 10-bit field, and a 6-bit field, and it is judged respectively whether the system configuration identified by the 6-bit field and the 3-bit field is in the system, whether the difference between the 10-bit timestamp and the local time is within the preset range to prevent replay attacks, and the 6-bit sequence conforms to the preset sequence number format, thereby verifying the standardization and uniqueness of the global link tracking number. In some optional implementations, while verifying the global link tracking number, the uniqueness of the transaction subsequence number is also verified. The transaction subsequence number refers to the number used to record the number of outbound calls to other systems in the transaction, which is composed of several digits. Each value represents the depth of the outbound call to other systems, and the value on the bit represents the number of outbound calls initiated by the system at this depth. The method for verifying the uniqueness of the transaction subsequence number includes verifying the uniqueness of its generation method and the uniqueness of the input parameters of the generation method. This implementation describes the generation rules to ensure its efficiency and uniqueness in a multi-machine large cluster environment.

[0044] In some embodiments of the present application, the accounting consistency control layer is further configured to: encode the accounting error type into recoverable errors and unrecoverable errors, execute a compensation strategy for the recoverable errors, and execute a transaction recovery strategy for the unrecoverable errors; the compensation strategy includes: retransmitting the original transaction message for recoverable error code transactions; the transaction recovery strategy includes: performing synchronous or asynchronous compensation if the transaction is unsuccessful. In this embodiment, classification processing is performed based on the accounting error type, retransmission attempts are made for recoverable errors, and compensation is performed for unrecoverable errors. This embodiment maximizes the transaction success rate and reduces the workload of compensation by setting different processing mechanisms in the accounting consistency control layer.

[0045] In some embodiments of the present application, the account consistency control layer is further configured to: adjust the transaction type of the original transaction message that can recover the error, and execute the compensation strategy on the adjusted original transaction message. In order to further increase the applicable scenarios of the compensation strategy and improve the transaction success rate, the account consistency control layer allows the solution of implementing transaction compensation call by adjusting the transaction type of the original message for account setting transactions that require the use of the consistency module.

[0046] In some embodiments of the present application, the method further includes setting up an independent account compensation pool; the account compensation pool is configured to compensate accounts based on a compensation strategy and a transaction recovery strategy; the compensation strategy includes: resending the original transaction message for recoverable error code transactions; the transaction recovery strategy includes: if the transaction is unsuccessful, the account compensation pool performs synchronous or asynchronous message compensation processing. Based on the compensation strategy, the original transaction message is allowed to be resent for recoverable error code transactions, ensuring that the account sending is as successful as possible and improving the transaction success rate.

[0047] In some embodiments of the present application, the synchronous or asynchronous compensation disposal performed when the transaction is unsuccessful is performed by the account compensation pool; the synchronous or asynchronous compensation disposal includes: performing real-time compensation disposal on the transactions in the platform flow table according to the configuration rules, and writing the transactions that are unsuccessful in real-time disposal into the asynchronous compensation disposal table; capturing pending transactions from the asynchronous compensation disposal table for asynchronous compensation, wherein the capture timing is timed capture, the number of captured transactions to be compensated is determined according to the number of idle thread pools in the compensation thread pool, and the asynchronous compensation has idempotency. Among them, the configuration rules include capture timing and capture rules, for example, the capture timing can be timed capture, the number of captured transactions is determined according to the number of idle thread pools in the account compensation pool, and the capture instance can be random capture or sequence capture, group capture, etc. The present application executes the compensation process by an independent account compensation pool, which reduces the coupling degree of the compensation execution process with other processes. Setting the asynchronous compensation to have idempotency makes the asynchronous compensation result independent of the number of executions, and can ensure that the asynchronous compensation will not produce abnormal results when it is repeatedly executed. The failed transactions to be compensated are set with an unselectable time to avoid being selected every time. For example, the unselectable time can be set to 1 minute, 2 minutes, 4 minutes, 8 minutes, and 16 minutes respectively, until the end of the trading day, at which time the pending compensation transactions that have not been compensated enter the error list. The processing mechanism in this embodiment can ensure that the pending compensation transactions can be processed while avoiding frequent calls.

[0048] In some implementations of the present application, the accounting consistency control layer is further configured to: obtain the processing results of the accounting compensation pool, and conduct a confidence evaluation on the processing results. Since the accounting consistency control layer is to control consistency, and the actual occurrence of reversal and retransmission does not occur in the accounting consistency control layer and is independent of the accounting consistency control layer, the accounting consistency control layer cannot guarantee that the response results obtained are absolutely correct, and this solution cannot completely replace the end-of-day reconciliation processing logic. This implementation introduces a confidence evaluation to evaluate the credibility of the response results when it cannot be guaranteed to be absolutely correct, so as to facilitate attention to key accounts during the end-of-day reconciliation processing.

[0049] In some embodiments of the present application, the accounting consistency control layer is further configured to: identify transactions processed by the accounting consistency control layer, and the identification is used to identify that the fund transaction arrangement process should follow the accounting processing principle of debiting first and then crediting. The accounting consistency control layer does not guarantee the final account consistency of the fund transaction. In order to fully protect the fund security of the institution, the fund transaction arrangement process should follow the accounting processing principle of debiting first and then crediting. Therefore, this embodiment identifies the transactions processed by the accounting consistency control layer so that the system adopts the above accounting processing principle for them. This embodiment can fully protect the fund security of the institution.

[0050] It can be seen from the above implementation methods that the account consistency control layer set in this application has the following advantages: (1) Exceptions are centrally processed through the newly set software function layer, reducing the complexity of the exception handling process. (2) Since the account consistency control layer can be directly accessed by each business subsystem in the business logic layer, the account consistency control layer can achieve simultaneous reception and centralized processing when the number of external transactions in abnormal scenarios under long account lines increases exponentially, reducing waiting time and improving user experience. (3) Code independence is achieved through layered design, avoiding the insertion of exception handling code in the business subsystems of the business transaction line, reducing code readability and the difficulty of transaction consistency testing, while achieving low code coupling.

[0051] Based on the same inventive concept, the present application also provides a distributed account consistency device based on a global link tracking number. Figure 3 The schematic diagram shows the structure of the distributed account consistency device based on the global link tracking number according to the embodiment of the present application. Figure 3As shown, a distributed accounting consistency device based on a global link tracking number includes: a business logic layer, the business logic layer includes a business subsystem of a business transaction line; the business logic layer is also configured to generate a reversal request and push it to an accounting consistency control layer; an accounting consistency control layer decoupled from the business logic layer based on a software layered design, the accounting consistency control layer includes: a reversal transaction module, a transaction accounting general data module and a consistency reversal control module; the reversal transaction module is used to receive a reversal request including a global link tracking number, the transaction accounting general data module is used to record the position and transaction status of the account transaction involved in the reversal request in the transaction line, and the consistency reversal control module is used to perform synchronous or asynchronous compensation according to a consistency strategy to achieve the final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

[0052] In some optional implementations of the present application, the consistency strategy is used for compensatory processing of account-related transactions, including: a maximum delivery strategy for retrying configured non-business type errors; and a consistency reversal strategy for returning transaction failure in real time when an error occurs in an accounting transaction, and asynchronously and concurrently performing compensatory processing on other accounting transactions on the transaction line.

[0053] In some optional implementations of the present application, the position and transaction status of the account-related transactions in the reversal request in the transaction line are recorded, including: recording the position and transaction status of the account-related transactions in the reversal request in the transaction line through a platform transaction sheet and a compensation control table; the platform transaction sheet adopts an AB table mode to record the original information of all account-related transactions in the upper business function integration layer, and the compensation control table is used to record the compensation strategy and disposal progress of all account-related transactions in the current global tracking number in business scenarios that may lead to consistency risks.

[0054] In some optional embodiments of the present application, the account consistency control layer also includes a uniqueness verification module, which is used to verify the uniqueness of the global link tracking number, and after the verification, the global link tracking number is associated with the transaction sub-sequence number, and the calling relationship between different business subsystems of the same transaction is located through the association.

[0055] In some optional embodiments of the present application, the global link tracking number in the reversal request includes: several fields are used to identify the system configuration, and it is determined that the system configuration corresponding to the field is in the current system; several fields are timestamps, and it is determined that the difference between the timestamp and the local time is within a preset range; several fields are serial numbers, and it is determined that the serial number conforms to a preset serial number format; several fields are generated by random generation functions, and it is determined that the values ​​of the fields are between the upper and lower limits of the random generation function.

[0056] In some optional implementations of the present application, the accounting consistency control layer is further configured to: encode the accounting error type into recoverable errors and unrecoverable errors, execute a compensation strategy for the recoverable errors, and execute a transaction recovery strategy for the unrecoverable errors; the compensation strategy includes: retransmitting the original transaction message for the recoverable error code transaction; the transaction recovery strategy includes: performing synchronous or asynchronous compensation processing if the transaction is unsuccessful.

[0057] In some optional implementations of the present application, the account consistency control layer is further configured to: adjust the transaction type of the original transaction message with recoverable errors, and execute the compensation strategy on the adjusted original transaction message.

[0058] In some optional implementations of the present application, the device further includes an independent account compensation pool; the account compensation pool is configured to execute the compensation strategy or the transaction recovery strategy to compensate the account.

[0059] In some optional implementations of the present application, the synchronous or asynchronous compensation disposal performed when the transaction is unsuccessful is executed by the account compensation pool; the synchronous or asynchronous compensation disposal includes: performing real-time compensation disposal on the transactions in the platform flow table according to the configuration rules, and writing the transactions that failed to be disposed of in real time into the asynchronous compensation disposal table; capturing the pending transactions from the asynchronous compensation disposal table for asynchronous compensation, wherein the capture timing is timed capture, and the number of captured pending compensation transactions is determined according to the number of idle thread pools in the compensation thread pool, and the asynchronous compensation has idempotence.

[0060] In some optional implementations of the present application, the account consistency control layer is further configured to: obtain the processing result of the account compensation pool, and perform a confidence evaluation on the processing result.

[0061] In some optional implementations of the present application, the accounting consistency control layer is further configured to: identify transactions processed by the accounting consistency control layer, and the identification is used to identify that the fund transaction arrangement process should follow the accounting processing principle of debiting first and then crediting.

[0062] The specific definition of each functional module in the above-mentioned distributed account consistency device based on the global link tracking number can be found in the above-mentioned definition of the distributed account consistency method based on the global link tracking number, which will not be repeated here. Each module in the above-mentioned device or system can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules. The device is used to implement the aforementioned distributed account consistency method based on the global link tracking number, and also has the advantages of reducing the complexity of the exception handling process and reducing the degree of code coupling.

[0063] An embodiment of the present application provides a storage medium on which a program is stored. When the program is executed by a processor, the above-mentioned distributed account consistency method based on the global link tracking number is implemented.

[0064] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 4 shown. Figure 4 The internal structure diagram of a computer device according to an embodiment of the present application is schematically shown. The computer device includes a processor A01, a network interface A02, a memory (not shown in the figure) and a database (not shown in the figure) connected via a system bus. Among them, the processor A01 of the computer device is used to provide computing and control capabilities. The memory of the computer device includes an internal memory A03 and a non-volatile storage medium A04. The non-volatile storage medium A04 stores an operating system B01, a computer program B02 and a database (not shown in the figure). The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 in the non-volatile storage medium A04. The network interface A02 of the computer device is used to communicate with an external terminal through a network connection. When the computer program B02 is executed by the processor A01, a distributed account consistency method based on a global link tracking number is implemented.

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

[0066] In one embodiment, the distributed account consistency device based on the global link tracking number provided in the present application can be implemented in the form of a computer program, and the computer program can be used in Figure 4The computer device is run on the computer device shown. The memory of the computer device can store various program modules constituting the distributed account consistency device based on the global link tracking number, and the computer program composed of each program module enables the processor to execute the steps of the distributed account consistency method based on the global link tracking number in each embodiment of the present application described in this specification.

[0067] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0068] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0069] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0070] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

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

[0072] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0073] Computer readable media include permanent and non-permanent, removable and non-removable media, and can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules 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 technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0074] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0075] The above is only the implementation mode of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims

1. A distributed accounting consistency method based on a global link tracking number, characterized in that: The method includes: The business subsystem of the business transaction line is used as the business logic layer, and the reversal request generated in the business logic layer is pushed to the account consistency control layer; The account consistency control layer is decoupled from the business logic layer based on a software layered design, and is configured to: receive a reversal request including a global link tracking number, record the position and transaction status of the account transaction involved in the reversal request in the transaction line, perform synchronous or asynchronous compensation according to the consistency strategy, achieve the final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

2. The method according to claim 1, characterized in that The consistency strategy is used for compensation processing of account-related transactions, including: A maximum delivery policy to retry configured non-business type errors; and The consistency reversal strategy is used to return transaction failure in real time when an error occurs in the accounting transaction, and asynchronously and concurrently compensate for other accounting transactions on the transaction line.

3. The method according to claim 1, characterized in that Record the location and transaction status of the transaction involved in the reversal request in the transaction line, including: The position and transaction status of the transaction involved in the reversal request in the transaction line are recorded through the platform flow table and compensation control table; The platform flow table adopts the AB table mode to record the original information of all account-related transactions in the upper business function integration layer. The compensation control table is used to record the compensation strategy and disposal progress of all account-related transactions of the current global tracking number in business scenarios that may cause consistency risks.

4. The method according to claim 1, characterized in that: The account consistency control layer is also configured to: verify the uniqueness of the global link tracking number, and associate the global link tracking number with the transaction sub-sequence number after the verification, and locate the calling relationship between different business subsystems of the same transaction through the association.

5. The method according to claim 4, characterized in that The global link tracking number in the reversal request includes: Several fields are used to identify system configurations, and determine that the system configurations corresponding to the fields are in the system; Several fields are timestamps, and it is determined that the difference between the timestamp and the local time is within a preset range; The plurality of fields are serial numbers, and determining that the serial numbers conform to a preset serial number format; Several fields are generated by a random generation function, and the values ​​of the fields are determined to be between upper and lower limits of the random generation function.

6. The method according to claim 1, characterized in that: The accounting consistency control layer is further configured to: encode the accounting error type into a recoverable error and an unrecoverable error, execute a compensation strategy for the recoverable error, and execute a transaction recovery strategy for the unrecoverable error; The compensation strategy includes: resending the original transaction message for recoverable error code transactions; The transaction recovery strategy includes: if the transaction is unsuccessful, performing synchronous or asynchronous compensation processing.

7. The method according to claim 6, characterized in that: The account consistency control layer is further configured to: adjust the transaction type of the original transaction message of the recoverable error, and execute the compensation strategy on the adjusted original transaction message.

8. The method according to claim 6, characterized in that The method also includes setting up an independent account compensation pool; The account compensation pool is configured to execute the compensation strategy or the transaction recovery strategy to compensate the account.

9. The method according to claim 8, characterized in that The synchronous or asynchronous compensation processing when the transaction is unsuccessful is executed by the account compensation pool; The synchronous or asynchronous compensation processing includes: Perform real-time compensation processing on the transactions in the platform flow table according to the configuration rules, and write the transactions that failed to be processed in real time into the asynchronous compensation processing table; Capture pending transactions from the asynchronous compensation processing table for asynchronous compensation, wherein the capture timing is scheduled capture, and the number of captured pending compensation transactions is determined according to the number of idle thread pools in the compensation thread pool, and the asynchronous compensation has idempotence.

10. The method according to claim 9, characterized in that: The accounting consistency control layer is further configured to: obtain the processing result of the accounting compensation pool, and perform confidence evaluation on the processing result.

11. The method according to claim 1, characterized in that: The accounting consistency control layer is further configured to: mark the transactions processed by the accounting consistency control layer, and the mark is used to mark that the fund transaction arrangement process should follow the accounting processing principle of debit first and credit later.

12. A distributed account consistency device based on a global link tracking number, characterized in that: The device includes: A business logic layer, the business logic layer includes a business subsystem of a business transaction line; the business logic layer is also configured to generate a reversal request and push it to the account consistency control layer; An accounting consistency control layer is decoupled from the business logic layer based on a software layered design, and the accounting consistency control layer includes: a transaction reversal module, a transaction accounting general data module and a consistency reversal control module; the transaction reversal module is used to receive a reversal request including a global link tracking number, the transaction accounting general data module is used to record the position and transaction status of the account transaction involved in the reversal request in the transaction line, and the consistency reversal control module is used to perform synchronous or asynchronous compensation according to the consistency strategy to achieve the final consistency of the transaction, and push the transaction result to the business logic layer as a response to the reversal request.

13. A computer-readable storage medium, wherein instructions are stored in the storage medium, which, when executed on a computer, enables the computer to execute the steps of the distributed ledger consistency method based on a global link tracking number as described in any one of claims 1 to 11.

14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the steps of the distributed ledger consistency method based on the global link tracking number as described in any one of claims 1 to 11.