Transaction rollback method, device, computer equipment and storage medium

By receiving transaction rollback requests and determining the target field type, the efficiency problem of traditional systems in rollback of transactions is solved, efficient rollback processing of transactions is achieved, and the correction efficiency and accuracy of transaction management system is improved. .

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

Patent Information

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

AI Technical Summary

Technical Problem

Traditional transaction management systems are difficult to effectively roll back erroneous transactions when processing each transaction, and their execution efficiency is not high.

Method used

By receiving a transaction rollback request, determine the target field type of the transaction to be rolled back and the field data in the latest transaction, and roll back the target transaction according to the field type, including calculating the difference of the numerical field or updating the data of the parameter field. Implement rollback processing of each transaction.

Benefits of technology

It realizes efficient rollback processing of each transaction, and improves the correction efficiency and accuracy of the transaction management system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237977B_ABST
    Figure CN114237977B_ABST
Patent Text Reader

Abstract

The present application relates to a transaction rollback method, device, computer equipment, storage medium and computer program product. The method receives a transaction rollback request and determines whether the transaction to be rolled back is a target transaction according to the transaction identifier carried in the transaction rollback request. When it is determined to be a target transaction, the target field in the transaction to be rolled back is further determined, and the field type of the target field and the field data of the target field corresponding to the latest transaction are obtained, and then the transaction to be rolled back is rolled back according to the field type of the target field and the field data of the target field corresponding to the latest transaction. Since the target transaction in the present application is not the latest transaction, the rollback processing of the alternate transaction is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Transaction rollback refers to the act of restoring data to its correct state before the erroneous transaction due to an error that makes the data result lack reference value.

[0003] In traditional transaction management systems, data recovery is generally performed by erasing accounts, that is, correcting erroneous transactions by initiating a business transaction opposite to the erroneous transaction, and erasing the relevant erroneous transactions in the account flow and register, thereby making the data correct.

[0004] However, the existing method of erasing accounts can only correct the latest transaction, that is, the transaction to be corrected must be the last transaction recorded. It is difficult to solve the problem of missed transactions, that is, when a new transaction modifies the data of the transaction to be erased, and the execution efficiency is not high. Summary of the invention

[0005] Based on this, it is necessary to provide a transaction rollback method, apparatus, computer device, computer-readable storage medium and computer program product that can implement transaction rollback in order to address the above technical issues.

[0006] In a first aspect, the present application provides a transaction rollback method. The method comprises:

[0007] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0008] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0009] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0010] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0011] In one embodiment, the field type includes a numeric type; rolling back the target transaction according to the field type of the target field and the field data of the target field corresponding to the latest transaction includes: when the field type of the target field is a numeric type, obtaining the change value of the target field in the target transaction; calculating the difference between the field data of the target field corresponding to the latest transaction and the change value; and updating the target data corresponding to the target field according to the difference.

[0012] In one of the embodiments, the field type includes a parameter type; rolling back the target transaction according to the field type of the target field and the field data in the latest transaction corresponding to the target field includes: when the field type of the target field is a parameter type, using the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.

[0013] In one of the embodiments, after receiving the transaction rollback request, the method further includes: querying a data change record table according to the transaction identifier, wherein a plurality of data change records are recorded in the data change record table; when a data change record matching the transaction identifier is queried, determining whether the transaction to be rolled back is the last record in the matching data change record; when it is determined that the transaction to be rolled back is not the last record, determining that the transaction to be rolled back is the target transaction.

[0014] In one of the embodiments, the method further includes: when it is determined that the transaction to be rolled back is the last record, obtaining the data change type corresponding to the transaction to be rolled back; generating a corresponding rollback statement according to the data change type, and rolling back the transaction to be rolled back based on the rollback statement.

[0015] In one of the embodiments, before querying the data change record table according to the transaction identifier, the method further includes: querying the account erasure record table based on the transaction identifier, wherein a plurality of account erasure records are recorded in the account erasure record table; when no account erasure record matching the transaction identifier is found, querying the data change record table according to the transaction identifier.

[0016] In one of the embodiments, after the target transaction is rolled back, the method further includes: generating an erasure record for the target transaction in the erasure record table based on the rollback of the target transaction, wherein the erasure record includes at least a transaction identifier of the target transaction; and generating a data change record for the target transaction in the data change record table, wherein the data change record includes at least a transaction identifier of the target transaction and a version identifier of the record.

[0017] In one of the embodiments, determining whether the transaction to be rolled back is the last record in the matching data change record includes: obtaining a version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is not the last record; or, obtaining a transaction time of the transaction to be rolled back, and when the transaction time is the same as the latest transaction time in the matching data change record, determining that the transaction to be rolled back is the last record; when the transaction time is different from the latest transaction time in the matching data change record, determining that the transaction to be rolled back is not the last record.

[0018] In a second aspect, the present application also provides a transaction rollback device. The device comprises:

[0019] A request receiving module, used for receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0020] a target field determination module, configured to determine a target field in the target transaction when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, wherein the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0021] A data acquisition module, used to acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0022] The rollback processing module is used to roll back the target transaction according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0023] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0024] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0025] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0026] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0027] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0028] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0029] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0030] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0031] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0032] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0033] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0034] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0035] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0036] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0037] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0038] The transaction rollback method, device, computer equipment, storage medium and computer program product described above receive a transaction rollback request, and determine whether the transaction to be rolled back is a target transaction according to the transaction identifier carried in the transaction rollback request. When it is determined to be a target transaction, the target field in the transaction to be rolled back is further determined, and the field type of the target field and the field data of the target field corresponding to the latest transaction are obtained, and then the transaction to be rolled back is rolled back according to the field type of the target field and the field data of the target field corresponding to the latest transaction. Since the target transaction in the present application is not the latest transaction, the rollback of the alternate transaction is realized. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 An application environment diagram of a transaction rollback method in an embodiment;

[0040] Figure 2 A schematic diagram of a process of a transaction rollback method in one embodiment;

[0041] Figure 3 A schematic diagram of a flow chart of a transaction rollback method in another embodiment;

[0042] Figure 4 A structural block diagram of a transaction rollback device in an embodiment;

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

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

[0045] The transaction rollback method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network servers. Specifically, when the user has a transaction rollback requirement, the corresponding transaction rollback request can be initiated to the server 104 through the terminal 102, and the server 104 determines whether the transaction to be rolled back is the target transaction according to the transaction identifier carried in the transaction rollback request. When it is determined that the transaction to be rolled back is the target transaction, the target field in the target transaction is further determined, and the field type of the target field and the field data corresponding to the target field in the latest transaction are obtained, and then the target transaction is rolled back according to the field type of the target field and the field data corresponding to the target field in the latest transaction, thereby realizing the rollback processing of the alternate transaction. Among them, the terminal 102 can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0046] In one embodiment, Figure 2 As shown, a transaction rollback method is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0047] Step 202: Receive a transaction rollback request.

[0048] Among them, the transaction rollback request is a request for rolling back the transaction to be rolled back, and the transaction rollback request carries the transaction identifier of the transaction to be rolled back. Specifically, the transaction identifier is a mark used to distinguish different transactions, such as transaction serial number, transaction sequence number, etc. The transaction to be rolled back is a transaction that needs to be rolled back, wherein the transaction includes but is not limited to transactions for querying balances in the bank account system, transactions for withdrawing money, transactions for transferring money, and transactions for adding, deleting, and modifying various information. Usually, a transaction involves data changes in multiple database tables, and there are also cases where multiple transactions modify the same data record. Therefore, when an erroneous transaction is found, the corresponding data needs to be rolled back to restore to the state before the erroneous transaction. Generally, for a transaction that involves data changes in multiple database tables, association can be made based on the transaction identifier to roll back the data in each database table. For the case where multiple transactions modify the same data record, the transaction and the data can also be associated through primary key information, wherein the primary key information refers to the object (i.e., data) changed by the transaction, usually including the primary key field and the primary key value, such as the user identifier, AA. Therefore, transactions that cause data under the same user ID to change can be associated based on the user ID, and each transaction has its own transaction ID. This embodiment is mainly described by rolling back a target transaction among multiple transactions that cause the same data to change.

[0049] In this embodiment, when the user has a transaction rollback requirement, that is, when the user finds that there is an error in a transaction and needs to repair the data, the user can initiate a corresponding transaction rollback request to the server through the terminal, and carry the transaction identifier of the corresponding transaction to be rolled back in the transaction rollback request. The server can receive the corresponding transaction rollback request and perform the transaction rollback processing through subsequent steps.

[0050] Step 204: when it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined.

[0051] Among them, the target transaction is used to characterize that the transaction to be rolled back is not the latest transaction, that is, it is not the last transaction that causes a certain data change. The target field refers to the field where the target transaction causes the data change. Specifically, since each transaction generates a corresponding transaction identifier and transaction time, and each transaction is associated by a primary key, all transaction records under the same primary key can be obtained based on the primary key information recorded in the transaction to be rolled back, and then the transaction identifier of the transaction to be rolled back can be compared with the transaction identifier of the last transaction recorded, or the corresponding transaction time can be determined based on the transaction identifier of the transaction to be rolled back, and compared based on the transaction time with the transaction time of the last transaction recorded, so as to determine whether the transaction to be rolled back is the last transaction recorded. For example, if the transaction identifier of the transaction to be rolled back is consistent with the transaction identifier of the last transaction recorded, it means that the transaction to be rolled back is the latest transaction, and thus it is not the target transaction. On the contrary, if the transaction identifier of the transaction to be rolled back is different from the transaction identifier of the last transaction recorded, it means that the transaction to be rolled back is not the last transaction recorded, so it can be determined that the transaction to be rolled back is the target transaction.

[0052] Furthermore, based on the transaction-related data of the target transaction, the corresponding target field can be determined, that is, the field whose data is changed due to the target transaction. Specifically, the transaction-related data includes, but is not limited to, the data corresponding to each field before the transaction is changed, the data corresponding to each field after the transaction is changed, and the version identifier of each field. For example, when the data after the change corresponding to a field in the target transaction is different from the data before the change, it means that the data of the field has changed, that is, it is the target field. On the contrary, if the data after the change corresponding to a field in the target transaction is the same as the data before the change, it means that the data of the field has not changed, and it is not the target field; or when the version identifier of a field in the target transaction is different from the version identifier of the corresponding field in the previous transaction adjacent to it, it means that the field is the target field, otherwise it is not the target field.

[0053] Step 206, obtaining the field type of the target field and the field data of the target field corresponding to the latest transaction.

[0054] Among them, the field type refers to the type of data recorded in the corresponding field, including numerical type, parameter type and status type, etc. For example, for the numerical type, it includes but is not limited to numerical data such as amount and number of transactions; for the status type, it includes but is not limited to various status data, such as the status of a bank account may include unopened account, unactivated account, frozen, reported lost, normal, closed account, etc.; for the parameter type, it is usually parameter configuration data, such as institution address, user personal information, etc. The target field corresponds to the field data in the latest transaction, which refers to the latest data of the field at the moment of the current rollback process, which can be obtained based on the original data record or data change record. In this embodiment, based on the above-determined target transaction and the target field in the target transaction, the field type of the target field and the field data corresponding to the target field in the latest transaction can be further obtained.

[0055] Step 208: Roll back the target transaction according to the field type of the target field and the field data of the target field corresponding to the latest transaction.

[0056] Specifically, since this application is aimed at the rollback of alternate transactions, that is, the transaction to be rolled back is not the last transaction recorded, therefore, for the status field, since its latest transaction may have changed the status data of the corresponding field, such as the latest transaction has updated the status from normal to account cancellation, and if the target transaction to be rolled back is to update the status from account opening but not activated to normal, since the final status is still account cancellation, this kind of rollback is meaningless, therefore, in this embodiment, the status field is not processed. For numeric fields and parameter fields, they can be rolled back according to the field data in the latest transaction corresponding to the target field to obtain the correct data of the corresponding field, thereby realizing the rollback of the target transaction.

[0057] In the transaction rollback method, a transaction rollback request is received, and whether the transaction to be rolled back is a target transaction is determined according to the transaction identifier carried in the transaction rollback request. When it is determined to be a target transaction, the target field in the transaction to be rolled back is further determined, and the field type of the target field and the field data of the target field corresponding to the latest transaction are obtained, and then the transaction to be rolled back is rolled back according to the field type of the target field and the field data of the target field corresponding to the latest transaction. Since the target transaction in the present application is not the latest transaction, the rollback of the alternate transaction is realized.

[0058] In one embodiment, for example, when the field type is a numeric type, the target transaction is rolled back according to the field type of the target field and the field data of the target field corresponding to the latest transaction, specifically including: when it is determined that the field type of the target field is a numeric type, the change value of the target field in the target transaction is obtained; the difference between the field data of the target field corresponding to the latest transaction and the change value is calculated; the target data corresponding to the target field is updated according to the difference. Among them, the change value refers to the value obtained by subtracting the value before the transaction change from the value after the transaction change corresponding to the target field under the target transaction. Then, the difference between the field data of the target field corresponding to the latest transaction and the change value is calculated, and the calculated difference is used as the target data corresponding to the target field to restore the data to the correct state before the erroneous transaction, thereby realizing the rollback processing of the numeric data.

[0059] In one embodiment, when the field type is parameter type, the target transaction is rolled back according to the field type of the target field and the field data of the target field corresponding to the latest transaction, which may specifically include: when the field type of the target field is parameter type, the field data of the target field corresponding to the latest transaction is used as the target data corresponding to the target field. Since parameter type fields are usually parameter configuration fields, such as institution address, user personal information, etc., if the target transaction sets the institution number corresponding to address 0 as address 1, and the latest transaction sets the institution number corresponding to address 2, then when rolling back the target transaction, there is no need to care about its changes, and only the target address (i.e., target data) needs to be set to the latest address 2, thereby realizing the rollback of the parameter type field.

[0060] In one embodiment, Figure 3 As shown, after receiving the transaction rollback request, the above method may further include:

[0061] Step 302: query the data change record table according to the transaction identifier.

[0062] Among them, a number of data change records are recorded in the data change record table, and each data change record includes but is not limited to the transaction identifier (such as transaction serial number), table name, primary key information, change type (such as addition, deletion, modification, etc.), data before change, version number of each field of data before change, data after change, version number of each field of data after change, and information such as the list of changed fields and version identifier. In this embodiment, the data change record table can be queried based on the transaction identifier recorded in the transaction to be rolled back, that is, whether there is a data change record matching the transaction identifier in the data change record table. Specifically, when no matching data change record is found, it is possible that the transaction identifier is incorrect or the corresponding transaction record does not exist, so there is no need to perform rollback processing. When a matching data change record is found, the following steps are executed in sequence.

[0063] Step 304: When a data change record matching the transaction identifier is found, determine whether the transaction to be rolled back is the last record in the matching data change record.

[0064] Specifically, when a data change record matching the transaction identifier is found, the primary key information corresponding to the transaction is determined, and then all transaction records under the same primary key are obtained based on the primary key information, that is, all data change records that cause the data change are obtained, thereby obtaining the matching data change record. It is further determined whether the transaction to be rolled back is the last record in the matching data change record.

[0065] Since each transaction generates a corresponding transaction identifier and transaction time, in this embodiment, it can be determined whether the transaction to be rolled back is the last record in the matching data change record based on the transaction identifier and transaction time.

[0066] For example, the transaction identifier of the transaction to be rolled back can be compared with the transaction identifier of the last transaction recorded in the account. If the transaction identifier of the transaction to be rolled back is consistent with the transaction identifier of the last transaction recorded in the account, it means that the transaction to be rolled back is the last record in the matching data change record. Conversely, if the transaction identifier of the transaction to be rolled back is different from the transaction identifier of the last transaction recorded in the account, it means that the transaction to be rolled back is not the last record in the matching data change record.

[0067] The transaction time of the transaction to be rolled back can also be obtained. When the transaction time is the same as the latest transaction time in the matching data change record, the transaction to be rolled back is determined to be the last record. Conversely, when the transaction time is different from the latest transaction time in the matching data change record, it is determined that the transaction to be rolled back is not the last record.

[0068] Of course, it is also possible to determine whether the transaction to be rolled back is the last record in the matching data change record based on the version identifier of the transaction to be rolled back, wherein the version identifier is also a mark used to uniquely identify the transaction, which is usually generated in order from small to large in the time dimension. For example, when the version identifier is the same as the maximum version identifier in the matching data change record, it is determined that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, it is determined that the transaction to be rolled back is not the last record.

[0069] Step 306: When it is determined that the transaction to be rolled back is not the last record, the transaction to be rolled back is determined to be the target transaction.

[0070] Specifically, when it is determined that the transaction to be rolled back is not the last record, the transaction to be rolled back is determined to be the target transaction, that is, the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction, that is, after the target transaction, there is a new transaction that modifies the corresponding data. Figure 2 The method shown performs rollback processing on the target transaction, thereby realizing rollback processing on the alternate transaction.

[0071] In one embodiment, when it is determined that the transaction to be rolled back is the last record, the data change type corresponding to the transaction to be rolled back is obtained, and then the corresponding rollback statement is generated according to the data change type, and the transaction to be rolled back is rolled back based on the rollback statement. In this embodiment, when it is determined that the transaction to be rolled back is the last record, it means that the transaction is the last transaction to modify the data. Therefore, the data change type corresponding to the transaction to be rolled back can be further obtained, wherein the data change type includes the type of adding data, the type of deleting data, and the type of modifying data. Then the transaction to be rolled back is rolled back according to different data change types. For example, when the change type is the type of adding data, the pre-change data and the pre-change version number corresponding to the transaction should be empty, so the generated rollback statement should be a delete statement, that is, delete the data of the corresponding table, so that the data is restored to the state before the transaction to be rolled back is executed. When the change type is the type of deleting data, the post-change data and the post-change version number corresponding to the transaction should be empty, so the generated rollback statement should be a new statement, that is, add the data of the corresponding table, so that the data is restored to the state before the transaction to be rolled back is executed. When the change type is a type of modifying data, the transaction corresponds to the data before the change, the data after the change, the version number before the change, and the version number after the change. Therefore, the generated rollback statement should be an update statement, that is, updating the data of the corresponding table, updating the data to the data before the change, so that the data is restored to the state before the execution of the transaction to be rolled back.

[0072] In one embodiment, before querying the data change record table according to the transaction identifier, the above method may further include: querying the account erasure record table based on the transaction identifier, and when no account erasure record matching the transaction identifier is queried, querying the data change record table according to the transaction identifier. The account erasure record table records a number of account erasure records, that is, it records each transaction that has been rolled back. Specifically, the account erasure record at least includes the transaction identifier of the transaction that has been rolled back. Therefore, in this embodiment, the account erasure record table is queried based on the transaction identifier of the transaction to be rolled back, and when the account erasure record of the transaction to be rolled back is queried from the account erasure record table, it means that the transaction has been erased, that is, it has been rolled back, thereby terminating the process. If the account erasure record of the transaction is not queried from the account erasure record table, the account is allowed to be erased, and then the data change record table is queried according to the transaction identifier to perform the next step of processing, thereby avoiding the occurrence of repeated account erasures and improving the accuracy of the data.

[0073] In one embodiment, after rolling back the target transaction and after rolling back the transaction to be rolled back, the method may further include: generating an erasure record for the target transaction in the erasure record table based on the rollback of the target transaction, or generating an erasure record for the transaction to be rolled back in the erasure record table based on the rollback of the transaction to be rolled back. That is, for each transaction to be rolled back, a corresponding erasure record is generated in the erasure record table, wherein the erasure record at least includes the transaction identifier of the transaction to be erased.

[0074] Similarly, for each transaction to be rolled back, the corresponding changed data needs to be updated or repaired accordingly. Therefore, for each transaction to be rolled back, a corresponding data change record needs to be generated in the data change record table. The data change record includes at least the transaction identifier of the transaction to be rolled back (i.e. the target transaction or the transaction to be rolled back) and the version identifier of the record. In this way, a detailed record is kept for each change in the data, which is also convenient for implementing the rollback of alternate transactions.

[0075] In one embodiment, the solution of the present application is further described below through a specific embodiment. In this embodiment, for all database tables, in addition to the fields that the table itself should have, each change of the field is recorded by adding a version identifier of the field. For example, when the data of a field in the table changes, the version identifier corresponding to the field will be automatically increased by 1. In this way, the version identifier of the field can effectively determine whether the corresponding data has changed, so as to facilitate the rapid determination of the field where the data has changed (that is, the target field) during rollback.

[0076] At the same time, for the changes in the database involved in the transaction, the change record of each data is recorded through the data change record table. For example, when each transaction is executed, a serial number is used to identify the transaction, such as a transaction serial number, so that the saved data change records can be distinguished based on the transaction serial number. In addition, since certain specific types of fields such as status fields cannot be processed when the account is erased after each entry, the corresponding data change record can also record whether the corresponding changed field supports the identification of erasing the account after each entry. For example, when the changed field is a status field, the identification can be directly set to no, and when the changed field is a field of other types, the identification can be directly set to yes. Therefore, based on this identification, the processing efficiency of the above-mentioned transaction rollback can be further improved.

[0077] The transaction rollback method of the present application is further described below by taking the following Table 1 as an example, Table 1:

[0078]

[0079] Among them, Table 1 is the matching data change record queried in the data change record table based on the transaction identifier of the transaction to be rolled back. For example, if the transaction to be rolled back is a transaction with a transaction number of "T2", then based on the transaction identifier of the transaction (such as the transaction number or serial number), by searching the corresponding data change record table, the corresponding data change record with a transaction number of "T2" can be found from the data change record table, and then based on the primary key information in the data change record, it can be determined that the corresponding changed data is the relevant transaction data of the user with customer number 20. Therefore, based on the primary key information (such as customer number 20), the data change record shown in Table 1 can be obtained by further querying the data change record table.

[0080] Based on the above-mentioned method for determining the target transaction, it can be known that the transaction corresponding to T2 is not the last transaction that causes the data of customer number 20 to change, so T2 can be determined as the target transaction. It is further necessary to determine the target field in the target transaction, that is, the field that causes the data change in the transaction. Specifically, it can be determined by comparing whether the data information after the change in the transaction corresponding to T2 is the same as the data information before the change. For example, the data information of T2 before the change is (1, 0, 0), and the data information after the change is (1, 1, 1). By comparison, it can be known that if the first field in T2 is the same after the change and before the change, it means that the field has not changed, and if the second and third fields are different after the change and before the change, it means that the second and third fields have changed. Therefore, the second and third fields can be determined as the target fields.

[0081] Specifically, the target field can also be determined by comparing the version numbers of each field in the transaction corresponding to T2 with the version numbers of each field in the transaction corresponding to T1 (i.e., the previous transaction adjacent to T2). If a field is changed at T2, the corresponding field version number will also be updated based on T1. For example, at T1, the version numbers of each field are (001, 000, 000), and at T2, the version numbers of each field are (001, 001, 001). By comparison, it can be seen that the version number of the first field is the same at T2 as at T1, indicating that the field has not changed, and the version numbers of the second and third fields are different at T2 from those at T1, indicating that the second and third fields have changed. Therefore, the second and third fields can be determined as the target fields.

[0082] This embodiment takes the field type as a numeric type as an example. After the target field is determined through the above steps, the change value of the target field in the target transaction is further obtained. For the second and third fields (i.e., the target fields) in Table 1, the change values ​​of each field can be obtained respectively, that is, the value of each field after the change is subtracted from the value before the change, so as to obtain the change value of the corresponding field. For example, for the second field, in T2, its value after the change is 1, and its value before the change is 0, then its corresponding change value is (1-0). Similarly, for the third field, in T2, its value after the change is also 1, and its value before the change is 0, then its corresponding change value is also (1-0).

[0083] Then, the difference between the field data and the changed value in the latest transaction corresponding to the target field is calculated. From Table 1, it can be determined that the latest transaction corresponding to it is T4. For the second field, the difference between the latest value corresponding to T4 (i.e., the changed value in T4) and the changed value of the above corresponding field is calculated, i.e., (5-1), so as to obtain the value after the second field is rolled back. Similarly, for the third field, the difference between the latest value corresponding to T4 and the changed value of the above corresponding field is calculated, i.e., (3-1), so as to obtain the value after the second field is rolled back. The second and third fields are reassigned, and the new values ​​of the second and third fields after the rollback process are f2`=5-1, f3`=3-1. Therefore, the new data values ​​obtained after the rollback process of T2 are (1, 4, 2).

[0084] Then, the corresponding data change record is generated according to the rolled-back data values ​​corresponding to all target fields in the target transaction T2, and the corresponding serial number is generated for the record, and the relevant change information is recorded in the book. At the same time, relevant records should also be added to the account deletion record table to facilitate the subsequent processing of other data.

[0085] In the above embodiment, when performing account erasure, it is not necessary to perform account erasure on a transaction-by-transaction basis, but only the latest record and the transaction record to be erased need to be compared, thereby greatly improving the processing efficiency of account erasure.

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

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

[0088] In one embodiment, Figure 4 As shown, a transaction rollback device is provided, comprising: a request receiving module 402, a target field determining module 404, a data acquiring module 406 and a rollback processing module 408, wherein:

[0089] The request receiving module 402 is used to receive a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of the transaction to be rolled back;

[0090] A target field determination module 404 is used to determine a target field in the target transaction when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, wherein the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0091] A data acquisition module 406 is used to acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0092] The rollback processing module 408 is used to roll back the target transaction according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0093] In one embodiment, the field type includes a numeric type; the rollback processing module is specifically used to: when the field type of the target field is a numeric type, obtain the change value of the target field in the target transaction; calculate the difference between the field data of the target field corresponding to the latest transaction and the change value; and update the target data corresponding to the target field according to the difference.

[0094] In one embodiment, the field type includes a parameter type; the rollback processing module is specifically used to: when the field type of the target field is a parameter type, use the field data of the target field corresponding to the latest transaction as the target data corresponding to the target field.

[0095] In one embodiment, the device also includes a target transaction determination module, which is used to query a data change record table according to the transaction identifier, wherein the data change record table records a number of data change records; when a data change record matching the transaction identifier is queried, it is determined whether the transaction to be rolled back is the last record in the matching data change records; when it is determined that the transaction to be rolled back is not the last record, the transaction to be rolled back is determined to be the target transaction.

[0096] In one embodiment, the rollback processing module is further specifically used for: when it is determined that the transaction to be rolled back is the last record, obtaining the data change type corresponding to the transaction to be rolled back; generating a corresponding rollback statement according to the data change type, and rolling back the transaction to be rolled back based on the rollback statement.

[0097] In one embodiment, the target transaction determination module is further specifically used to: before querying the data change record table according to the transaction identifier, query the account deletion record table based on the transaction identifier, and the account deletion record table records several account deletion records; when no account deletion record matching the transaction identifier is queried, query the data change record table according to the transaction identifier.

[0098] In one embodiment, the device also includes an update module for generating an erasure record for the target transaction in the erasure record table based on the rollback of the target transaction, wherein the erasure record includes at least a transaction identifier of the target transaction; and generating a data change record for the target transaction in the data change record table, wherein the data change record includes at least a transaction identifier of the target transaction and a version identifier of the record.

[0099] In one embodiment, the target transaction determination module is specifically used to: obtain the version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determine that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, determine that the transaction to be rolled back is not the last record; or, obtain the transaction time of the transaction to be rolled back, and when the transaction time is the same as the latest transaction time in the matching data change record, determine that the transaction to be rolled back is the last record; when the transaction time is different from the latest transaction time in the matching data change record, determine that the transaction to be rolled back is not the last record.

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

[0101] 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 5 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store transaction data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a transaction rollback method is implemented.

[0102] Those skilled in the art will understand that Figure 5 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.

[0103] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:

[0104] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0105] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0106] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0107] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0108] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the field type of the target field is numeric, obtaining the change value of the target field in the target transaction; calculating the difference between the field data of the target field corresponding to the latest transaction and the change value; and updating the target data corresponding to the target field according to the difference.

[0109] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when the field type of the target field is parameter type, the field data corresponding to the target field in the latest transaction is used as the target data corresponding to the target field.

[0110] In one embodiment, when the processor executes the computer program, the following steps are also implemented: querying a data change record table according to the transaction identifier, wherein a plurality of data change records are recorded in the data change record table; when a data change record matching the transaction identifier is queried, determining whether the transaction to be rolled back is the last record in the matching data change records; when it is determined that the transaction to be rolled back is not the last record, determining that the transaction to be rolled back is the target transaction.

[0111] In one embodiment, when the processor executes the computer program, the following steps are also implemented: when it is determined that the transaction to be rolled back is the last record, the data change type corresponding to the transaction to be rolled back is obtained; a corresponding rollback statement is generated according to the data change type, and the transaction to be rolled back is rolled back based on the rollback statement.

[0112] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the transaction identifier, the deletion record table is queried, and a number of deletion records are recorded in the deletion record table; when no deletion record matching the transaction identifier is queried, the data change record table is queried according to the transaction identifier.

[0113] In one embodiment, when the processor executes the computer program, the following steps are also implemented: based on the rollback of the target transaction, an erasure record of the target transaction is generated in the erasure record table, wherein the erasure record includes at least a transaction identifier of the target transaction; and a data change record of the target transaction is generated in the data change record table, wherein the data change record includes at least a transaction identifier of the target transaction and a version identifier of the record.

[0114] In one embodiment, when the processor executes the computer program, the following steps are also implemented: obtaining the version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is not the last record; or obtaining the transaction time of the transaction to be rolled back, and when the transaction time is the same as the latest transaction time in the matching data change record, determining that the transaction to be rolled back is the last record; when the transaction time is different from the latest transaction time in the matching data change record, determining that the transaction to be rolled back is not the last record.

[0115] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0116] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0117] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0118] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0119] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0120] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the field type of the target field is numeric, obtaining the change value of the target field in the target transaction; calculating the difference between the field data of the target field corresponding to the latest transaction and the change value; and updating the target data corresponding to the target field according to the difference.

[0121] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the field type of the target field is parameter type, the field data corresponding to the target field in the latest transaction is used as the target data corresponding to the target field.

[0122] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: querying a data change record table according to the transaction identifier, wherein a plurality of data change records are recorded in the data change record table; when a data change record matching the transaction identifier is queried, determining whether the transaction to be rolled back is the last record in the matching data change records; when it is determined that the transaction to be rolled back is not the last record, determining that the transaction to be rolled back is the target transaction.

[0123] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: when it is determined that the transaction to be rolled back is the last record, obtaining the data change type corresponding to the transaction to be rolled back; generating a corresponding rollback statement according to the data change type, and rolling back the transaction to be rolled back based on the rollback statement.

[0124] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the transaction identifier, the deletion record table is queried, and a number of deletion records are recorded in the deletion record table; when no deletion record matching the transaction identifier is queried, the data change record table is queried according to the transaction identifier.

[0125] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the rollback of the target transaction, an erasure record for the target transaction is generated in the erasure record table, wherein the erasure record includes at least a transaction identifier of the target transaction; and a data change record for the target transaction is generated in the data change record table, wherein the data change record includes at least a transaction identifier of the target transaction and a version identifier of the record.

[0126] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is not the last record; or obtaining the transaction time of the transaction to be rolled back, and when the transaction time is the same as the latest transaction time in the matching data change record, determining that the transaction to be rolled back is the last record; when the transaction time is different from the latest transaction time in the matching data change record, determining that the transaction to be rolled back is not the last record.

[0127] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:

[0128] receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;

[0129] When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, where the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction;

[0130] Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction;

[0131] The target transaction is rolled back according to the field type of the target field and the field data in the latest transaction corresponding to the target field.

[0132] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the field type of the target field is numeric, obtaining the change value of the target field in the target transaction; calculating the difference between the field data of the target field corresponding to the latest transaction and the change value; and updating the target data corresponding to the target field according to the difference.

[0133] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: when the field type of the target field is parameter type, the field data corresponding to the target field in the latest transaction is used as the target data corresponding to the target field.

[0134] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: querying a data change record table according to the transaction identifier, wherein a plurality of data change records are recorded in the data change record table; when a data change record matching the transaction identifier is queried, determining whether the transaction to be rolled back is the last record in the matching data change records; when it is determined that the transaction to be rolled back is not the last record, determining that the transaction to be rolled back is the target transaction.

[0135] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented: when it is determined that the transaction to be rolled back is the last record, obtaining the data change type corresponding to the transaction to be rolled back; generating a corresponding rollback statement according to the data change type, and rolling back the transaction to be rolled back based on the rollback statement.

[0136] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the transaction identifier, the deletion record table is queried, and a number of deletion records are recorded in the deletion record table; when no deletion record matching the transaction identifier is queried, the data change record table is queried according to the transaction identifier.

[0137] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: based on the rollback of the target transaction, an erasure record for the target transaction is generated in the erasure record table, wherein the erasure record includes at least a transaction identifier of the target transaction; and a data change record for the target transaction is generated in the data change record table, wherein the data change record includes at least a transaction identifier of the target transaction and a version identifier of the record.

[0138] In one embodiment, when the computer program is executed by the processor, the following steps are also implemented: obtaining the version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is the last record; when the version identifier is different from the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is not the last record; or obtaining the transaction time of the transaction to be rolled back, and when the transaction time is the same as the latest transaction time in the matching data change record, determining that the transaction to be rolled back is the last record; when the transaction time is different from the latest transaction time in the matching data change record, determining that the transaction to be rolled back is not the last record.

[0139] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

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

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

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

Claims

1. A transaction rollback method, characterized in that: The method comprises: receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back; When it is determined according to the transaction identifier that the transaction to be rolled back is a target transaction, a target field in the target transaction is determined, the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction, and the target field is a field where data is changed due to the target transaction; Acquire the field type of the target field and the field data of the target field corresponding to the latest transaction; Rolling back the target transaction according to the field type of the target field and the field data of the target field corresponding to the latest transaction; The rolling back of the target transaction according to the field type of the target field and the field data of the target field corresponding to the latest transaction includes: When the field type of the target field is a numeric type, obtaining a changed value of the target field in the target transaction; calculating a difference between the field data of the target field corresponding to the latest transaction and the changed value; and updating the target data corresponding to the target field according to the difference; When the field type of the target field is parameter type, the field data corresponding to the target field in the latest transaction is used as the target data corresponding to the target field.

2. The method according to claim 1, characterized in that After receiving the transaction rollback request, the method further includes: Querying a data change record table according to the transaction identifier, wherein the data change record table records a number of data change records; When a data change record matching the transaction identifier is found, determining whether the transaction to be rolled back is the last record in the matching data change record; When it is determined that the transaction to be rolled back is not the last record, the transaction to be rolled back is determined to be a target transaction.

3. The method according to claim 2, characterized in that The method further comprises: When it is determined that the transaction to be rolled back is the last record, obtaining the data change type corresponding to the transaction to be rolled back; A corresponding rollback statement is generated according to the data change type, and the transaction to be rolled back is rolled back based on the rollback statement.

4. The method according to claim 2 or 3, characterized in that: Before querying the data change record table according to the transaction identifier, the method further includes: Based on the transaction identifier, query the account erasure record table, wherein the account erasure record table records a number of account erasure records; When no deletion record matching the transaction identifier is found, the data change record table is queried according to the transaction identifier.

5. The method according to claim 4, characterized in that After rolling back the target transaction, the method further includes: Based on the rollback of the target transaction, generating an erasure record of the target transaction in the erasure record table, wherein the erasure record at least includes a transaction identifier of the target transaction; and A data change record for the target transaction is generated in the data change record table, wherein the data change record at least includes a transaction identifier of the target transaction and a version identifier of the record.

6. The method according to claim 2 or 3, characterized in that: The step of determining whether the transaction to be rolled back is the last record in the matching data change record includes: Obtaining a version identifier of the transaction to be rolled back, and when the version identifier is the same as the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is the last record; and when the version identifier is different from the maximum version identifier in the matching data change record, determining that the transaction to be rolled back is not the last record; or, The transaction time of the transaction to be rolled back is obtained. When the transaction time is the same as the latest transaction time in the matching data change record, the transaction to be rolled back is determined to be the last record. When the transaction time is different from the latest transaction time in the matching data change record, it is determined that the transaction to be rolled back is not the last record.

7. A transaction rollback device, characterized in that: The device comprises: A request receiving module, used for receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back; a target field determination module, configured to determine a target field in the target transaction when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, wherein the target transaction is used to indicate that the transaction to be rolled back is not the latest transaction, and the target field is a field in which data is changed due to the target transaction; A data acquisition module, used to acquire the field type of the target field and the field data of the target field corresponding to the latest transaction; A rollback processing module, used for rolling back the target transaction according to the field type of the target field and the field data of the target field corresponding to the latest transaction; The rollback processing module is specifically used for: When the field type of the target field is a numeric type, obtaining a changed value of the target field in the target transaction; calculating a difference between the field data of the target field corresponding to the latest transaction and the changed value; and updating the target data corresponding to the target field according to the difference; When the field type of the target field is parameter type, the field data corresponding to the target field in the latest transaction is used as the target data corresponding to the target field.

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

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

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