Application-level incomplete transaction detection method and related device

By executing reverse cases of target transactions in a distributed architecture and updating the database, comparing database differences to determine the accuracy of application-level logic, the incomplete transaction detection problem caused by unreasonable distributed transaction design and compensation logic is solved, and the ability to accurately detect incomplete transactions is achieved.

CN119646006APending Publication Date: 2025-03-18AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411715676.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-27
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

In a distributed architecture, the distributed transaction design and compensation logic in application-level logic are unreasonable, resulting in the incomplete transaction being unable to accurately detect, especially in reverse transaction scenarios.

Method used

By executing the reverse case of the target transaction, the first database is updated based on the reverse case, and the target data performance information is obtained by comparing the differences before and after the update. Then, the target data performance information is compared with the standard data performance information, which represents the consistency of the transaction to determine the accuracy of the application-level logic.

Benefits of technology

Standard data performance information that ensures consistency in transactions is used as a standard. By comparing the data performance information obtained in reverse cases, the accuracy of application-level logic can be accurately determined, so that the distributed architecture can accurately detect incomplete transactions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119646006A_ABST
    Figure CN119646006A_ABST
Patent Text Reader

Abstract

The invention discloses an application-level incomplete transaction detection method and a related device. In the method, a reverse case of a target transaction is executed, and a first database is updated based on execution of the reverse case; the execution of the reverse case is implemented based on application level logic for detecting incomplete transactions; obtaining target data performance information based on the difference between the first database before updating and the first database after updating; and based on a comparison result of the target data performance information and the standard data performance information, determining whether the logic of the application level for detecting the incomplete transaction is accurate or not. Therefore, by taking the standard data representation information which ensures that the transactions have consistency as a standard, whether the transactions of the reverse case of the target transaction have consistency or not can be determined, and then whether the logic of the application level for detecting the incomplete transactions is accurate or not can be accurately determined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a method for detecting an application-level incomplete transaction and a related device. Background Art

[0002] At present, business data is usually stored in a database. For example, in a distributed database, business data can be stored in different databases. In the process of executing a transaction, the business data in the database can be operated, and the database provides transaction consistency guarantee to ensure that the business data in the database is transformed from one consistent state to another consistent state.

[0003] In related technologies, application-level logic can be written in advance to ensure transaction consistency. Distributed architecture can use written application-level logic to detect incomplete transactions (e.g., transactions that do not meet consistency requirements). For example, transactions that do not execute application-level logic and transactions that execute application-level logic incorrectly, and other non-query transactions with unknown transaction status, can be counted as incomplete transactions. However, for reverse transactions (i.e., transaction execution failure) scenarios, unreasonable distributed transaction design and compensation logic in application-level logic may result in the inability to accurately detect incomplete transactions. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a method and related device for detecting incomplete transactions at the application level, the purpose of which is to accurately detect whether the application-level logic is accurate, so that the distributed architecture using the application-level logic can accurately detect incomplete transactions.

[0005] In a first aspect, an embodiment of the present application provides a method for detecting an application-level incomplete transaction, the method comprising:

[0006] Executing a reverse case of the target transaction and updating the first database based on the execution of the reverse case; the execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions;

[0007] Obtaining target data performance information based on a difference between the first database before updating and the first database after updating;

[0008] Determining whether the application-level logic for detecting incomplete transactions is accurate based on a comparison result of the target data representation information and the standard data representation information;

[0009] Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

[0010] In a possible implementation, the standard data representation information is obtained by the following steps:

[0011] executing a positive case of the target transaction, and updating the second database based on the execution of the positive case;

[0012] The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update.

[0013] In a possible implementation, the determining whether the application-level logic for detecting incomplete transactions is accurate based on the comparison result between the target data representation information and the standard data representation information includes:

[0014] If the business data included in the target data representation information and the business data included in the standard data representation information are partially identical or completely identical, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

[0015] In a possible implementation, the standard data representation information is obtained by the following steps:

[0016] executing a reverse case of the target transaction, and updating the second database based on the execution of the reverse case;

[0017] The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update.

[0018] In a possible implementation, the determining whether the application-level logic for detecting incomplete transactions is accurate based on the comparison result between the target data representation information and the standard data representation information includes:

[0019] If the business data included in the target data representation information is different from the business data included in the standard data representation information, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

[0020] In a possible implementation, the first database includes a plurality of data tables; and obtaining the target data performance information based on the difference between the first database before the update and the first database after the update includes:

[0021] Based on the difference between the first database before updating and the first database after updating, obtaining identification information of the first data table and the first operation type as the target data representation information;

[0022] The first data table is a data table in which business data changes before and after the first database is updated, and the first operation type is a type of operation for updating the first data table.

[0023] In a possible implementation, the second database includes a plurality of data tables; and obtaining the standard data representation information based on a difference between the second database before the update and the second database after the update includes:

[0024] Based on the difference between the second database before the update and the second database after the update, obtaining identification information of the second data table and the second operation type as the standard data representation information;

[0025] The second data table is a data table in which business data changes before and after the second database is updated, and the second operation type is a type of operation for updating the second data table.

[0026] In a second aspect, an embodiment of the present application provides a device for detecting an application-level incomplete transaction, the device comprising:

[0027] A first execution and update module, configured to execute a reverse case of the target transaction and update the first database based on the execution of the reverse case; the execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions;

[0028] A first information acquisition module, used to obtain target data performance information based on the difference between the first database before updating and the first database after updating;

[0029] a logic determination module, configured to determine whether the application-level logic for detecting incomplete transactions is accurate based on a comparison result between the target data representation information and the standard data representation information;

[0030] Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

[0031] In a third aspect, an embodiment of the present application provides a device for detecting an application-level incomplete transaction, the device comprising a memory and a processor:

[0032] The memory is used to store a computer program and transmit the computer program to the processor;

[0033] The processor is used to execute the computer program so that the device executes the method for detecting application-level incomplete transactions described in the first aspect.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed, the device executing the computer program implements the method for detecting incomplete application-level transactions as described in the first aspect above.

[0035] Compared with the prior art, the embodiments of the present application have the following beneficial effects:

[0036] An embodiment of the present application provides a method for detecting an application-level incomplete transaction and a related device. In the method, a reverse case of a target transaction is first executed, and a first database is updated based on the execution of the reverse case, and the execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions; then, based on the difference between the first database before the update and the first database after the update, target data representation information is obtained; then, based on a comparison result between the target data representation information and the standard data representation information, it is determined whether the application-level logic for detecting incomplete transactions is accurate; wherein the standard data representation information is used to indicate that the transaction of the target transaction is consistent, and the standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction, and the first database before the update is the same as the second database before the update.

[0037] It can be seen from this that by taking the standard data representation information that ensures the consistency of transactions as the standard and comparing the target data representation information obtained by executing the reverse case of the target transaction with it, it can be determined whether the transactions of the reverse case of the target transaction are consistent, and then it can be accurately determined whether the application-level logic for detecting incomplete transactions is accurate, so as to prompt technical personnel and the like to improve the application-level logic for detecting incomplete transactions, thereby enabling the distributed architecture using the application-level logic to accurately detect incomplete transactions. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0039] Figure 1 An application scenario of a method for detecting an application-level incomplete transaction provided in an embodiment of the present application;

[0040] Figure 2 A flowchart of a method for detecting an application-level incomplete transaction provided in an embodiment of the present application;

[0041] Figure 3 A flowchart of a process for obtaining standard data representation information provided in an embodiment of the present application;

[0042] Figure 4 A flowchart of a specific method for detecting an application-level incomplete transaction provided in an embodiment of the present application;

[0043] Figure 5 A schematic diagram of the structure of an application-level incomplete transaction detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0045] First, several terms that may be involved in the embodiments of the present application are explained below.

[0046] Transaction: All operations in a program execution unit must either succeed or fail, that is, "either do nothing or do everything (All or Nothing)", and it is not allowed to succeed in half and fail in the other half. For example, if a transaction code performs two database update operations, then these two database operations must either succeed or be rolled back.

[0047] Among them, transactions have ACID characteristics: A refers to atomicity (Atomicity), transactions are executed as a whole, either all or none of them are executed; C refers to consistency (Consistency), transactions should ensure that data is transformed from one consistent state to another consistent state; I refers to isolation (Isolation), when multiple transactions are executed concurrently, the execution of one transaction should not affect the execution of other transactions; D refers to durability (Durability), the data modified by the submitted transaction will be persisted.

[0048] In the embodiment of the present application, the executed transaction must have the characteristics of a transaction, that is, the transaction is an application of a transaction. The operations of a transaction are either all executed successfully or all failed. In the case of successful execution, the database needs to be updated accordingly. In the case of failure, the database needs to be rolled back accordingly, thereby ensuring the consistency of the transaction.

[0049] At present, application-level logic can be written in advance to ensure transaction consistency. Distributed architecture can use the written application-level logic to detect incomplete transactions. Incomplete transactions refer to transactions that do not meet consistency requirements. For example, if a transaction fails to execute, all business data related to the transaction in the database should be rolled back. However, if some business data has changed, the transaction will be considered incomplete.

[0050] In general, the distributed architecture can count non-query transactions with unknown transaction status, such as transactions that do not execute application-level logic or transactions that execute application-level logic incorrectly, as incomplete transactions. Non-query transactions refer to transactions that change database data. However, for reverse transactions (i.e. transaction execution failures), unreasonable distributed transaction design and compensation logic in application-level logic may result in the inability to accurately detect incomplete transactions.

[0051] Based on this, in order to solve the above problems, an embodiment of the present application provides a method for detecting incomplete transactions at the application level and a related device. In the method, a reverse case of the target transaction is first executed, and the first database is updated based on the execution of the reverse case. The execution of the reverse case is based on the application-level logic implementation for detecting incomplete transactions; then, based on the difference between the first database before the update and the first database after the update, the target data performance information is obtained; then, based on the comparison result of the target data performance information and the standard data performance information, it is determined whether the application-level logic for detecting incomplete transactions is accurate; wherein the standard data performance information is used to indicate that the transaction of the target transaction is consistent, and the standard data performance information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction, and the first database before the update is the same as the second database before the update.

[0052] In this way, the standard data representation information that ensures the consistency of transactions is used as the standard, and the target data representation information obtained by executing the reverse case of the target transaction is compared with it, so that it can be determined whether the transaction of the reverse case of the target transaction is consistent, and then it can be accurately determined whether the application-level logic for detecting incomplete transactions is accurate, so as to facilitate prompting technicians and the like to improve the application-level logic for detecting incomplete transactions, so that the distributed architecture using the application-level logic can accurately detect incomplete transactions.

[0053] For example, the embodiments of the present application can be applied to Figure 1 In the scenario shown. The scenario includes a database 101 and a server 102, wherein the server 102 can be an independent server, a cluster server or a cloud server, etc. The server 102 can deploy a distributed architecture, and the distributed architecture can use application-level logic for detecting incomplete transactions. The database 101 includes business data related to the target transaction, etc. The server 102 adopts the implementation method provided in the embodiment of the present application, and can execute the reverse case of the target transaction, and update the database 101 based on the execution of the reverse case. The database 101 can be the first database, and then the server 102 obtains the target data performance information based on the difference between the first database before the update and the first database after the update; finally, the server 102 can determine whether the application-level logic for detecting incomplete transactions is accurate based on the comparison result of the target data performance information and the standard data performance information. It should be noted that the database 101 can be deployed on the server 102 or on other devices.

[0054] First, in the above application scenario, although the actions of the implementation method provided in the embodiment of the present application are described as being executed by the server 102, the embodiment of the present application is not limited in terms of the execution subject, as long as the actions disclosed in the implementation method provided in the embodiment of the present application are executed. For example, the execution subject of the embodiment of the present application may also be a terminal device, which may be a smart phone, a computer, a tablet computer, etc.

[0055] Secondly, the above scenario is only an example scenario provided by the embodiment of the present application, and the embodiment of the present application is not limited to this scenario.

[0056] It should be noted that the detection method of application-level incomplete transactions provided by the present invention can be used in the field of testing technology or the field of finance. The above is only an example and does not limit the application field of the detection method of application-level incomplete transactions provided by the present invention.

[0057] The specific implementation of the method for detecting an application-level incomplete transaction and a related device in the embodiment of the present application will be described in detail below with reference to the accompanying drawings by way of example.

[0058] See also Figure 2 , which is a flow chart of a method for detecting an application-level incomplete transaction provided by an embodiment of the present application, combined with Figure 2 As shown, the following steps may be specifically included:

[0059] S201: Execute a reverse case of a target transaction, and update a first database based on the execution of the reverse case.

[0060] The execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions.

[0061] The reverse case of the target transaction refers to the failure of the target transaction to execute.

[0062] Taking the target transaction as a transfer from account A to account B as an example, it is necessary to reduce the balance of account A and add a transaction flow to account A, increase the balance of account B and add a transaction flow to account B.

[0063] In this example, the reverse case of the target transaction may be a failure to reduce the balance of account A, or a failure to increase the balance of account B, etc., both of which are failures of the target transaction.

[0064] In the process of executing the reverse case of the target transaction, the first database may be updated. The first database stores data related to the target transaction, such as business data related to the target transaction, etc. Based on the example above where the target transaction is a transfer from account A to account B, the first database may store the balance of account A, the balance of account B, and the transaction flow corresponding to account A and account B, etc.

[0065] In addition, the first database may also include data such as operation logs, which is not limited in this application.

[0066] In some embodiments, the reverse case of the target transaction may have a corresponding transaction code, and a technician or the like may input the transaction code so that the reverse case of the target transaction is executed using the distributed architecture of the application-level logic for detecting incomplete transactions, and the first database is updated based on the execution of the reverse case.

[0067] S202: Obtain target data representation information based on the difference between the first database before updating and the first database after updating.

[0068] In some embodiments, the target data representation information may include business data related to the target transaction, and correspondingly, the standard data representation information may also include business data related to the target transaction.

[0069] In other embodiments, the target data representation information may include business data and non-business data such as log data related to the target transaction, and correspondingly, the standard data representation information may also include business data and non-business data such as log data related to the target transaction.

[0070] The following embodiment takes the example that the target data representation information may include business data related to the target transaction, and correspondingly, the standard data representation information may also include business data related to the target transaction, to introduce the application-level incomplete transaction detection method provided in the embodiment of the present application.

[0071] In a possible implementation, before executing a reverse case of a target transaction and updating the first database based on the execution of the reverse case, a snapshot X of the first database may be created; after executing the reverse case of the target transaction and updating the first database based on the execution of the reverse case, a snapshot Y of the first database may be created; the snapshot X of the first database is the first database before the update, and the snapshot Y of the first database is the first database after the update; based on the difference between the snapshot X of the first database and the snapshot Y of the first database, the target data performance information may be obtained.

[0072] In a possible implementation of the present application, the first database may include multiple data tables; S202 may include: based on the difference between the first database before updating and the first database after updating, obtaining identification information and a first operation type of the first data table as the target data representation information; wherein, the first data table is a data table in which business data changes before and after the first database is updated, and the first operation type is the type of operation to update the first data table.

[0073] Taking the target transaction introduced above as the transfer from account A to account B as an example, the first database may include data tables 1 to 8, wherein data table 1 stores the balance and transaction flow of account A, and data table 2 stores the balance and transaction flow of account B. Then data table 1 and data table 2 are data tables storing business data related to the target transaction.

[0074] For example, before and after the first database is updated, the balance of account A stored in data table 1 changes from 100 to 80, and the transaction flow of account A stored in data table 1 changes from 50 to 51, and there is no change in business data in data table 2, then the first data table is data table 1, and the corresponding first operation type is update type and insert type. In other words, data table 1, update type and insert type can be used as target data representation information.

[0075] In addition, the target data representation information may also include a transaction code of a reverse case of the target transaction.

[0076] In some embodiments, the table name Table of the first data table, the first operation type Type and the transaction code Code can be recorded as the target data representation information S1 (Code, Table, Type). For example, the transaction code of the reverse case of the target transaction is 001, the table name of the data table 1 is Table1, and the first operation type is update and insert, then S1 is (001, Table1, (update insert)).

[0077] S1 may also include specific data that has changed in the first data table, for example, the balance of account A changes from 100 to 80, and the transaction flow of account A stored in data table 1 changes from 50 to 51, which are also stored in S1.

[0078] In this way, by comparing the changes before and after the first database is updated, the first data table and the corresponding first operation type are used as target data representation information, thereby facilitating subsequent comparison with the standard data representation information.

[0079] S203: Based on the comparison result of the target data representation information and the standard data representation information, determine whether the application-level logic for detecting incomplete transactions is accurate.

[0080] Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

[0081] In one possible implementation, the standard data representation information is obtained through the following steps: executing a positive case of the target transaction and updating the second database based on the execution of the positive case; and obtaining the standard data representation information based on the difference between the second database before the update and the second database after the update.

[0082] A positive case of a target transaction is one in which the target transaction is successfully executed.

[0083] Based on the above example, taking the target transaction as a transfer from account A to account B as an example, it shows that the operations of reducing the balance of account A and adding a transaction flow to account A, increasing the balance of account B, and adding a transaction flow to account B are all executed successfully.

[0084] In the process of executing the positive case of the target transaction, the second database can be updated accordingly. For example, if the balance of account A is reduced, the balance of account A in the second database will be updated. If a transaction flow is increased for account A, a transaction flow is inserted for account A in the second database. If the balance of account B is increased, the balance of account B in the second database will be updated. If a transaction flow is increased for account B, a transaction flow is inserted for account B in the second database.

[0085] The standard data representation information is used to indicate that the transaction of the target transaction is consistent, indicating that the positive case of the target transaction is successfully executed, and the second database also updates the relevant business data accordingly.

[0086] In this way, the update of the second database corresponding to the positive case of the target transaction is used as a standard to facilitate comparison of whether the update of the first database corresponding to the reverse case of the executed target transaction is accurate.

[0087] In a possible implementation of the present application, the second database includes multiple data tables; the above "based on the difference between the second database before the update and the second database after the update, the standard data representation information is obtained" can specifically include: based on the difference between the second database before the update and the second database after the update, the identification information and the second operation type of the second data table are obtained as the standard data representation information; wherein, the second data table is a data table in which the business data changes before and after the second database is updated, and the second operation type is the type of operation to update the second data table.

[0088] Similarly, please refer to the specific implementation method of S202 introduced above, which will not be repeated here.

[0089] In the example described above where the target transaction is a transfer from account A to account B, before and after the second database is updated, the balance of account A stored in data table 1 changes from 100 to 80, and the transaction records of account A stored in data table 1 change from 50 to 51; the balance of account B stored in data table 2 changes from 200 to 220, and the transaction records of account B stored in data table 2 change from 100 to 101. The second data table is data table 1 and data table 2, and the second operation type is update type and insert type. In other words, data table 1, data table 2, update type and insert type can be used as standard data representation information.

[0090] In addition, the standard data representation information may also include a transaction code of a positive case of the target transaction.

[0091] In some embodiments, the table name Table of the second data table, the second operation type Type and the transaction code Code can be recorded as standard data representation information S0 (Code, Table, Type). For example, the transaction code of the positive case of the target transaction is 000, the table names of data table 1 and data table 2 are Table1 and Table2 respectively, and the second operation type is update and insert, then S0 is (000, (Table1 Table2), (update insert)).

[0092] In one possible implementation, before executing a positive case of a target transaction and updating the second database based on the execution of the positive case, a snapshot A of the second database may be created; after executing the positive case of the target transaction and updating the second database based on the execution of the positive case, a snapshot B of the second database may be created; the snapshot A of the second database is the second database before the update, and the snapshot B of the second database is the second database after the update; based on the difference between the snapshot A of the second database and the snapshot B of the second database, standard data representation information may be obtained.

[0093] In this way, by comparing the changes before and after the second database is updated, the second data table and the corresponding second operation type are used as standard data representation information, thereby facilitating subsequent comparison with the target data representation information.

[0094] In a possible implementation of the present application, S203 may specifically include: if the business data included in the target data representation information and the business data included in the standard data representation information are partially identical or completely identical, determining that the application-level logic for detecting incomplete transactions is inaccurate.

[0095] It should be understood that the reverse case of the target transaction indicates that the target transaction fails to execute, and the business data of the first database should be rolled back, that is, all restored to the state before the reverse case of the target transaction is executed. The business data included in the target data performance information and the business data included in the standard data performance information are partially the same or completely the same, indicating that the business data of the first database has changed. If the rollback fails, the application-level logic used to detect incomplete transactions is inaccurate.

[0096] For example, in the above example, the target data representation information S1 is (001, Table1, (update insert)), the standard data representation information S0 is (000, (Table1 Table2), (update insert)), the data tables that have partially changed (that is, Table1) are the same, and the operation types are the same, indicating that the first database rollback failed, and the application-level logic used to detect incomplete transactions in the reverse case of executing the target transaction is inaccurate.

[0097] In one possible implementation, the standard data representation information is obtained through the following steps: executing a reverse case of the target transaction and updating the second database based on the execution of the reverse case; and obtaining the standard data representation information based on the difference between the second database before the update and the second database after the update.

[0098] The reverse case of the target transaction refers to the failure of the target transaction to execute.

[0099] The standard data representation information is used to indicate that the transaction of the target transaction is consistent, indicating that the reverse case execution of the target transaction fails, and the second database also accurately updates the relevant business data accordingly, and all business data is rolled back.

[0100] Based on the above example, taking the target transaction as a transfer from account A to account B, in the process of executing the reverse case of the target transaction, the second database can be updated accordingly. For example, if the balance reduction of account A is successful, the balance of account A in the second database is updated, and a transaction flow is added for account A. If the balance increase of account B fails, the balance of account A in the second database is rolled back, that is, account A is restored to the state before the update, and the transaction flow of account A is rolled back, that is, the newly added transaction flow of account A is deleted.

[0101] Exemplarily, based on the above example, taking the transaction code of the reverse case of the target transaction as 001, the standard data representation information S0 is (000, -, -).

[0102] In this way, the accurate update of the second database corresponding to the reverse case of the target transaction is used as a standard to facilitate comparison of whether the update of the first database corresponding to the reverse case of the executed target transaction is accurate.

[0103] In a possible implementation of the present application, S203 may specifically include: if the business data included in the target data representation information is different from the business data included in the standard data representation information, determining that the application-level logic for detecting incomplete transactions is inaccurate.

[0104] For example, in the above example, the target data representation information S1 is (001, Table1, (update insert)), and the standard data representation information S0 is (000, -, -). The two are different, indicating that the first database rollback failed, and the application-level logic used to detect incomplete transactions in the reverse case of executing the target transaction is inaccurate.

[0105] As an example, see Figure 3 , which is a flow chart of a process of obtaining standard data representation information provided by an embodiment of the present application. Figure 3 As shown, it includes process 1, construction of a transaction code data representation standard set, that is, obtaining standard data representation information as a standard.

[0106] Step 1.1: Input the transaction code to be tested, that is, input the transaction code of the positive case of the target transaction to be tested; in addition, the transaction code of the reverse case of the target transaction to be tested may also be input, which is not shown in the figure;

[0107] Step 1.2: Database snapshot A, that is, before the forward case of the target transaction is executed, a snapshot A of the second database is created to record the data of the second database before the update;

[0108] Step 1.3: Execute the life and death transaction case, that is, execute the positive case of the target transaction with the transaction code;

[0109] Step 1.4: Database snapshot B, that is, after the forward case of the target transaction is executed, a snapshot B of the second database is created to record the updated data of the second database;

[0110] Step 1.5: Collect the transaction code database performance, that is, based on the difference between snapshot A and snapshot B, obtain the second data table and the second operation type as the collection result;

[0111] Step 1.6: Establish the transaction code data representation standard set S0, that is, archive the collection results in 1.5 to obtain standard data representation information S0.

[0112] As an example, see Figure 4 , which is a flowchart of a specific application-level incomplete transaction detection method provided by an embodiment of the present application. Figure 4 As shown, it includes process 2, incomplete transaction test analysis, that is, a specific application-level incomplete transaction detection method.

[0113] Step 2.1: Enter the transaction code to be tested, that is, the transaction code of the reverse case of the target transaction to be tested;

[0114] Step 2.2: Database snapshot X, that is, before the reverse case of the target transaction is executed, a snapshot X of the first database is created to record the data of the first database before the update;

[0115] Step 2.3: Automatically execute the transaction case (reverse). For example, if the transaction code corresponds to a batch of reverse cases, a batch of reverse cases can be executed, and subsequent operations can be performed for each reverse case;

[0116] Step 2.4: Database snapshot Y, that is, after the reverse case of the target transaction is executed, a snapshot Y of the first database is created to record the updated data of the first database;

[0117] Step 2.5: Collect the transaction code database performance, that is, based on the difference between snapshot X and snapshot Y, obtain the first data table and the first operation type as the collection result;

[0118] Step 2.6: Compare and analyze with the transaction code data performance standard set S0, that is, record the collection results in 2.5 as S1, and compare and analyze with the standard data performance information S0;

[0119] Step 2.7: If the comparison finds that S1 is partially or completely identical to S0, an incomplete transaction is recorded, indicating that the application-level logic used to detect incomplete transactions is inaccurate.

[0120] In addition, if the comparison reveals that S1 is completely different from S0, then we can end the test, indicating that the application-level logic for detecting incomplete transactions is accurate, and start testing the reverse cases of other target transactions.

[0121] In addition, in some embodiments, after determining that the application-level logic used to detect incomplete transactions is inaccurate, an incomplete transaction detection report can be generated for the reverse case of the target transaction, and a rationality analysis (such as application-level logic errors and other issues) can be generated, which helps developers and testers to automatically and quickly detect incomplete transactions at the application level of distributed transactions, effectively reducing the workload of developers and testers, improving efficiency, and avoiding system defects.

[0122] The above are some specific implementations of the detection method of application-level incomplete transactions provided by the embodiments of the present application. Based on this, the present application also provides a corresponding detection device for application-level incomplete transactions. The following will introduce the detection device for application-level incomplete transactions provided by the embodiments of the present application from the perspective of functional modularization.

[0123] See also Figure 5 , which is a schematic diagram of the structure of an application-level incomplete transaction detection device provided in an embodiment of the present application. The application-level incomplete transaction detection device 500 may include:

[0124] A first execution and update module 510, configured to execute a reverse case of the target transaction and update the first database based on the execution of the reverse case; the execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions;

[0125] A first information acquisition module 520, configured to obtain target data performance information based on a difference between the first database before updating and the first database after updating;

[0126] A logic determination module 530, for determining whether the application-level logic for detecting incomplete transactions is accurate based on a comparison result of the target data representation information and the standard data representation information;

[0127] Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

[0128] As an implementation method, the standard data representation information is obtained through the following modules:

[0129] a second execution and update module, configured to execute a positive case of the target transaction and update the second database based on the execution of the positive case;

[0130] The second information acquisition module is used to obtain the standard data representation information based on the difference between the second database before updating and the second database after updating.

[0131] As an implementation mode, the logic determination module may be specifically used for:

[0132] If the business data included in the target data representation information and the business data included in the standard data representation information are partially identical or completely identical, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

[0133] As an implementation method, the standard data representation information is obtained through the following modules:

[0134] a third execution and update module, configured to execute a reverse case of the target transaction and update the second database based on the execution of the reverse case;

[0135] The third information acquisition module is used to obtain the standard data representation information based on the difference between the second database before the update and the second database after the update.

[0136] As an implementation mode, the logic determination module may be specifically used for:

[0137] If the business data included in the target data representation information is different from the business data included in the standard data representation information, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

[0138] As an implementation manner, the first database includes a plurality of data tables; the first information acquisition module can be specifically used for:

[0139] Based on the difference between the first database before updating and the first database after updating, obtaining identification information of the first data table and the first operation type as the target data representation information;

[0140] The first data table is a data table in which business data changes before and after the first database is updated, and the first operation type is a type of operation for updating the first data table.

[0141] As an implementation mode, it is characterized in that the second database includes multiple data tables; the second information acquisition module or the third information acquisition module can be specifically used for:

[0142] Based on the difference between the second database before the update and the second database after the update, obtaining identification information of the second data table and the second operation type as the standard data representation information;

[0143] The second data table is a data table in which business data changes before and after the second database is updated, and the second operation type is a type of operation for updating the second data table.

[0144] The embodiments of the present application also provide a corresponding application-level incomplete transaction detection device and a computer-readable storage medium for implementing the solution provided by the embodiments of the present application.

[0145] Among them, the application-level incomplete transaction detection device includes a memory and a processor, the memory is used to store a computer program, and the processor is used to execute the computer program, so that the device executes the application-level incomplete transaction detection method described in any embodiment of the present application.

[0146] The computer-readable storage medium stores a computer program. When the computer program is executed, a device executing the computer program implements the method for detecting an application-level incomplete transaction described in any embodiment of the present application.

[0147] The "first" and "second" in the names such as "first" and "second" (if any) mentioned in the embodiments of the present application are only used as name identifiers and do not represent the first or second in order.

[0148] Through the description of the above implementation methods, it can be known that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a general hardware platform. Based on such an understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a readable storage medium, such as a read-only memory (ROM) / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network communication device such as a router) to execute the methods described in each embodiment of the present application or some parts of the embodiments.

[0149] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.

[0150] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for detecting an application-level incomplete transaction, characterized in that: include: executing a reverse case of the target transaction, and updating the first database based on the execution of the reverse case; The execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions; Obtaining target data performance information based on a difference between the first database before updating and the first database after updating; Determining whether the application-level logic for detecting incomplete transactions is accurate based on a comparison result of the target data representation information and the standard data representation information; Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

2. The method according to claim 1, characterized in that The standard data performance information is obtained by the following steps: executing a positive case of the target transaction, and updating the second database based on the execution of the positive case; The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update.

3. The method according to claim 2, characterized in that The determining whether the application-level logic for detecting incomplete transactions is accurate based on the comparison result between the target data representation information and the standard data representation information includes: If the business data included in the target data representation information and the business data included in the standard data representation information are partially identical or completely identical, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

4. The method according to claim 1, characterized in that: The standard data performance information is obtained by the following steps: executing a reverse case of the target transaction, and updating the second database based on the execution of the reverse case; The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update.

5. The method according to claim 4, characterized in that The determining whether the application-level logic for detecting incomplete transactions is accurate based on the comparison result between the target data representation information and the standard data representation information includes: If the business data included in the target data representation information is different from the business data included in the standard data representation information, it is determined that the application-level logic for detecting incomplete transactions is inaccurate.

6. The method according to any one of claims 1 to 5, characterized in that: The first database includes a plurality of data tables; the target data performance information is obtained based on the difference between the first database before the update and the first database after the update, including: Based on the difference between the first database before updating and the first database after updating, obtaining identification information of the first data table and the first operation type as the target data representation information; The first data table is a data table in which business data changes before and after the first database is updated, and the first operation type is a type of operation for updating the first data table.

7. The method according to any one of claims 2 or 4, characterized in that: The second database includes a plurality of data tables; the standard data representation information is obtained based on the difference between the second database before the update and the second database after the update, including: Based on the difference between the second database before updating and the second database after updating, obtaining identification information of the second data table and the second operation type as the standard data representation information; The second data table is a data table in which business data changes before and after the second database is updated, and the second operation type is a type of operation for updating the second data table.

8. A detection device for application-level incomplete transactions, characterized in that: include: a first execution and update module, configured to execute a reverse case of the target transaction and update the first database based on the execution of the reverse case; The execution of the reverse case is based on an application-level logic implementation for detecting incomplete transactions; A first information acquisition module, used to obtain target data performance information based on the difference between the first database before updating and the first database after updating; a logic determination module, configured to determine whether the application-level logic for detecting incomplete transactions is accurate based on a comparison result between the target data representation information and the standard data representation information; Among them, the standard data representation information is used to indicate that the transaction of the target transaction is consistent. The standard data representation information is obtained based on the difference between the second database before the update and the second database after the update after the second database is updated based on the execution of the target transaction. The first database before the update is the same as the second database before the update.

9. A device for detecting incomplete transactions at the application level, characterized in that: The device comprises a memory and a processor: The memory is used to store a computer program and transmit the computer program to the processor; The processor is used to execute the computer program so that the device performs the steps of the method for detecting an application-level incomplete transaction as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program. When the computer program is executed, a device executing the computer program implements the steps of the method for detecting an application-level incomplete transaction according to any one of claims 1 to 7.