CN114237977A - Transaction rollback method, device, computer equipment and storage medium - Google Patents

Transaction rollback method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN114237977A
CN114237977A CN202111324309.2A CN202111324309A CN114237977A CN 114237977 A CN114237977 A CN 114237977A CN 202111324309 A CN202111324309 A CN 202111324309A CN 114237977 A CN114237977 A CN 114237977A
Authority
CN
China
Prior art keywords
transaction
target
field
data
rolled back
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111324309.2A
Other languages
Chinese (zh)
Inventor
古毅伟
李龙
吴德柱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Pudong Development Bank Co Ltd
Original Assignee
Shanghai Pudong Development Bank Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Pudong Development Bank Co Ltd filed Critical Shanghai Pudong Development Bank Co Ltd
Priority to CN202111324309.2A priority Critical patent/CN114237977A/en
Publication of CN114237977A publication Critical patent/CN114237977A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1415Saving, restoring, recovering or retrying at system level
    • G06F11/1438Restarting or rejuvenating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The present application relates to a transaction rollback method, apparatus, computer device, storage medium and computer program product. The method comprises the steps of receiving a transaction rollback request, determining whether a transaction to be rolled back is a target transaction according to a transaction identifier carried in the transaction rollback request, further determining a target field in the transaction to be rolled back when the transaction to be rolled back is determined to be the target transaction, obtaining a field type of the target field and field data of the target field corresponding to the latest transaction, and rolling back the transaction to be 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 application is not the latest transaction, the rollback processing of the pen-cut transaction is realized.

Description

Transaction rollback method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a transaction rollback method, apparatus, computer device, storage medium, and computer program product.
Background
Transaction rollback refers to the act of requiring data to be restored to the correct state prior to the erroneous transaction based on the erroneous transaction resulting from the error such that the data results lack a reference value.
In a conventional transaction management system, data recovery is generally performed by means of an account erasing manner, that is, a transaction opposite to an error transaction is initiated to correct the error transaction, and the related error transaction is erased in an accounting flow and a register, so that data is correct.
However, the existing reconciliation method can only correct the newly generated transaction, i.e. the transaction needing to be corrected must be the last transaction to be billed. For the transaction with different strokes, namely when the new transaction modifies the data of the transaction to be erased, the problem is difficult to be solved well, and the execution efficiency is not high.
Disclosure of Invention
In view of the above, it is necessary to provide a transaction rollback method, apparatus, computer device, computer readable storage medium and computer program product capable of implementing pen-through rollback in response to the above technical problems.
In a first aspect, the present application provides a transaction rollback method. The method comprises the following steps:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In one embodiment, the field type comprises a numeric type; the 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 comprises the following steps: when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference.
In one embodiment, the field type comprises a parameter type; the 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 comprises the following steps: and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
In one embodiment, after receiving the transaction rollback request, the method further comprises: inquiring 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 the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records; and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
In one embodiment, the method further comprises: when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back; and 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.
In one embodiment, before querying the data change record table according to the transaction identifier, the method further includes: inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table; and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
In one embodiment, after the rolling back the target transaction, the method further comprises: generating an account wiping record of the target transaction in the account wiping record table based on the rollback of the target transaction, wherein the account wiping record at least comprises a transaction identifier of the target transaction; and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
In one embodiment, the determining whether the transaction to be rolled back is the last record in the matched data change records includes: acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; or acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
In a second aspect, the present application further provides a transaction rollback apparatus. The device comprises:
the request receiving module is used for receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
the target field determining module is used for determining a target field in the target transaction when the transaction to be rolled back is determined to be the target transaction according to the transaction identification, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
the data acquisition module is used for acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and the rollback processing module is 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.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the following steps when executing the computer program:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In a fifth aspect, the present application further provides a computer program product. The computer program product comprising a computer program which when executed by a processor performs the steps of:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
According to the transaction rollback method, the transaction rollback device, the computer equipment, the storage medium and the computer program product, the transaction rollback request is received, whether the transaction to be rolled back is the target transaction is determined according to the transaction identification carried in the transaction rollback request, when the transaction to be rolled back is determined to be the target transaction, the target field in the transaction to be rolled back is further determined, the field type of the target field and the field data of the target field corresponding to the latest transaction are obtained, and 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 application is not the latest transaction, the rollback processing of the pen-cut transaction is realized.
Drawings
FIG. 1 is a diagram of an application environment for a transaction rollback method in one embodiment;
FIG. 2 is a flow diagram that illustrates a transaction rollback method, according to one embodiment;
FIG. 3 is a schematic flow chart diagram illustrating a transaction rollback method in another embodiment;
FIG. 4 is a block diagram of the architecture of a transaction rollback apparatus in one embodiment;
FIG. 5 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The transaction rollback method provided by the embodiment of the application can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104, or may be located on the cloud or other network server. Specifically, when a user has a transaction rollback requirement, a corresponding transaction rollback request may be initiated to the server 104 through the terminal 102, the server 104 determines whether a transaction to be rolled back is a target transaction according to a transaction identifier carried in the transaction rollback request, further determines a target field in the target transaction when it is determined that the transaction to be rolled back is the target transaction, and obtains a field type of the target field and field data in the latest transaction corresponding to the target field, and rolls 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, thereby implementing a rollback process for an alternate transaction. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices and portable wearable devices, and the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart car-mounted devices, and the like. The portable wearable device can be a smart watch, a smart bracelet, a head-mounted device, and the like. The server 104 may be implemented as a stand-alone server or as a server cluster comprised of multiple servers.
In one embodiment, as shown in fig. 2, a transaction rollback method is provided, which is exemplified by the application of the method to the server in fig. 1, and includes the following steps:
at step 202, a transaction rollback request is received.
The transaction rollback request is a request for performing rollback processing on the transaction to be rolled back, and the transaction rollback request carries a transaction identifier of the transaction to be rolled back. Specifically, the transaction identifier is a mark for distinguishing different transactions, such as a transaction serial number, and the like. The transaction to be rolled back is a transaction requiring roll back processing, wherein the transaction includes but is not limited to a transaction for inquiring balance, a transaction for withdrawing money, a transaction for transferring money, a transaction for adding or deleting various information and the like in a bank accounting system. Generally, one transaction involves data change of a plurality of database tables, and there are cases where a plurality of transactions modify and change the same data record, so when an error transaction is found, the corresponding data needs to be rolled back to recover to the state before the error transaction. Generally, for a transaction involving data changes of a plurality of database tables, correlation can be performed based on transaction identifiers so as to roll back data of each database table. For the case that multiple transactions modify and change the same data record, the transactions and the data may be associated through primary key information, where the primary key information refers to an object (i.e., data) of the transaction change, and generally includes a primary key field and a primary key value, such as a user identifier (ue), AA. Therefore, for the transaction causing the data under the same user identification to be changed, the association can be carried out based on the user identification, and each transaction has the own transaction identification. The present embodiment will be described mainly with respect to a rollback process performed on a target transaction among a plurality of transactions in which the same data is changed.
In this embodiment, when a user has a transaction rollback requirement, that is, when the user finds that a certain transaction has an error and needs to repair data, a corresponding transaction rollback request may be initiated to the server through the terminal, and a transaction identifier corresponding to a transaction to be rolled back is carried in the transaction rollback request, and the server may receive the corresponding transaction rollback request and perform transaction rollback processing through subsequent steps.
And step 204, when the transaction to be rolled back is determined to be the target transaction according to the transaction identification, determining a target field in the target transaction.
The target transaction is used for representing that the transaction to be rolled back is not the latest transaction, namely not the last transaction causing a certain data change. The target field refers to the field where the target transaction results in a data change. Specifically, each transaction is generated, a corresponding transaction identifier and transaction time are generated, and the transactions are associated by the main key, so that all transaction records under the same main key can be obtained based on the main key information recorded in the transaction to be rolled back, and then the transaction identifier of the transaction to be rolled back and the transaction identifier of the transaction to be posted last are compared, or the corresponding transaction time is determined based on the transaction identifier of the transaction to be rolled back, and the transaction time is compared with the transaction time of the transaction to be posted last, so that whether the transaction to be rolled back is the transaction to be posted last is judged. For example, if the transaction identifier of the transaction to be rolled back is consistent with the transaction identifier of the transaction to be posted last, it indicates that the transaction to be rolled back is the latest transaction and thus is not the target transaction, otherwise, if the transaction identifier of the transaction to be rolled back is different from the transaction identifier of the transaction to be posted last, it indicates that the transaction to be rolled back is not the transaction to be posted last, and thus it can be determined that the transaction to be rolled back is the target transaction.
Further, according to the transaction related data of the target transaction, a corresponding target field, that is, a field in which data change is caused by the target transaction, may be determined. Specifically, the transaction related data includes, but is not limited to, data corresponding to each field before transaction change, data corresponding to each field after transaction change, and version identification of each field. For example, when the changed data corresponding to a certain field in the target transaction is different from the data before the change, it indicates that the data of the field is changed, that is, the target field, whereas if the changed data corresponding to a certain field in the target transaction is the same as the data before the change, it indicates that the data of the field is not changed, and it is not the target field; or when the version identification of a certain field in the target transaction is different from the version identification of the corresponding field in the previous transaction adjacent to the certain field in the target transaction, the field is indicated as the target field, otherwise, the field is not the target field.
At step 206, the field type of the target field and the field data corresponding to the target field in the latest transaction are obtained.
The field type refers to the type of data recorded by the field, and includes a numerical type, a parameter type, a status type, and the like. For example, for numerical types, numerical data including, but not limited to, monetary amount, number of strokes, etc.; for the status type, including but not limited to various status data, such as the status of a bank account may include not open, not active, frozen, loss of credit, normal, account-committed, etc.; for the parameter type, it is common to configure data of the parameter type, such as organization address, user personal information, and the like. The target field corresponds to field data in the latest transaction, and refers to the latest data of the field at the current rollback processing time, which can be obtained according to the original data record or the data change record. In this embodiment, based on the determined target transaction and the target field in the target transaction, the field type of the target field and the field data of the target field corresponding to the latest transaction may be further obtained.
At step 208, 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, since the present application is directed to the rollback of the transaction between pens, that is, the transaction requiring the rollback is not the last transaction to be posted, for the status type field, since the latest transaction may have changed the status data of the corresponding field, for example, the latest transaction has updated the status from normal to an account, and if the target transaction requires the rollback, the status is updated from an account open inactive to normal, since the final status is also an account, it is meaningless for the rollback, and therefore, the status type field is not processed in the present embodiment. And for the numerical field and the parameter field, the target field 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, so that the target transaction is rolled back.
In the transaction rollback method, a transaction rollback request is received, whether a transaction to be rolled back is a target transaction is determined according to a transaction identifier carried in the transaction rollback request, when the transaction to be rolled back is determined to be the target transaction, a target field in the transaction to be rolled back is further determined, a field type of the target field and 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 application is not the latest transaction, the rollback processing of the pen-cut transaction is realized.
In one embodiment, for example, when the field type is 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 determined to be a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference value. The change value is 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. And calculating the difference value between the field data and the change value of the target field corresponding to the latest transaction, and taking the calculated difference value as the target data corresponding to the target field to restore the data to the correct state before the error transaction, thereby realizing the rollback processing of the numerical data.
In an embodiment, when the field type is a parameter 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, which may specifically include: and when the field type of the target field is the parameter type, taking the field data of the target field corresponding to the latest transaction as the target data corresponding to the target field. Because the parameter type field is usually a parameter configuration type field, such as organization address, user personal information, etc., if the target transaction sets the address 0 corresponding to the organization number as the address 1, and the latest transaction sets the address corresponding to the organization number as the address 2, at this time, if the target transaction is rolled back, the change is not needed to be concerned, and only the target address (namely target data) needs to be set as the latest address 2, thereby realizing the roll-back processing of the parameter type field.
In one embodiment, as shown in fig. 3, after receiving the transaction rollback request, the method may further include:
step 302, query the data change record table according to the transaction identifier.
The data change record table records a plurality of data change records, and each data change record includes but is not limited to transaction identification (such as transaction serial number), table name, primary key information, change type (such as addition and deletion change), data before change, version number of each field of the data before change, data after change, version number of each field of the data after change, information such as change field list and version identification. In this embodiment, the data change record table may be queried based on the transaction identifier recorded in the transaction to be rolled back, that is, whether a data change record matching the transaction identifier exists in the data change record table is queried. Specifically, when no matching data change record is found, there is a possibility that the transaction identifier is incorrect or the corresponding transaction record does not exist, so that the rollback processing is not required. When the matched data change records are inquired, the following steps are sequentially executed.
Step 304, when the data change record matched with the transaction identifier is inquired, determining whether the transaction to be rolled back is the last record in the matched data change record.
Specifically, when a data change record matched with the transaction identifier is inquired, the primary key information corresponding to the transaction is determined, and then all transaction records under the same primary key are obtained according to the primary key information, that is, all data change records causing the data change are obtained, so that the matched data change records are obtained. It is further determined whether the transaction to be rolled back is the last record in the matching data change records.
Since each transaction is generated, a corresponding transaction identifier and transaction time are generated, in this embodiment, it may be determined whether the transaction to be rolled back is the last record in the matched data change records based on the transaction identifier and the transaction time.
For example, the transaction identifier of the transaction to be rolled back may be compared with the transaction identifier of the transaction that was last posted, and if the transaction identifier of the transaction to be rolled back is consistent with the transaction identifier of the transaction that was last posted, it indicates that the transaction to be rolled back is the last record in the matched data change record, whereas if the transaction identifier of the transaction to be rolled back is different from the transaction identifier of the transaction that was last posted, it indicates that the transaction to be rolled back is not the last record in the matched data change record.
And the transaction time of the transaction to be rolled back can be acquired, when the transaction time is the same as the latest transaction time in the matched data change record, the transaction to be rolled back is determined to be the last record, otherwise, when the transaction time is different from the latest transaction time in the matched data change record, the transaction to be rolled back is determined not to be the last record.
Of course, it may also be determined whether the transaction to be rolled back is the last record in the matched data change records according to the version identifier of the transaction to be rolled back, where the version identifier is also a mark for uniquely identifying the transaction, and is generally generated sequentially from small to large in the time dimension. For example, when the version identifier is the same as the maximum version identifier in the matched data change record, the transaction to be rolled back is determined to be the last record, and when the version identifier is different from the maximum version identifier in the matched data change record, the transaction to be rolled back is determined not to be the last record.
And step 306, when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
Specifically, when it is determined that the transaction to be rolled back is not the last record, it is determined that the transaction to be rolled back is the target transaction, that is, the target transaction is used to represent that the transaction to be rolled back is not the latest transaction, that is, after the target transaction, a new transaction modifies the corresponding data. In this embodiment, when it is determined that the transaction to be rolled back is the target transaction, the target transaction may be rolled back according to the method shown in fig. 2, so as to implement the rolling back of the transaction with alternate pens.
In one embodiment, when the transaction to be rolled back is determined to be the last record, the data change type corresponding to the transaction to be rolled back is obtained, a corresponding roll-back statement is further generated according to the data change type, and the transaction to be rolled back is rolled back based on the roll-back statement. In this embodiment, when the transaction to be rolled back is determined to be the last record, it is indicated that the transaction is the transaction that last modified the data. Therefore, the data change type corresponding to the transaction to be rolled back can be further obtained, wherein the data change type comprises a type of adding data, a type of deleting data and a type of modifying data. And then rolling back the transaction to be rolled back according to different data change types. For example, when the change type is the type of added data, the pre-change data and the pre-change version number corresponding to the transaction should be null, and therefore, the generated rollback statement should be a delete statement, that is, the data of the correspondence table is deleted, so that the data is restored to the state before the transaction to be rolled back is executed. And when the change type is the type of deleting data, the changed data and the changed version number corresponding to the transaction are null, so that the generated rollback statement is a newly added statement, namely the data of the newly added corresponding table, and the data is restored to the state before the transaction to be rolled back is executed. When the change type is the type of the modified data, the transaction correspondingly has pre-change data, post-change data, a pre-change version number and a post-change version number, so that the generated rollback statement should be an update statement, namely the data of the corresponding table is updated, the data is updated to the pre-change data, and the data is restored to the state before the transaction to be rolled back is executed.
In one embodiment, before querying the data change record table according to the transaction identifier, the method may further include: and inquiring the statement erasing table based on the transaction identifier, and when the statement erasing record matched with the transaction identifier is not inquired, inquiring the data change statement according to the transaction identifier. Wherein, a plurality of account wiping records are recorded in the account wiping record table, namely, each transaction processed by rollback is recorded. Specifically, the reconciliation record at least comprises a transaction identification of the transaction for which the rollback processing is performed. Therefore, in this embodiment, the statement of account is queried based on the transaction identifier of the transaction to be rolled back, and when the statement of account of the transaction to be rolled back is queried from the statement of account, it indicates that the transaction has been erased, that is, the roll-back processing has been performed, thereby ending the flow. And when the account wiping record of the transaction is not inquired from the account wiping record table, allowing account wiping, and further inquiring the data change record table according to the transaction identifier so as to perform next processing, thereby avoiding the occurrence of repeated account wiping and improving the accuracy of the data.
In one embodiment, after rolling back the target transaction and after rolling back the transaction to be rolled back, the method may further comprise: and generating an account wiping record for the target transaction in the account wiping record table based on the rollback of the target transaction, or generating an account wiping record for the transaction to be rolled back in the account wiping record table based on the rollback of the transaction to be rolled back. That is to say, for each transaction that is subjected to rollback processing, a corresponding reconciliation record is generated in the reconciliation record table, wherein the reconciliation record at least comprises a transaction identifier of the transaction that is subjected to reconciliation processing.
Similarly, for each transaction that is to be rolled back, the corresponding changed data needs to be updated or repaired, so for each transaction that is to be rolled back, a corresponding data change record needs to be generated in the data change record table. The data change record at least includes a transaction identifier of a transaction (i.e., the target transaction or the transaction to be rolled back) that is to be rolled back and a version identifier of the record. Therefore, detailed records are reserved for each change of the data, and rollback processing of the alternate transaction is facilitated.
In one embodiment, the scheme of the present application is further described below by a specific embodiment, in this embodiment, for all database tables, except for the fields that the table itself should possess, each change of the fields is recorded by adding the version identifier of the fields. For example, when data in a field in the table is changed, the version identifier corresponding to the field is increased by 1, so that whether the corresponding data is changed or not can be effectively judged through the version identifier of the field, and the field (namely, the target field) in which the data is changed can be quickly determined during rollback.
Meanwhile, for the change of the database involved in the transaction, the change record of each piece of data is recorded through the data change record table. For example, each transaction is identified by a serial number, such as a transaction serial number, at the time the transaction is executed, so that the data change records stored can be distinguished based on the transaction serial number. In addition, because some specific types of fields, such as status fields, cannot be processed during the interval check, the corresponding data change record may also record an identifier indicating whether the corresponding changed fields support the interval check, for example, if the changed fields are status fields, the identifier may be directly set to no, and if the changed fields are other types of fields, the identifier may be directly set to yes, so that the processing efficiency of the transaction rollback may be further improved based on the identifier.
The transaction rollback method of the present application is further illustrated by the following table 1, table 1:
Figure BDA0003346402040000121
where table 1 is the matching data change record looked up in the data change record table based on the transaction identification of the transaction to be rolled back. For example, if the transaction to be rolled back is a transaction with a transaction serial number of "T2", the corresponding data change record with the transaction serial number of "T2" may be found from the data change record table by looking up the corresponding data change record table based on the transaction identifier (such as the transaction serial number or the serial number) of the transaction, and further, it may be determined that the data to be changed is related transaction data of the user with the client number of 20 based on the primary key information in the data change record, so the data change record table may be further queried based on the primary key information (such as the client number of 20), and the data change record as shown in table 1 may be obtained.
Based on the above method for determining the target transaction, the transaction corresponding to T2 is not the last transaction that causes the change of the data of the customer number 20, and therefore, T2 can be determined as the target transaction. It is further desirable to determine the target fields in the target transaction, i.e., the fields that caused the data change in the transaction. Specifically, the determination may be made 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 before the change at T2 is (1, 0, 0), and the data information after the change is (1, 1, 1), and as can be seen from the comparison, the first field in T2 after the change is the same as the data information before the change, which indicates that the field has not been changed, and the second and third fields after the change are different from the data information before the change, which indicates that the second and third fields have been changed, so that the second and third fields can be determined to be the target fields.
Specifically, the target field may also be determined by comparing whether the version number of each field in the transaction corresponding to T2 is the same as the version number 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 is updated based on T1, for example, at T1, the version number of each field is (001, 000, 000), at T2, the version number of each field is (001, 001, 001), and it can be seen by comparison that the version number of the first field at T2 is the same as that at T1, indicating that the field is not changed, and the version numbers of the second and third fields at T2 are different from that at T1, indicating that the second and third fields are changed, so that it can be determined that the second and third fields are the target fields.
For the case that the field type is a numerical type, the present embodiment further obtains a modified value of the target field in the target transaction after the target field is determined through the above steps. For the second and third fields (i.e. target fields) in table 1, the changed value of each field can be obtained, i.e. the value after each field is changed is subtracted by the value before the change, so as to obtain the changed value of the corresponding field. For example, in the second field, if the value after the change is 1 and the value before the change is 0 in T2, the corresponding change value is (1-0), and similarly, in the third field, if the value after the change is 1 in the same manner and the value before the change is 0 in T2, the corresponding change value is (1-0).
Further, the calculation target field corresponds to the difference between the field data and the changed value in the latest transaction, and it can be determined from table 1 that the latest transaction corresponding thereto is T4, and for the second field, the difference between the latest value corresponding to T4 (i.e., the value changed in T4) and the changed value of the corresponding field, i.e., (5-1), is calculated, thereby obtaining 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 corresponding field described above, i.e., (3-1), is calculated, so as to obtain the value after rolling back the second field. And the second and third fields are reassigned, the new values of the second and third fields after the rollback processing are f2 ═ 5-1, f3 ═ 3-1, and thus the new data value obtained after the rollback processing on T2 is (1, 4, 2).
And then, corresponding data change records are generated according to the data values after rollback corresponding to all target fields in the target transaction T2, corresponding serial numbers are generated for the records, relevant change information is recorded in a book, and meanwhile, relevant records are added in an account erasing record table, so that the subsequent processing of other data is facilitated.
In the embodiment, when the account is erased at intervals, the account is erased without transaction one by one in sequence, and only the latest record and the transaction record needing the account are compared, so that the processing efficiency of the account erasing at intervals is greatly improved.
It should be understood that, although the steps in the flowcharts related to the embodiments as described above are sequentially displayed as indicated by arrows, the steps are not necessarily performed sequentially as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the flowcharts related to the embodiments described above may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the execution order of the steps or stages is not necessarily sequential, but may be rotated or alternated with other steps or at least a part of the steps or stages in other steps.
Based on the same inventive concept, the embodiment of the present application further provides a transaction rollback apparatus for implementing the above-mentioned transaction rollback method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme described in the above method, so specific limitations in one or more embodiments of the transaction rollback device provided below can be referred to the limitations of the transaction rollback method in the above description, and details are not described herein again.
In one embodiment, as shown in fig. 4, there is provided a transaction rollback apparatus comprising: a request receiving module 402, a target field determining module 404, a data obtaining module 406, and a rollback processing module 408, wherein:
a request receiving module 402, configured to receive a transaction rollback request, where the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
a target field determining module 404, configured to determine a target field in the target transaction when the transaction to be rolled back is determined to be the target transaction according to the transaction identifier, where the target transaction is used to represent that the transaction to be rolled back is not the latest transaction;
a data obtaining module 406, configured to obtain a field type of the target field and a field data of the target field corresponding to the latest transaction;
a rollback processing module 408, configured to rollback 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.
In one embodiment, the field type comprises a numeric type; the rollback processing module is specifically configured to: when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference.
In one embodiment, the field type comprises a parameter type; the rollback processing module is specifically configured to: and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
In one embodiment, the apparatus further comprises a target transaction determining module, configured to query a data change record table according to the transaction identifier, where a plurality of data change records are recorded in the data change record table; when the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records; and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
In one embodiment, the rollback processing module is further specifically configured to: when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back; and 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.
In one embodiment, the target transaction determination module is further specifically configured to: before inquiring a data change record table according to the transaction identification, inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table; and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
In one embodiment, the apparatus further includes an updating module, configured to generate an ledger record for the target transaction in the ledger record table based on rollback of the target transaction, where the ledger record at least includes a transaction identifier of the target transaction; and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
In one embodiment, the target transaction determination module is further specifically configured to: acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; or acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
The modules in the transaction rollback apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 5. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured 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 an operating system and computer programs 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 for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a transaction rollback method.
Those skilled in the art will appreciate that the architecture shown in fig. 5 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference.
In one embodiment, the processor, when executing the computer program, further performs the steps of: and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inquiring 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 the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records; and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
In one embodiment, the processor, when executing the computer program, further performs the steps of: when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back; and 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.
In one embodiment, the processor, when executing the computer program, further performs the steps of: inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table; and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
In one embodiment, the processor, when executing the computer program, further performs the steps of: generating an account wiping record of the target transaction in the account wiping record table based on the rollback of the target transaction, wherein the account wiping record at least comprises a transaction identifier of the target transaction; and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; or acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring 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 the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records; and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back; and 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.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table; and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of: generating an account wiping record of the target transaction in the account wiping record table based on the rollback of the target transaction, wherein the account wiping record at least comprises a transaction identifier of the target transaction; and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; or acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
In one embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, performs the steps of:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction; calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value; and updating the target data corresponding to the target field according to the difference.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring 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 the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records; and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
In one embodiment, the computer program when executed by the processor further performs the steps of: when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back; and 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.
In one embodiment, the computer program when executed by the processor further performs the steps of: inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table; and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of: generating an account wiping record of the target transaction in the account wiping record table based on the rollback of the target transaction, wherein the account wiping record at least comprises a transaction identifier of the target transaction; and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; or acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
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 for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high-density embedded nonvolatile Memory, resistive Random Access Memory (ReRAM), Magnetic Random Access Memory (MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (PCM), graphene Memory, and the like. Volatile Memory can include Random Access Memory (RAM), external cache Memory, and the like. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others. The databases referred to in various embodiments provided herein may include at least one of relational and non-relational databases. The non-relational database may include, but is not limited to, a block chain based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, quantum computing based data processing logic devices, etc., without limitation.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.

Claims (12)

1. A transaction rollback method, the method comprising:
receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
when the transaction to be rolled back is determined to be a target transaction according to the transaction identifier, determining a target field in the target transaction, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and 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.
2. The method of claim 1, wherein the field type comprises a numeric type; the 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 comprises the following steps:
when the field type of the target field is a numerical type, acquiring a change value of the target field in the target transaction;
calculating a difference between the field data in the target field corresponding to the latest transaction and the altered value;
and updating the target data corresponding to the target field according to the difference.
3. The method of claim 1, wherein the field type comprises a parameter type; the 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 comprises the following steps:
and when the field type of the target field is a parameter type, taking the field data in the latest transaction corresponding to the target field as the target data corresponding to the target field.
4. The method of claim 1, wherein after receiving a transaction rollback request, the method further comprises:
inquiring 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 the data change records matched with the transaction identification are inquired, determining whether the transaction to be rolled back is the last record in the matched data change records;
and when the transaction to be rolled back is determined not to be the last record, determining that the transaction to be rolled back is the target transaction.
5. The method of claim 4, further comprising:
when the transaction to be rolled back is determined to be the last record, acquiring a data change type corresponding to the transaction to be rolled back;
and 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.
6. The method of claim 4 or 5, wherein prior to querying a data change log table based on the transaction identification, the method further comprises:
inquiring an account wiping record table based on the transaction identification, wherein a plurality of account wiping records are recorded in the account wiping record table;
and when the account wiping record matched with the transaction identifier is not inquired, inquiring a data change record table according to the transaction identifier.
7. The method of claim 6, wherein after the rolling back the target transaction, the method further comprises:
generating an account wiping record of the target transaction in the account wiping record table based on the rollback of the target transaction, wherein the account wiping record at least comprises a transaction identifier of the target transaction; and the number of the first and second groups,
and generating a data change record of the target transaction in the data change record table, wherein the data change record at least comprises a transaction identifier of the target transaction and a version identifier of the record.
8. The method of claim 4 or 5, wherein the determining whether the transaction to be rolled back is the last record in the matching data change records comprises:
acquiring a version identifier of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the version identifier is the same as the maximum version identifier in the matched data change record, and determining that the transaction to be rolled back is not the last record when the version identifier is different from the maximum version identifier in the matched data change record; alternatively, the first and second electrodes may be,
and acquiring the transaction time of the transaction to be rolled back, determining that the transaction to be rolled back is the last record when the transaction time is the same as the latest transaction time in the matched data change record, and determining that the transaction to be rolled back is not the last record when the transaction time is different from the latest transaction time in the matched data change record.
9. A transaction rollback apparatus, wherein the apparatus comprises:
the request receiving module is used for receiving a transaction rollback request, wherein the transaction rollback request carries a transaction identifier of a transaction to be rolled back;
the target field determining module is used for determining a target field in the target transaction when the transaction to be rolled back is determined to be the target transaction according to the transaction identification, wherein the target transaction is used for representing that the transaction to be rolled back is not the latest transaction;
the data acquisition module is used for acquiring the field type of the target field and the field data of the target field corresponding to the latest transaction;
and the rollback processing module is 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.
10. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 8.
12. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 8 when executed by a processor.
CN202111324309.2A 2021-11-10 2021-11-10 Transaction rollback method, device, computer equipment and storage medium Pending CN114237977A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111324309.2A CN114237977A (en) 2021-11-10 2021-11-10 Transaction rollback method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111324309.2A CN114237977A (en) 2021-11-10 2021-11-10 Transaction rollback method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114237977A true CN114237977A (en) 2022-03-25

Family

ID=80748878

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111324309.2A Pending CN114237977A (en) 2021-11-10 2021-11-10 Transaction rollback method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114237977A (en)

Similar Documents

Publication Publication Date Title
CN109522315B (en) Database processing method and system
CN109785867B (en) Double-recording flow configuration method and device, computer equipment and storage medium
CN113312259A (en) Interface testing method and device
CN114237977A (en) Transaction rollback method, device, computer equipment and storage medium
CN115858471A (en) Service data change recording method, device, computer equipment and medium
CN114490415A (en) Service testing method, computer device, storage medium, and computer program product
CN113360548A (en) Data processing method, device, equipment and medium based on data asset analysis
CN111666340A (en) Synchronous data proofreading method and device based on big data and computer equipment
CN111723129A (en) Report generation method, report generation device and electronic equipment
CN115292094B (en) Data recovery processing method, device, equipment, storage medium and program product
US20240064032A1 (en) Systems and methods for managing metrics in blockchain networks
CN112612648B (en) SQL Server database recovery method, terminal equipment and storage medium
CN117291741A (en) Account data processing method, device, equipment, storage medium and program product
CN114677215A (en) Bank data processing method and device, computer equipment and storage medium
CN115495285A (en) Data backup and storage method and device, computer equipment and storage medium
CN106815289B (en) Data storage method and device in transaction processing system
CN114510492A (en) Service data processing method and device, computer equipment and storage medium
CN117785900A (en) Data updating method, device, computer equipment and storage medium
CN117495518A (en) Method, device, equipment and storage medium for managing articles of bank point system
CN117435581A (en) Index identification method, apparatus, device, storage medium, and program product
CN116578571A (en) Method, device, computer equipment and storage medium for updating guest group data
CN114493821A (en) Data verification and cancellation method and device, computer equipment and storage medium
CN116521343A (en) Resource interaction information processing method, device, computer equipment and storage medium
CN114579179A (en) Version synchronization method and device, computer equipment and storage medium
CN115983691A (en) Abnormal enterprise discrimination method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination