Transaction processing method, device, electronic device and computer readable medium
By rushing and storing the target transaction when processing external impulses, the problem of releasing the external impulses in the prior art is solved, the system stability and performance utilization rate are improved, and the manual processing needs are reduced.
Patent Information
- Application Number
- CN202110928522.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2041-08-13
AI Technical Summary
In the prior art, when dealing with external fluctuations, the reinitiation of external fluctuations is too dependent on the reinitiation of external fluctuations, resulting in inconsistent final consistency of transaction flows, and may lead to loss of transactions and unnecessary errors, which require manual processing.
When it is determined that there is a first forward request corresponding to the target forward transaction to be stored, the target forward transaction is subject to the forward transaction according to the request, and the transaction is stored after the forward operation is completed, the problem of re-initiating dependence on external forward operation is solved.
This reduces the situation of inconsistency between the error message and transaction flow final consistency, improves system stability, reduces the number of interactions with the database, improves system performance utilization, and reduces the situation where manual confirmation and initiation of manual correction are required.
Smart Images

Figure CN113592655B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to a transaction processing method, device, electronic device and computer-readable medium. Background Art
[0002] In a distributed banking system, an external reversal is a reversal initiated by the caller from outside the system. It mostly occurs in situations such as transferring the wrong account or sending the wrong transaction. It requires the withdrawal of the previously issued positive transaction in order to roll back the positive transaction to the state before execution. When processing an external reversal, if the current transaction is being executed, the system will give priority to protecting the positive transaction and directly return the external reversal with an error. This practice is highly dependent on the subsequent re-initiation of external reversals. If the subsequent reversal is no longer initiated, the final consistency of the transaction flow record will be inconsistent. The existing reversal method is highly dependent on the re-initiation of external reversals. If there is no subsequent initiation, the transaction will be lost, and the final consistency of the transaction flow will be inconsistent, as well as unnecessary errors in the transaction process, which requires subsequent manual processing and manual reversal, wasting resources and manpower. Summary of the invention
[0003] In view of this, the embodiments of the present invention provide a transaction processing method, device, electronic device and computer-readable medium, which can solve the problem of relying heavily on external reversal re-initiation in the prior art, and the problem of final consistency inconsistency that may be caused when the reversal is not initiated, reduce the occurrence of error messages and the occurrence of final consistency inconsistency in transaction flows, and greatly improve the stability of the system; reduce the number of interactions with the database, and do not need to interact with the database multiple times, thereby improving the system performance utilization; reduce the need for manual confirmation and initiation of manual reversal, and improve the stability of the system.
[0004] To achieve the above object, according to one aspect of an embodiment of the present invention, a transaction processing method is provided, comprising:
[0005] determining a target positive transaction to be stored;
[0006] When it is determined that there is a first reversal request corresponding to the target positive transaction, reversing the target positive transaction according to the first reversal request;
[0007] After completing the reversal of the target positive transaction, the target positive transaction is stored.
[0008] Optionally, determining the target positive transaction to be stored includes: receiving a positive transaction request, the positive transaction request including the positive transaction to be executed; executing the positive transaction to be executed according to the positive transaction request; and when it is determined that the positive transaction is executed successfully, using the positive transaction to be executed as the target positive transaction to be stored.
[0009] Optionally, the method further includes: initiating a second reversal request when it is determined that the execution of the positive transaction has failed; reversing the positive transaction that has failed according to the second reversal request; and storing the positive transaction after completing the reversal of the positive transaction that has failed.
[0010] Optionally, during the process of executing the pending transaction, the method further includes: receiving the first reversal request, and saving the first reversal request.
[0011] Optionally, receiving the first correction request and saving the first correction request includes:
[0012] receiving the first correction request, and saving the first correction request in a preset correction record table to generate a first correction request record;
[0013] Determining that there is a first reversal request corresponding to the target positive transaction includes:
[0014] According to the transaction information of the target transaction, query the reversal record table;
[0015] If there is a first reversal request record corresponding to the target positive transaction in the reversal record table, it is determined that there is a first reversal request corresponding to the target positive transaction.
[0016] Optionally, receiving the first reversal request and saving the first reversal request in a preset reversal record table includes: receiving the first reversal request; obtaining the transaction status of the target transaction; if the transaction status of the target transaction is in execution, saving the first reversal request in a preset reversal record table.
[0017] Optionally, after saving the first reversal request in the preset reversal record table, the method further includes:
[0018] If the transaction status of the target transaction is found to be successful or failed within the preset query times, the transaction status of successful or failed execution is fed back;
[0019] If the transaction status of the target transaction is found to be in execution within the preset query times, execution exception information is fed back.
[0020] Optionally, the method further includes: directly storing the target positive transaction when it is determined that there is no first reversal request corresponding to the target positive transaction.
[0021] Optionally, the first reversal request includes at least a transaction serial number and a transaction code.
[0022] To achieve the above object, according to another aspect of an embodiment of the present invention, a transaction processing method is provided, comprising:
[0023] A determination module, used for determining a target positive transaction to be stored;
[0024] A first reversal module, configured to, when determining that there is a first reversal request corresponding to the target positive transaction, perform reversal processing on the target positive transaction according to the first reversal request;
[0025] The storage module is used to store the target positive transaction after completing the reversal of the target positive transaction.
[0026] Optionally, the determination module is also used to: receive a positive transaction request, the positive transaction request including a positive transaction to be executed; execute the positive transaction to be executed according to the positive transaction request; and when it is determined that the positive transaction is executed successfully, use the positive transaction to be executed as the target positive transaction to be stored.
[0027] Optionally, the device also includes a second reversal module, which is used to: initiate a second reversal request when it is determined that the positive transaction has failed to execute; and perform reversal processing on the positive transaction that has failed to execute according to the second reversal request; the storage module is also used to: store the positive transaction after completing the reversal processing of the positive transaction that has failed to execute.
[0028] Optionally, the device further includes: receiving the first correction request, and saving the first correction request.
[0029] Optionally, the receiving module is further used to: receive the first correction request, and save the first correction request in a preset correction record table to generate a first correction request record;
[0030] The first reversal module is also used to: query the reversal record table according to the transaction information of the target transaction; if there is a first reversal request record corresponding to the target transaction in the reversal record table, determine that there is a first reversal request corresponding to the target transaction.
[0031] Optionally, the receiving module is further used to: receive the first reversal request; obtain the transaction status of the target transaction; if the transaction status of the target transaction is in progress, save the first reversal request in a preset reversal record table.
[0032] Optionally, the device also includes a feedback module, which is used to: if the transaction status of the target transaction is found to be successful or failed within a preset number of queries, then the transaction status of successful or failed execution is fed back; if the transaction status of the target transaction is found to be in execution within a preset number of queries, then execution exception information is fed back.
[0033] Optionally, the storage module is further used to: directly store the target positive transaction when it is determined that there is no first reversal request corresponding to the target positive transaction.
[0034] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, there is provided an electronic device, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the transaction processing method of an embodiment of the present invention.
[0035] To achieve the above objective, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the transaction processing method of the embodiment of the present invention is implemented.
[0036] An embodiment of the above invention has the following advantages or beneficial effects: by determining that there is a first reversal request corresponding to the target positive transaction to be stored, the target positive transaction is reversed according to the first reversal request; after completing the reversal of the target positive transaction, the technical means of storing the target positive transaction solves the problem of relying heavily on external reversal to be initiated again in the prior art, and the problem of final consistency inconsistency that may be caused when the reversal is not initiated, reduces the occurrence of error messages and the occurrence of final consistency inconsistency in transaction flows, and greatly improves system stability; reduces the number of interactions with the database, and does not require multiple interactions with the database, thereby improving system performance utilization; reduces the need for manual confirmation and initiation of manual reversal, and improves system stability.
[0037] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0039] Figure 1 It is a schematic diagram of the main process of the transaction processing method according to an embodiment of the present invention;
[0040] Figure 2It is a schematic diagram of the main process of the transaction processing method according to an embodiment of the present invention;
[0041] Figure 3 is a schematic diagram of a sub-process of a transaction processing method according to an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of the main modules of the transaction processing device according to an embodiment of the present invention;
[0043] Figure 5 is a flow chart of processing a transaction by a transaction processing device according to an embodiment of the present invention;
[0044] Figure 6 is a flow chart of processing a transaction by a transaction processing device according to an embodiment of the present invention;
[0045] Figure 7 is a flow chart of processing a transaction by a transaction processing device according to an embodiment of the present invention;
[0046] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0047] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0048] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0049] The technical terms involved in the embodiments of the present invention are explained below.
[0050] Positive transaction: refers to a positive transaction logic, which is a type of transaction developed to achieve a certain business effect.
[0051] Reversal transaction: a type of transaction that has reverse logic to a positive transaction. It is a reverse transaction logic developed to eliminate the business effect achieved by a positive transaction.
[0052] Outbound call reversal: also known as external reversal, is a reversal transaction initiated externally by the caller.
[0053] Consistency: In a distributed environment, consistency means that data can be kept consistent across multiple copies. When a system performs an update operation in a data consistency state, it should ensure that the system data remains in a consistent state. In a distributed system, if all users can read the latest value of a data item after the update operation is successfully executed, then such a system is considered to have strong consistency.
[0054] Eventual consistency: It emphasizes that all data copies in the system can eventually reach a consistent state after a period of synchronization. This is a concept that is generated relative to real-time strong consistency.
[0055] Figure 1 Schematic diagram of the main process of the transaction processing method of the embodiment of the present invention. Figure 1 As shown, the method includes:
[0056] Step S101: determining a target positive transaction to be stored;
[0057] Step S102: Determine whether there is a first reversal request corresponding to the target positive transaction;
[0058] Step S103: when it is determined that there is a first reversal request corresponding to the target positive transaction, reversing the target positive transaction according to the first reversal request;
[0059] Step S104: After completing the reversal of the target positive transaction, storing the target positive transaction;
[0060] Step S105: When it is determined that there is no first reversal request corresponding to the target positive transaction, directly store the target positive transaction to be stored.
[0061] For step S101, the target positive transaction to be stored refers to a positive transaction that has been executed but not yet stored, that is, after the target positive transaction is executed and before the target positive transaction is recorded in the database, the method of this embodiment is executed.
[0062] For step S102, the reversal process can be understood as a rollback operation on the target transaction. The first reversal request is an outbound reversal request (also referred to as an external reversal request). The opposite of the outbound reversal request is the internal reversal request (i.e., the second reversal request below). The outbound reversal request is a reversal initiated autonomously by the caller from outside the system. The internal reversal is a reversal initiated autonomously from within the system. The first reversal request may be received during the execution of the target transaction. When the first reversal request is received, since the target transaction is being executed and an accurate return status of the transaction has not yet been obtained, the first reversal request is recorded first. After the execution of the transaction is completed and before the database is recorded, it is determined whether there is a first reversal request during the execution of the transaction. If so, a reversal process is performed, and the transaction is recorded in the database after the reversal process is completed. If there is no first reversal request, the transaction is directly recorded in the database.
[0063] In an optional embodiment, if a first reversal request is received after the target positive transaction is successfully executed and before it is stored, the target positive transaction is directly reversal processed according to the first external reversal request, and the positive transaction is recorded in the database after the reversal processing is completed. If the first reversal request is received after the target positive transaction fails to execute and before it is stored, the first reversal request is ignored, and the information that the positive transaction failed to execute is fed back to the initiator of the first reversal request.
[0064] The transaction processing method of the embodiment of the present invention solves the problem of the prior art that the reversal is highly dependent on the reversal to be initiated externally, and the problem of final consistency inconsistency that may be caused when the reversal is not initiated, thereby reducing the occurrence of error messages and the situation that leads to final consistency inconsistency of transaction flows, greatly improving the system stability; reducing the number of interactions with the database, eliminating the need for multiple interactions with the database, and improving the system performance utilization; reducing the need for manual confirmation and initiation of manual reversal, and improving the system stability.
[0065] Figure 2 FIG. 1 is a schematic diagram of the main process of a transaction processing method according to another embodiment of the present invention. Figure 2 As shown, the method includes:
[0066] Step S201: receiving a positive transaction request, wherein the positive transaction request includes a positive transaction to be executed;
[0067] Step S202: executing the pending positive transaction according to the positive transaction request;
[0068] Step S203: Determine the execution status of the transaction;
[0069] Step S204: when it is determined that the positive transaction is successfully executed, the positive transaction to be executed is used as the target positive transaction to be stored;
[0070] Step S205: Determine whether there is a first reversal request corresponding to the target positive transaction;
[0071] Step S206: When it is determined that there is a first reversal request corresponding to the target positive transaction, reversing the target positive transaction according to the first reversal request;
[0072] Step S207: After completing the reversal of the target positive transaction, storing the target positive transaction;
[0073] Step S208: When it is determined that there is no first reversal request corresponding to the target positive transaction, directly store the target positive transaction to be stored.
[0074] Step S209: Initiating a second reversal request when it is determined that the transaction fails to be executed;
[0075] Step S210: reversing the failed transaction according to the second reversal request;
[0076] Step S211: After completing the reversal process of the failed positive transaction, store the positive transaction.
[0077] For a positive transaction, its execution results include successful execution and failed execution. In this embodiment, for a positive transaction that has been successfully executed, before saving it, it is determined whether there is a first reversal request corresponding to it during the execution process. If so, the positive transaction is first reversal processed. After completing the reversal process of the positive transaction, save the positive transaction. For a positive transaction that has failed to execute, after the positive transaction fails to execute, a second reversal request (i.e., an internal call reversal request) for the positive transaction is automatically initiated. Then, the reversal process is performed according to the second reversal request, and the positive transaction is saved after completing the reversal process of the positive transaction. Therefore, the transaction processing method of the embodiment of the present invention solves the problem of relying heavily on external reversal to initiate again in the prior art, and the problem of final consistency inconsistency that may be caused when it is not initiated, reduces error information and the occurrence of situations that lead to final consistency inconsistency of transaction flow, and greatly improves system stability; reduces the number of interactions with the database, and does not need to interact with the database multiple times, which improves system performance utilization; reduces the need for manual confirmation and initiation of manual reversal, and improves system stability.
[0078] Figure 3 Schematic diagram of the sub-process of the transaction processing method of the embodiment of the present invention. Figure 3 The processing process after receiving the first reversal request in the embodiment of the present invention is described. Figure 3 As shown, the process includes:
[0079] Step S301: receiving a first reversal request, parsing the first reversal request, and determining a positive transaction to be reversed corresponding to the first reversal request;
[0080] Step S302: Acquire the transaction status of the transaction to be reversed;
[0081] Step S303: If the transaction status of the transaction to be reversed is in progress, the first reversal request is saved in a preset reversal record table;
[0082] Step S304: If the transaction status of the transaction to be reversed is successful, performing a reversal process according to the first reversal request;
[0083] Step S305: If the transaction status of the transaction to be reversed is execution failure, feedback of transaction failure information is sent to the initiator of the first reverse request.
[0084] In this embodiment, the first reversal request may include the transaction serial number and transaction code of the current transaction to be reversed. The transaction code is used to ensure the safety of the current transaction. If the first reversal request is received, the transaction serial number of the current transaction to be reversed is determined. The transaction status of the current transaction to be reversed is determined based on the transaction serial number:
[0085] If it is determined that the transaction status of the transaction to be reversed is in execution, the first reversal request is saved in a preset reversal record table. Then, the execution of the transaction to be reversed is waited for to be completed. If the transaction to be reversed is successfully executed, it is determined whether there is a corresponding first reversal request in the preset reversal record table. If so, the transaction to be reversed is reversed. After the reversal of the transaction to be reversed is completed, the transaction information of the transaction to be reversed is saved in a database;
[0086] If it is determined that the transaction status of the transaction to be reversed is successfully executed, the transaction to be reversed is reversed according to the first reversal request;
[0087] If it is determined that the transaction status of the current transaction to be reversed is execution failure, transaction failure information is fed back to the initiator of the first reverse request.
[0088] The transaction processing method of the above embodiment is described below by way of example: Assume that there are currently three active transactions, namely active transaction A, active transaction B, and active transaction C.
[0089] If the first reversal request corresponding to the positive transaction A is received, the transaction status of the positive transaction A is obtained. If the transaction status of the positive transaction A is obtained as being executed, the first reversal request is saved in the preset reversal request record table. When the first reversal request is saved, the positive transaction A is still being executed. After the execution of the positive transaction A is completed, if the execution result of the positive transaction A is successful, it is determined whether there is a corresponding first reversal request in the preset reversal request record table. If so, the positive transaction A is reversal processed. After the reversal process of the positive transaction A is completed, the transaction information of the positive transaction A is saved in the database.
[0090] If the first reversal request corresponding to the active transaction B is received, the transaction status of the active transaction B is obtained. If the transaction status of the active transaction B is obtained as successful execution, the active transaction B is reversal processed according to the first reversal request.
[0091] If the first reversal request corresponding to the active transaction C is received, the transaction status of the active transaction C is obtained. If the transaction status of the active transaction C is obtained as execution failure, transaction failure information is fed back to the initiator of the first reversal request.
[0092] The transaction processing method of the embodiment of the present invention records the first reversal request received during the execution of the main transaction, and determines whether there is a corresponding first reversal request after the main transaction is successfully executed and before it is saved. If so, the main transaction is reversal processed. After completing the reversal process of the main transaction, the transaction information of the main transaction is saved in the database, which solves the problem of relying heavily on external reversal to be initiated again in the prior art, and the problem of final consistency inconsistency that may be caused when it is not initiated, reduces error messages and the occurrence of inconsistencies in the final consistency of transaction flows, greatly improves system stability; reduces the number of interactions with the database, does not need to interact with the database multiple times, and improves system performance utilization; reduces the need for manual confirmation and initiation of manual reversal, and improves system stability.
[0093] In an optional embodiment, after determining that the transaction status of the ongoing transaction is in execution, the method may also cyclically query the transaction status of the ongoing transaction. If the transaction status of the target ongoing transaction is found to be successful or failed within a preset number of queries, the transaction status of successful or failed execution is fed back; if the transaction status of the target ongoing transaction is found to be in execution within a preset number of queries, execution exception information is fed back.
[0094] Figure 4 4 is a schematic diagram of the main modules of the transaction processing device 400 according to an embodiment of the present invention. Figure 4 As shown, the transaction processing device 400 includes:
[0095] A determination module 401, used to determine a target positive transaction to be stored;
[0096] A first reversal module 402 is configured to, when determining that there is a first reversal request corresponding to the target positive transaction, perform reversal processing on the target positive transaction according to the first reversal request;
[0097] The storage module 403 is used to store the target positive transaction after completing the reversal of the target positive transaction.
[0098] Optionally, the determination module is also used to: receive a positive transaction request, the positive transaction request including a positive transaction to be executed; execute the positive transaction to be executed according to the positive transaction request; and when it is determined that the positive transaction is executed successfully, use the positive transaction to be executed as the target positive transaction to be stored.
[0099] Optionally, the device also includes a second reversal module, which is used to: initiate a second reversal request when it is determined that the positive transaction has failed to execute; and perform reversal processing on the positive transaction that has failed to execute according to the second reversal request; the storage module is also used to: store the positive transaction after completing the reversal processing of the positive transaction that has failed to execute.
[0100] Optionally, the device further includes: receiving the first correction request, and saving the first correction request.
[0101] Optionally, the receiving module is further used to: receive the first correction request, and save the first correction request in a preset correction record table to generate a first correction request record;
[0102] The first reversal module is also used to: query the reversal record table according to the transaction information of the target transaction; if there is a first reversal request record corresponding to the target transaction in the reversal record table, determine that there is a first reversal request corresponding to the target transaction.
[0103] Optionally, the receiving module is further used to: receive the first reversal request; determine the transaction status of the target transaction; if it is determined that the transaction status of the target transaction is in execution, save the first reversal request in a preset reversal record table.
[0104] Optionally, the device also includes a feedback module, which is used to: if the transaction status of the target transaction is found to be successful or failed within a preset number of queries, then the transaction status of successful or failed execution is fed back; if the transaction status of the target transaction is found to be in execution within a preset number of queries, then execution exception information is fed back.
[0105] Optionally, the storage module is further used to: directly store the target positive transaction when it is determined that there is no first reversal request corresponding to the target positive transaction.
[0106] The transaction processing device of the embodiment of the present invention, by determining that there is a first reversal request corresponding to the target positive transaction to be stored, reversing the target positive transaction according to the first reversal request; after completing the reversal of the target positive transaction, the technical means of storing the target positive transaction solves the problem of the prior art that it is very dependent on external reversal to be initiated again, and the problem of final consistency inconsistency that may be caused when the reversal is not initiated, reduces the occurrence of error information and the occurrence of final consistency inconsistency of transaction flow, greatly improves system stability; reduces the number of interactions with the database, does not need to interact with the database multiple times, and improves system performance utilization; reduces the need for manual confirmation and initiation of manual reversal, and improves system stability.
[0107] The above device can execute the method provided by the embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by the embodiment of the present invention.
[0108] Figure 5 This is a flow chart of a transaction processed by a transaction processing device according to an embodiment of the present invention. Figure 5 As shown, when a positive transaction is initiated by the caller to the transaction processing device, the transaction processing device will parse it, and send the transaction to each component or microservice deployment unit through an outbound call / inbound call, and wait for the execution and return of the positive transaction. If the caller initiates an external reversal when the positive transaction is being executed, at this time, since the positive transaction is still in the execution process, the transaction processing device has not yet obtained an accurate return status of the positive transaction, so the external reversal is first recorded. After the execution of the positive transaction is completed and before recording the flow library table, it is determined whether there is an external reversal (i.e., the first reversal request) during the execution of the positive transaction. If so, the reversal process is performed. After the reversal process is completed, the positive transaction is recorded in the database. If there is no external reversal, the positive transaction is directly recorded in the flow library table.
[0109] Figure 6 This is a flow chart of a transaction processed by a transaction processing device according to an embodiment of the present invention. Figure 6As shown, in the processing of external reversal, the caller initiates an external reversal to the transaction processing device. After receiving it, the transaction processing device will first parse the transaction, analyze it as an external reversal, and then obtain the transaction status of the corresponding transaction. If the transaction has been completed, the reversal will be performed. On the contrary, if the transaction is in progress, the external reversal will be recorded, and then the state of the transaction will be queried in a loop. If the transaction status of the transaction is clear, such as successful or failed execution, the transaction status of the transaction will be returned to the caller. If the state of the transaction is not found after the maximum number of loop queries, an error message will be returned. In the subsequent processing of the transaction, before the transaction flow is put into storage (updating the flow table), a query and judgment is made on whether there is an external reversal. If there is, the reversal is processed and then the storage action is performed. If there is no external reversal during the execution of the transaction, the storage action is performed directly. In this way, the final consistency of the transaction flow can be guaranteed.
[0110] Figure 7 This is a flow chart of a transaction processed by a transaction processing device according to an embodiment of the present invention. Figure 7 As shown, in the processing of the positive transaction, the positive transaction is sent by the caller to the transaction processing device. After parsing the message, it is sent to the corresponding microservice or component through internal and external calls to execute the transaction. After the transaction is executed, it returns to the transaction processing device. The transaction processing device will judge the positive transaction before the final storage action. If the positive transaction fails to execute, the subsequent transaction processing device will automatically initiate a correction of the transaction without the need for external correction, so the positive transaction is directly stored in the warehouse at this time. If the positive transaction is successfully executed, it is determined whether there is an external correction initiation during the execution process. If so, the correction process is performed to roll back the positive transaction, and then the storage operation is performed. In this way, the final consistency of the positive transaction can be guaranteed without the external correction being initiated again, eliminating unnecessary errors and the time and efficiency of subsequent manual processing, greatly improving the system's self-rotation.
[0111] Figure 8 An exemplary system architecture 800 is shown to which an information processing method or an information processing device according to an embodiment of the present invention can be applied.
[0112] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0113] Users can use terminal devices 801, 802, and 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0114] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0115] The server 805 may be a server that provides various services, such as a backend management server that provides support for shopping websites browsed by users using the terminal devices 801, 802, and 803. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information and product information) to the terminal device.
[0116] It should be noted that the information processing method provided in the embodiment of the present invention is generally executed by the server 805 , and accordingly, the information processing device is generally arranged in the server 805 .
[0117] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0118] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0119] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0120] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.
[0121] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.
[0122] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0123] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0124] The modules involved in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be set in a processor. For example, they may be described as: a processor includes a sending module, an acquisition module, a determination module, and a first processing module. The names of these modules do not, in some cases, constitute a limitation on the unit itself. For example, the sending module may also be described as a "module for sending a picture acquisition request to the connected server."
[0125] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes:
[0126] determining a target positive transaction to be stored;
[0127] When it is determined that there is a first reversal request corresponding to the target positive transaction, reversing the target positive transaction according to the first reversal request;
[0128] After completing the reversal of the target positive transaction, the target positive transaction is stored.
[0129] The technical solution of the embodiment of the present invention solves the problem of the prior art that external reversal is highly dependent on re-initiation, and the problem of final consistency inconsistency that may be caused when the reversal is not initiated, reduces the occurrence of error messages and situations that lead to final consistency inconsistency in transaction flows, and greatly improves system stability; reduces the number of interactions with the database, eliminating the need for multiple interactions with the database, and improves system performance utilization; reduces the need for manual confirmation and initiation of manual reversal, and improves system stability.
[0130] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A transaction processing method, characterized in that: include: determining a target positive transaction to be stored; When it is determined that there is a first reversal request corresponding to the target positive transaction, reversing the target positive transaction according to the first reversal request; After completing the reversal of the target positive transaction, storing the target positive transaction; The method further includes: receiving the first reversal request, obtaining the transaction status of the target ongoing transaction; if the transaction status of the target ongoing transaction is in progress, saving the first reversal request in a preset reversal record table; Determining whether there is a first reversal request corresponding to the target positive transaction includes: querying the reversal record table according to the transaction information of the target positive transaction; if there is a first reversal request record corresponding to the target positive transaction in the reversal record table, determining that there is a first reversal request corresponding to the target positive transaction.
2. The method according to claim 1, characterized in that Determining the target positive transactions to be stored includes: receiving a positive transaction request, wherein the positive transaction request includes a positive transaction to be executed; Executing the pending positive transaction according to the positive transaction request; When it is determined that the positive transaction is successfully executed, the positive transaction to be executed is used as the target positive transaction to be stored.
3. The method according to claim 2, characterized in that The method further comprises: In the case where it is determined that the execution of the positive transaction fails, initiating a second reversal request; Reversing the failed transaction according to the second reversal request; After completing the reversal process of the failed positive transaction, the positive transaction is stored.
4. The method according to claim 1, characterized in that: After saving the first reversal request in the preset reversal record table, the method further includes: If the transaction status of the target transaction is found to be successful or failed within the preset query times, the transaction status of successful or failed execution is fed back; If the transaction status of the target transaction is found to be in execution within the preset query times, execution exception information is fed back.
5. The method according to any one of claims 1 to 4, characterized in that: The method further includes: directly storing the target positive transaction when it is determined that there is no first reversal request corresponding to the target positive transaction.
6. The method according to claim 1, characterized in that The first recharge request at least includes a transaction serial number and a transaction code.
7. A transaction processing device, characterized in that: include: A determination module, used for determining a target positive transaction to be stored; A first reversal module, configured to, when determining that there is a first reversal request corresponding to the target positive transaction, perform reversal processing on the target positive transaction according to the first reversal request; A storage module, used for storing the target positive transaction after completing the reversal of the target positive transaction; A receiving module, configured to receive the first reversal request and obtain the transaction status of the target transaction in progress; if the transaction status of the target transaction in progress is in progress, the first reversal request is saved in a preset reversal record table; The first reversal module is also used to: query the reversal record table according to the transaction information of the target transaction; if there is a first reversal request record corresponding to the target transaction in the reversal record table, determine that there is a first reversal request corresponding to the target transaction.
8. The device according to claim 7, characterized in that The determining module is also used for: receiving a positive transaction request, wherein the positive transaction request includes a positive transaction to be executed; Executing the pending positive transaction according to the positive transaction request; When it is determined that the positive transaction is successfully executed, the positive transaction to be executed is used as the target positive transaction to be stored.
9. The device according to claim 8, characterized in that The device also includes a second correction module, which is used for: In the case where it is determined that the execution of the positive transaction fails, initiating a second reversal request; Reversing the failed transaction according to the second reversal request; The storage module is also used to store the positive transaction after completing the reversal process of the positive transaction that failed to execute.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Information storage method and apparatus for block chain
CN109447635A
A reversal transaction processing method, device and equipment and a storage medium
CN113159960A