CN111143040A - Transaction processing method, device, system and storage medium - Google Patents

Transaction processing method, device, system and storage medium Download PDF

Info

Publication number
CN111143040A
CN111143040A CN201911394348.2A CN201911394348A CN111143040A CN 111143040 A CN111143040 A CN 111143040A CN 201911394348 A CN201911394348 A CN 201911394348A CN 111143040 A CN111143040 A CN 111143040A
Authority
CN
China
Prior art keywords
transaction
execution
request
participant nodes
participant
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.)
Withdrawn
Application number
CN201911394348.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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology 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 Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN201911394348.2A priority Critical patent/CN111143040A/en
Publication of CN111143040A publication Critical patent/CN111143040A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Abstract

The application discloses a transaction processing method, a transaction processing device, a transaction processing system and a storage medium, and belongs to the technical field of computers. The method comprises the following steps: the transaction processing system obtains a transaction processing request, the transaction processing request carries transaction information, the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation, the transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes, and the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution requests. When the transaction is processed, the method and the device are not limited by the branch transaction any more, and the branch transaction does not need to be registered, so that the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.

Description

Transaction processing method, device, system and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a transaction processing method, apparatus, system, and storage medium.
Background
A transaction may generally be divided into at least two branch transactions, with both at least two branch transactions processing completion, indicating that the transaction processing is complete. A distributed system typically includes multiple systems, and transactions across the systems are referred to as distributed transactions. With the wide application of the distributed system, how to process the distributed transaction through the distributed system becomes a problem to be solved urgently.
Currently, a distributed system includes a transaction processing system, a transaction management system, and at least two participant nodes, and a distributed transaction may be performed based on a two-phase protocol. In the first phase, the transaction processing system obtains a transaction processing request and at least two branch transaction processing requests, sends the transaction processing request and the at least two branch transaction processing requests to the transaction management system, and the transaction management system registers a global transaction according to the transaction processing request and registers at least two branch transactions according to the at least two branch transaction processing requests. In the second stage, the transaction processing system calls the participant node corresponding to each branch transaction, and the participant node executes the operation corresponding to the branch transaction.
In the method, at least two branch transactions need to be registered in the first stage, participant nodes corresponding to the at least two branch transactions need to be called in the second stage, and the process of registering and calling the branch transactions needs to consume longer time, so that the efficiency is lower and the processing performance is poorer.
Disclosure of Invention
The embodiment of the application provides a transaction processing method which can improve processing performance and processing efficiency. The technical scheme is as follows:
in one aspect, a transaction processing method is provided, which is applied in a distributed system, where the distributed system includes a transaction processing system and at least two participant nodes, and the method includes:
the transaction processing system acquires a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
the transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes;
and the at least two participant nodes execute corresponding target operation in the transaction information according to the execution request.
In one possible implementation, before the transaction processing system invokes the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes, the method further includes:
the transaction processing system calls the at least two participant nodes based on the transaction information and sends the transaction information to the at least two participant nodes;
the at least two participant nodes store the transaction information.
In one possible implementation manner, the execution request carries the transaction identifier; the at least two participant nodes execute corresponding target operations in the transaction information according to the execution request, and the target operations comprise:
the at least two participant nodes inquire transaction information comprising the transaction identification;
and determining a target operation corresponding to the node information of the local end node in the transaction information, and executing the target operation.
In one possible implementation, the distributed system further includes a transaction management system, and after the transaction processing system obtains the transaction processing request, the method further includes:
the transaction processing system sends the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier;
and the transaction management system registers the global transaction corresponding to the transaction identification according to the transaction processing request.
In one possible implementation manner, after the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution request, the method further includes:
the at least two participant nodes send the execution result of the target operation to the transaction processing system;
and the transaction processing system stores the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
In one possible implementation, the distributed system further includes a transaction management system, and the method further includes:
the transaction processing system receives a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system.
In a possible implementation manner, after the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
when the execution state is a failure state, the transaction management system sends a transaction compensation request to the transaction processing system, the transaction compensation request carries the transaction identifier, and the failure state represents that at least one target operation in the target operations of the at least two participant nodes fails to be executed;
the transaction processing system calls the participant node corresponding to the target operation with failed execution again according to the transaction compensation request, and sends the execution request to the participant node;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
In a possible implementation manner, after the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
when the execution state is a failure state, the transaction management system sends the execution request to a participant node corresponding to a target operation with failed execution;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
In one aspect, a transaction processing method is provided, which is applied to a transaction processing system in a distributed system, and the method includes:
acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
and calling the at least two participant nodes based on the transaction information, and sending execution requests to the at least two participant nodes, wherein the at least two participant nodes are used for executing corresponding target operations in the transaction information according to the execution requests.
In one possible implementation, before the invoking the at least two participant nodes based on the transaction information and sending the execution request to the at least two participant nodes, the method further includes:
and calling the at least two participant nodes based on the transaction information, and sending the transaction information to the at least two participant nodes, wherein the at least two participant nodes are used for storing the transaction information.
In one possible implementation, the distributed system further includes a transaction management system, and after obtaining the transaction processing request, the method further includes:
and sending the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier, and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
In one possible implementation, after the invoking the at least two participant nodes based on the transaction information and sending the execution request to the at least two participant nodes, the method further includes:
receiving execution results of the at least two participant nodes;
and storing the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
In one possible implementation, the distributed system further includes a transaction management system, and the method further includes:
receiving a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and sending the execution state corresponding to the transaction identification to the transaction management system.
In a possible implementation manner, after sending the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
receiving a transaction compensation request sent by the transaction management system, wherein the transaction management system is used for sending the transaction compensation request when the execution state is a failure state, the transaction compensation request carries the transaction identifier, and the failure state represents that at least one target operation in target operations of the at least two participant nodes fails to be executed;
and according to the transaction compensation request, calling the participant node corresponding to the target operation with failed execution again, and sending the execution request to the participant node, wherein the participant node is used for executing the target operation corresponding to the transaction information again according to the execution request.
In one aspect, a transaction processing apparatus is provided, which is applied to a transaction processing system in a distributed system, and includes:
the processing request acquisition module is used for acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
a first calling module, configured to call the at least two participant nodes based on the transaction information, and send execution requests to the at least two participant nodes, where the at least two participant nodes are configured to execute corresponding target operations in the transaction information according to the execution requests.
In one possible implementation, the apparatus further includes:
a transaction information sending module, configured to invoke the at least two participant nodes based on the transaction information, and send the transaction information to the at least two participant nodes, where the at least two participant nodes are used to store the transaction information.
In one possible implementation, the distributed system further includes a transaction management system, and the apparatus further includes:
and the processing request sending module is used for sending the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier, and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
In one possible implementation, the apparatus further includes:
a result receiving module, configured to receive execution results of the at least two participant nodes;
and the state storage module is used for storing the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
In one possible implementation, the distributed system further includes a transaction management system, and the apparatus further includes:
the query request receiving module is used for receiving a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and the state sending module is used for sending the execution state corresponding to the transaction identifier to the transaction management system.
In one possible implementation, the apparatus further includes:
a compensation request receiving module, configured to receive a transaction compensation request sent by the transaction management system, where the transaction management system is configured to send the transaction compensation request when the execution state is a failure state, where the transaction compensation request carries the transaction identifier, and the failure state indicates that at least one target operation in target operations of the at least two participant nodes fails to be executed;
and the second calling module is used for calling the participant node corresponding to the target operation with failed execution again according to the transaction compensation request and sending the execution request to the participant node, and the participant node is used for executing the target operation corresponding to the transaction information again according to the execution request.
In one aspect, a transaction processing system is provided, which includes one or more processors and one or more memories, in which at least one instruction is stored, and the at least one instruction is loaded and executed by the one or more processors to implement the operations performed by the transaction processing method according to any one of the above possible implementations.
In one aspect, a computer-readable storage medium is provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the operations performed by the transaction processing method according to any one of the above possible implementations.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
according to the method, the device, the system and the storage medium provided by the embodiment of the application, the transaction processing system obtains the transaction processing request, the transaction processing request carries transaction information, the transaction information comprises transaction identification, node information of at least two participant nodes and corresponding target operation, the transaction processing system calls the at least two participant nodes based on the transaction information, the execution request is sent to the at least two participant nodes, and the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution request. When the transaction is processed, the transaction is not limited by the branch transaction any more, and the branch transaction does not need to be registered, so that the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.
In addition, the method, the apparatus, the system, and the storage medium provided in the embodiments of the present application obtain a transaction request, where the transaction request carries transaction information, the transaction information includes a transaction identifier, node information of at least two participant nodes, and corresponding target operations, call the at least two participant nodes based on the transaction information, and send execution requests to the at least two participant nodes, where the at least two participant nodes are configured to execute the corresponding target operations in the transaction information according to the execution requests. When the transaction is processed, the transaction is not limited by the branch transaction any more, and the branch transaction does not need to be registered, so that the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.
And the transaction processing system sends a transaction processing request to the transaction management system, and the transaction management system registers the global transaction corresponding to the transaction identifier according to the transaction processing request, so that the branch transaction is not registered any more, and the time for registering the branch transaction is saved.
In addition, in the first stage, since the branch transaction does not need to be registered, the call of the network interface when the branch transaction is registered is reduced, and the branch transaction information does not need to be stored, so that the transaction state corresponding to the branch transaction information does not need to be updated, and the call of the database interface when the transaction state is updated is reduced. In the second stage, the transaction processing system executes one-time calling on at least two participant nodes, and only one-time network interface calling is needed, so that the calling of the network interface is further reduced, the transaction processing efficiency is improved, and the processing performance is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic diagram of a distributed system provided by an embodiment of the present application;
FIG. 2 is a flow diagram of another distributed system provided by embodiments of the present application;
fig. 3 is a flowchart of a transaction processing method according to an embodiment of the present application;
FIG. 4 is a flow chart of another transaction processing method provided by an embodiment of the present application;
FIG. 5 is a flow chart of another transaction processing method provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a first phase transaction provided by an embodiment of the present application;
FIG. 7 is a diagram of a second phase transaction provided by an embodiment of the application;
fig. 8 is a block diagram of a transaction processing apparatus according to an embodiment of the present application;
FIG. 9 is a block diagram of another transaction device provided in an embodiment of the present application;
fig. 10 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
To facilitate understanding of the transaction processing method provided in the embodiments of the present application, the terms referred to in the embodiments of the present application are explained first:
transaction: a program execution unit that can access and update various data in a database, a transaction having Atomicity (Atomicity), Consistency (Consistency), Isolation (Isolation), and persistence (Duration):
atomicity: the at least two operations corresponding to the transaction are either all successful or all failed, and no intermediate state exists;
consistency: indicating that the information held in the database of each component in the distributed system must change from one coherency state to another before and after the transaction is executed;
isolation: the method comprises the following steps that under the scene that a plurality of transactions are executed concurrently, each transaction is executed independently, and mutual interference does not exist;
durability: after the transaction execution is successfully performed, the execution result of the transaction is permanently saved.
Distributed transaction: the operations that make up the transaction are performed at different nodes in the distributed system, i.e., the operations that perform the transaction may occur in different systems or may occur in different nodes in the same system. A transaction processing system, a transaction management system and at least two participant nodes are involved in the distributed system, and the distributed transaction is completed by the co-participation of the transaction processing system, the transaction management system and the at least two participant nodes.
The transaction processing system: for invoking participant nodes to perform various operations in the transaction.
The transaction management system comprises: the method is used for managing the transaction, and comprises the steps of registering the transaction, recording the transaction state, inquiring the transaction state, initiating a transaction compensation process and the like.
The participant node: for actually performing the various operations in the transaction.
The transaction processing method provided by the embodiment of the application can be applied to various scenes.
For example, in a transfer scenario. When transferring money, one account is generally transferred to another account, the two accounts access two different participant nodes, and each participant node is called to execute corresponding operation by adopting the transaction processing method provided by the embodiment of the application, so that the transfer between the two accounts is completed.
For example, in an online shopping scenario. The operations of order generation, stock reduction and order payment in online shopping are realized by different participant nodes, and each participant node can be called to execute corresponding operations by adopting the transaction processing method provided by the embodiment of the application to complete online shopping.
Fig. 1 is a schematic diagram of a distributed system provided in an embodiment of the present application, and referring to fig. 1, the distributed system includes: a transaction processing system 101 and at least two participant nodes 102.
The transaction system 101 and the at least two participant nodes 102 are connected through a network, the transaction system 101 can call the at least two participant nodes 102 to execute the target operation, and the at least two participant nodes 102 can send the execution result to the transaction system 101.
In one possible implementation, referring to fig. 2, the distributed system further includes: transaction management system 103.
The transaction processing system 101 is connected to the transaction management system 103 via a network, the transaction processing system 101 may send a transaction processing request to the transaction management system 103, and the transaction management system 103 may send a status query request or a transaction compensation request to the transaction processing system 101.
The transaction management system 103 is connected to at least two participant nodes 102 via a network, and the transaction management system 103 may also send execution requests to at least two participant nodes 102.
In a possible implementation manner, the distributed system further includes a terminal, where the terminal is connected to the participant node 102 through a network, and the participant node 102 acquires the transaction request or other requests according to a trigger operation of the terminal.
The transaction processing system 101 may be a server, a server cluster composed of several servers, or a cloud computing service center. The transaction management system 103 may be a server, a server cluster composed of several servers, or a cloud computing service center.
Fig. 3 is a flowchart of a transaction processing method according to an embodiment of the present application. Referring to fig. 3, the method is applied to a distributed system, wherein the distributed system comprises a transaction processing system and at least two participant nodes, and the method comprises the following steps:
301. the transaction processing system acquires a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation.
302. The transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes.
303. And at least two participant nodes execute corresponding target operation in the transaction information according to the execution request.
According to the method provided by the embodiment of the application, a transaction processing system obtains a transaction processing request, the transaction processing request carries transaction information, the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation, the transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes, and the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution requests. When the transaction is processed, the transaction is not limited by the branch transaction any more, and the branch transaction does not need to be registered, so that the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.
In one possible implementation, the transaction processing system invokes at least two participant nodes based on the transaction information, and before sending the execution request to the at least two participant nodes, the method further includes:
the transaction processing system calls at least two participant nodes based on the transaction information and sends the transaction information to the at least two participant nodes;
at least two participant nodes store transaction information.
In one possible implementation, the execution request carries a transaction identifier; at least two participant nodes execute corresponding target operation in the transaction information according to the execution request, and the method comprises the following steps:
at least two participant nodes inquire transaction information comprising transaction identification;
and determining the target operation corresponding to the node information of the local end node in the transaction information, and executing the target operation.
In one possible implementation, the distributed system further includes a transaction management system, and after the transaction processing system obtains the transaction processing request, the method further includes:
the transaction processing system sends a transaction processing request to the transaction management system, wherein the transaction processing request carries a transaction identifier;
and the transaction management system registers the global transaction corresponding to the transaction identifier according to the transaction processing request.
In one possible implementation manner, after the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution request, the method further includes:
at least two participant nodes send the execution result of the target operation to the transaction processing system;
and the transaction processing system stores the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
In one possible implementation, the distributed system further includes a transaction management system, and the method further includes:
the transaction processing system receives a state query request sent by the transaction management system, wherein the state query request carries a transaction identifier;
and the transaction processing system sends the execution state corresponding to the transaction identification to the transaction management system.
In a possible implementation manner, after the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
when the execution state is a failure state, the transaction management system sends a transaction compensation request to the transaction processing system, the transaction compensation request carries a transaction identifier, and the failure state represents that at least one target operation in the target operations of at least two participant nodes fails to be executed;
the transaction processing system calls the participant node corresponding to the target operation with failed execution again according to the transaction compensation request, and sends an execution request to the participant node;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
In a possible implementation manner, after the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
when the execution state is a failure state, the transaction management system sends an execution request to a participant node corresponding to a target operation with failed execution;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
All the above optional technical solutions may be combined arbitrarily to form the optional embodiments of the present disclosure, and are not described herein again.
Fig. 4 is a flowchart of a transaction processing method according to an embodiment of the present application. Referring to fig. 4, the transaction processing system applied in the distributed system includes:
401. and acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation.
402. And calling at least two participant nodes based on the transaction information, and sending execution requests to the at least two participant nodes, wherein the at least two participant nodes are used for executing corresponding target operations in the transaction information according to the execution requests.
The method provided by the embodiment of the application obtains a transaction request, the transaction request carries transaction information, the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation, the at least two participant nodes are called based on the transaction information, execution requests are sent to the at least two participant nodes, and the at least two participant nodes are used for executing the corresponding target operation in the transaction information according to the execution requests. When the transaction is processed, the transaction is not limited by the branch transaction any more, and the branch transaction does not need to be registered, so that the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.
In one possible implementation, the method further includes, before invoking at least two participant nodes based on the transaction information and sending execution requests to the at least two participant nodes, the step of:
and calling at least two participant nodes based on the transaction information, and sending the transaction information to the at least two participant nodes, wherein the at least two participant nodes are used for storing the transaction information.
In one possible implementation, the distributed system further includes a transaction management system, and after acquiring the transaction processing request, the method further includes:
and sending a transaction processing request to a transaction management system, wherein the transaction processing request carries a transaction identifier, and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
In one possible implementation, at least two participant nodes are invoked based on the transaction information, and after sending the execution request to the at least two participant nodes, the method further includes:
receiving execution results of at least two participant nodes;
and storing the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
In one possible implementation, the distributed system further includes a transaction management system, and the method further includes:
receiving a state query request sent by a transaction management system, wherein the state query request carries a transaction identifier;
and sending the execution state corresponding to the transaction identification to the transaction management system.
In one possible implementation manner, after sending the execution state corresponding to the transaction identifier to the transaction management system, the method further includes:
receiving a transaction compensation request sent by a transaction management system, wherein the transaction management system is used for sending the transaction compensation request when the execution state is a failure state, the transaction compensation request carries a transaction identifier, and the failure state represents that at least one target operation in the target operations of at least two participant nodes fails to be executed;
and according to the transaction compensation request, calling the participant node corresponding to the target operation with failed execution again, and sending the execution request to the participant node, wherein the participant node is used for executing the target operation corresponding to the transaction information again according to the execution request.
All the above optional technical solutions may be combined arbitrarily to form the optional embodiments of the present disclosure, and are not described herein again.
Fig. 5 is a flowchart of a transaction processing method according to an embodiment of the present application. The method is applied to a distributed system which comprises a transaction processing system, a transaction management system and at least two participant nodes, and referring to fig. 5, the embodiment comprises the following steps:
501. the transaction processing system obtains a transaction processing request.
In the embodiment of the application, in the distributed system, the transaction processing is realized through the mutual cooperation of the transaction processing system, the transaction management system and at least two participant nodes.
First, a transaction processing system obtains a transaction processing request. The transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation. The transaction identifier is an identifier uniquely corresponding to the transaction information and is used for distinguishing the transaction information from the transaction information of other transactions. The transaction identification may be a transaction type, a transaction number or a transaction name, etc.
For any transaction, at least two participant nodes participate in the processing of the transaction, so the transaction processing request carries node information of at least two participant nodes. The node information of the participant node may include a node identifier, a node status, or other information of the participant node. In the transaction information, the node information of each participant node corresponds to a target operation, and when the target operation corresponding to each participant node is to process a transaction, the participant node needs to execute the operation.
For example, for a transaction that a first account transfers 50 yuan to a second account, two participant nodes are a first account and a second account, node information of the participant nodes may include information such as the number of the account and the balance in the account, a target operation corresponding to the first account is to subtract 50 yuan from the balance of the first account, and a target operation corresponding to the second account is to add 50 yuan to the balance of the second account.
The manner in which the transaction system obtains the transaction request may include a variety of ways.
In a possible implementation manner, after the terminal detects the trigger operation of the user, a transaction processing request may be generated, and then the transaction processing request is sent to the transaction processing system, and the transaction processing system obtains the transaction processing request accordingly. Or, the terminal does not need to detect the trigger operation of the user, and sends the transaction processing request to the transaction management system according to the preset time. Or the terminal logs in the participant node, generates a transaction request after detecting the trigger operation of the user, then sends the transaction request to the participant node, and the participant node sends the transaction request to the transaction system, so that the transaction system acquires the transaction request. The terminal can be a mobile phone, a tablet computer, a computer device and the like.
Or, the transaction management system may also acquire the transaction processing request in other manners, and the acquisition manner of the transaction processing request is not limited in this embodiment.
In addition, when the transaction processing system acquires the transaction processing request, the transaction processing request can be analyzed to obtain the transaction information carried by the transaction processing request, and the transaction information is stored according to the transaction identifier in the transaction information. The transaction information may be stored locally in the transaction processing system, or may be stored in a database of another system.
502. The transaction processing system sends a transaction processing request to the transaction management system.
503. And the transaction management system registers the global transaction corresponding to the transaction identifier according to the transaction processing request.
In the embodiment of the application, the distributed transaction is executed based on a two-phase protocol, in the first phase, the transaction management system registers the global transaction, at least two participant nodes determine the target operation needing to be executed, in the second phase, the transaction processing system calls the at least two participant nodes, and the at least two participant nodes execute the corresponding target operation.
Step 502-step 503 are processes of registering global transactions in the first phase.
After the transaction processing system acquires the transaction processing request, the transaction processing system sends the transaction processing request to the transaction management system, and the transaction management system registers the global transaction according to the received transaction processing request.
The transaction processing request may carry a transaction identifier, and the transaction management system registers the global transaction corresponding to the transaction identifier according to the transaction identifier.
In one possible implementation, the transaction processing system sends the transaction request to the transaction management system by calling the network interface, and the network interface needs to be called every time the transaction request is sent. In the embodiment of the application, for one transaction, only one transaction processing request needs to be sent to the transaction management system, and at least two branch transaction processing requests corresponding to the transaction do not need to be sent to the transaction management system, so that only one network interface needs to be called, and the calling times of the network interface are reduced.
Optionally, when the transaction management system receives the transaction request, the transaction management system analyzes the transaction request to obtain the transaction information carried by the transaction request and the transaction identifier included in the transaction information, and stores the transaction information, that is, registers the global transaction corresponding to the transaction identifier.
Optionally, the transaction management system includes a global transaction database, and the transaction information may be stored in the global transaction database. Or, the transaction information may also be stored in other databases, and the storage manner of the transaction information is not limited in the embodiment of the present application.
Alternatively, the transaction management system may be a middleware server, a coordinator, or other server.
In the embodiment of the application, the transaction management system only needs to register the global transaction and does not need to register the branch transaction, and the transaction processing system does not need to call the network interface to send the branch transaction processing request to the transaction management system any more, so that the calling of the network interface is reduced, the time for registering the branch transaction is saved, and the transaction processing efficiency is improved.
504. The transaction processing system calls the at least two participant nodes based on the transaction information and sends the transaction information to the at least two participant nodes.
505. At least two participant nodes store transaction information.
In the first phase, by executing step 504 and step 505, the transaction processing system calls the participant node to enable the participant node to store the transaction information, and determines the target operation to be executed in the second phase according to the transaction information.
In a first phase, the transaction processing system invokes at least two participant nodes, sending transaction information to the at least two participant nodes. For each participant node, when receiving the transaction information, the participant node acquires the transaction identifier included in the transaction information, the node information of the participant node and the corresponding target operation, and stores the transaction information.
In one possible implementation, each participant node may store current node information, so that when a subsequent participant node performs a target operation, if a rollback is required, the data of the participant node may be restored to a state before the target operation is performed according to the stored current node information.
It should be noted that, in the embodiment of the present application, the steps 502 to 503 may be performed first, and then the steps 504 and 505 are performed, or the steps 504 to 505 may be performed first, and then the steps 502 to 503 are performed, or the steps 502 to 503 and the steps 504 and 505 may be performed simultaneously. The execution sequence of the steps is not limited in the embodiment of the present application.
506. The transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes.
507. And at least two participant nodes execute corresponding target operation in the transaction information according to the execution request.
Step 506-.
The manner of invoking the at least two participant nodes in the second stage is different from the manner of invoking the at least two participant nodes in the first stage in step 504. In the second stage, when calling, the transaction processing system only needs to execute one call to at least two participant nodes, and does not need to execute one call to each participant node. The transaction processing system may use an RPC (Remote Procedure Call Protocol) Call or other calling methods.
In one possible implementation, the transaction processing system invokes a primary network interface based on the transaction information to send execution requests to at least two participant nodes. At least two participant nodes can receive the execution request through the network interface, so that corresponding target operation in the transaction information is executed according to the execution request.
In a possible implementation manner, the execution request carries transaction information, and when the participant node receives the execution request, the target operation corresponding to the participant node is determined according to the carried transaction information, so as to execute the target operation.
In a possible implementation manner, the execution request carries a transaction identifier, and in the case that the transaction information has already been stored in the at least two participant nodes in step 505, the at least two participant nodes query the transaction information including the transaction identifier according to the transaction identifier, and the at least two participant nodes determine a target operation corresponding to the node information of the local node in the transaction information and execute the target operation.
In a possible implementation manner, in the first phase, after the transaction processing system sends the transaction information to at least two participant nodes, the participant nodes may check the node states corresponding to the participant nodes to determine whether the participant nodes meet the condition for executing the corresponding target operation. When the participant node meets the condition, the participant node determines the required service resource when executing the target operation according to the corresponding target operation, reserves the required service resource for the target operation, and sends transaction confirmation information to the transaction processing system; and when the participant node does not meet the condition, the participant node sends transaction rejection information to the transaction processing system. Wherein the reserved service resource of the participant node cannot be used for other transaction processing before the transaction processing is completed.
In the second stage, when at least two participant nodes reserve service resources for the target operation and send transaction confirmation information to the transaction processing system, the transaction processing system calls the at least two participant nodes and sends execution requests to the at least two participant nodes, and the at least two participant nodes execute the corresponding target operation by using the service resources reserved for the target operation according to the execution requests.
And when at least one participant node in the at least two participant nodes sends transaction rejection information to the processing system, the transaction processing system calls the at least two participant nodes and sends transaction rollback requests to the at least two participant nodes, the at least two participant nodes release reserved service resources according to the transaction rollback requests, and the at least two participant nodes restore the node state to the state before executing a stage according to the stored transaction information.
For example, for a transaction that a first account transfers 50 elements to a second account, when the first account receives transaction information, whether the balance has 50 elements is detected according to a target operation of subtracting 50 elements from the balance of the first account in the transaction information, when the balance is enough, the transfer operation can be executed, and the first account needs to freeze 50 elements from the balance, the required 50 elements are reserved for the target operation, and the first account cannot steal the 50 elements before the transfer is completed. And the second account is able to receive transfers from the first account, then the balance of the first account is decremented by 50 dollars and the balance of the second account is incremented by 50 dollars.
If the balance of the first account is sufficient, the first account freezes 50 elements from the balance, and the required 50 elements are reserved for the target operation. But the second account cannot receive the transfer from the first account, a notification needs to be sent to the first account, unfreezing the 50 elements frozen to the first account.
It should be noted that, when at least two participant nodes execute the target operation corresponding to the local node, there is no interference between them, and the transaction processing system does not need to pay attention to the execution process of the participant nodes.
508. At least two participant nodes send results of the execution of the target operation to the transaction processing system.
509. And the transaction processing system stores the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
After the at least two participant nodes execute the corresponding target operation, the execution result of the target operation is respectively sent to the transaction processing system, the transaction processing system executes the result, the execution state corresponding to the execution result is determined, and the execution state is stored.
The execution result may be an execution success or an execution failure.
When the target operations of at least two participant nodes are successfully executed, the execution result is successful, and the corresponding execution state is a successful state, which indicates that the submission is successful; when the target operation execution of at least one participant node of at least two participant nodes fails, the execution result is execution failure, and the corresponding execution state is a failure state, which indicates that the submission is not successful.
In addition, if at least two participant nodes rollback requests from the transaction, a rollback is performed. Then, when the node states of at least two participant nodes are restored to the state before the execution of one stage, the rollback result is that the rollback is successful; when the node state of at least one participant node of the at least two participant nodes is not restored to the state before the execution of the one stage, the rollback result is a rollback failure.
In a possible implementation manner, when the transaction processing system does not receive the execution result, the transaction state corresponding to the transaction information may be an executing state of the transaction or another state.
In addition, when storing the execution state corresponding to the transaction information, the execution state may be stored together with the transaction information, or the transaction state may be stored correspondingly according to the transaction identifier in the transaction information.
510. The transaction processing system receives a status query request sent by the transaction management system.
511. And the transaction processing system sends the execution state corresponding to the transaction identification to the transaction management system.
The transaction management system may send a status query request to the transaction processing system at any time after registering the global transaction before the transaction ends.
The status query request may carry a transaction identifier. When the transaction processing system receives the state query request, the transaction processing system may query the stored execution state corresponding to the transaction identifier according to the transaction identifier, and send the queried execution state to the transaction management system.
Because the execution state comprises a plurality of types, when the transaction management system receives different execution states, the operation corresponding to the execution state is executed.
When the execution state received by the transaction management system is the executing state, the transaction management system can send the state query request to the transaction processing system again or temporarily does not execute the subsequent operation; when the execution state received by the transaction management system is a success state, the transaction is indicated to be finished and no subsequent operation is executed; when the execution state received by the transaction management system is a failure state, the transaction management system needs to make each participant node execute the target operation again.
In a possible implementation manner, when the execution state is the failure state, the transaction management system sends a transaction compensation request to the transaction processing system, the transaction processing system recalls a participant node corresponding to the target operation that is failed to be executed according to the transaction compensation request, and sends an execution request to the participant node, where the participant node executes the target operation corresponding to the transaction information again according to the execution request.
The transaction compensation request may carry a transaction identifier, and the transaction processing system queries, according to the transaction identifier, transaction information corresponding to the transaction identifier and invokes a participant node corresponding to a target operation that fails to be executed.
In another possible implementation manner, when the execution state is the failure state, the transaction management system sends an execution request to the participant node corresponding to the target operation that has failed to be executed, and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
The transaction management system queries the transaction information corresponding to the transaction identifier, and sends an execution request to the participant node corresponding to the target operation with failed execution according to the transaction information, and the specific implementation manner is similar to that of the step 506 and 509, and is not described in detail herein.
It should be noted that, for the rollback result, the transaction processing system sends the rollback state corresponding to the transaction identifier to the transaction management system, and when the rollback state is the rollback failure state, the transaction management system needs to cause the participant node to perform rollback again.
It should be noted that, in the embodiment of the present application, the description is only given by taking an example that the distributed system includes the transaction processing system, the transaction management system, and at least two participant nodes, and in another embodiment, the distributed system may further include other systems.
According to the method provided by the embodiment of the application, the transaction processing system obtains the transaction processing request, the transaction processing system calls the at least two participant nodes based on the transaction information, the execution request is sent to the at least two participant nodes, the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution request, when the transaction is processed, the limitation of the branch transaction is avoided, the branch transaction does not need to be registered, the time for registering the branch transaction in the transaction processing process is saved, the transaction processing efficiency is improved, and the processing performance is also improved.
And the transaction processing system sends a transaction processing request to the transaction management system, and the transaction management system registers the global transaction corresponding to the transaction identifier according to the transaction processing request, so that the branch transaction is not registered any more, and the time for registering the branch transaction is saved.
And the transaction processing system calls at least two participant nodes based on the transaction information, sends the transaction information to the at least two participant nodes, and the at least two participant nodes store the transaction information. After the at least two participant nodes execute the corresponding target operation in the transaction information according to the execution request, the at least two participant nodes send the execution result of the target operation to the transaction processing system, the transaction processing system stores the execution state corresponding to the transaction information according to the execution result of the at least two participant nodes, the transaction processing system receives the state query request sent by the transaction management system, and the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system. When the execution fails, the transaction processing system compensates, so that the participant node can execute the target operation again according to the stored transaction information, and the participant node no longer needs to determine the target operation to be executed according to the register branch transaction.
In addition, in the first stage, since the branch transaction does not need to be registered, the call of the network interface when the branch transaction is registered is reduced, and the branch transaction information does not need to be stored, so that the transaction state corresponding to the branch transaction information does not need to be updated, and the call of the database interface when the transaction state is updated is reduced. In the second stage, the transaction processing system executes one call to at least two participant nodes, and only one network interface needs to be called, so that the call of the network interface is further reduced.
In addition, the transaction processing system is used as an upstream transaction initiator to call a downstream participant node to execute a corresponding target operation, and the transaction management system can comprise a first transaction component, a second transaction component and a global transaction database. The first transaction component may be a transaction component server, and the first transaction component is configured to receive a transaction processing request; the second transaction component may be a transaction component task, and the second transaction component is used for querying the execution state and executing the operation after receiving the execution state, such as sending a transaction compensation request, an execution request, and the like.
And the transaction processing system is provided with a configuration center, wherein the configuration center is used for storing transaction identification, transaction information, meta information of each participant node and the like, wherein the meta information can comprise node identification of the participant node, a corresponding interface name and a corresponding two-phase method name when the participant node in the second phase executes target operation, and the two-phase method comprises methods such as submission, rollback and the like. A global transaction configuration rule may also be set that is used to configure the two-phase method when the transaction initiator invokes a transaction participant.
In the first stage, as shown in fig. 6, when a transaction initiator calls a downstream participant node, a transaction identifier is sent to the participant node, and the participant node stores transaction information according to the transaction identifier; the transaction initiator opens a transaction, registers a global transaction, and stores transaction information in a global transaction database.
In the second stage, as shown in fig. 7, the configuration center sends the stored transaction information to the transaction initiator, the transaction initiator executes an RPC call according to the transaction information, and calls the participant node, when calling, the transaction initiator sends the transaction identifier to the participant node, and the transaction participant node queries the stored transaction information according to the transaction identifier, executes the corresponding target operation, and commits or rolls back. The transaction component-task queries the transaction initiator for the execution state. And when the execution fails, the transaction component task compensates the participant node, so that the participant node executes the corresponding target operation again.
Therefore, in the embodiment of the application, the branch transaction does not need to be registered in the first stage, and only one call needs to be executed in the second stage, so that the registration time and the call time of the branch transaction are reduced, the transaction processing efficiency is improved, and the performance is improved.
Fig. 8 is a block diagram of a transaction processing apparatus according to an embodiment of the present application. Referring to fig. 8, the transaction processing system applied in the distributed system includes:
a processing request obtaining module 801, configured to obtain a transaction processing request, where the transaction processing request carries transaction information, and the transaction information includes a transaction identifier, node information of at least two participant nodes, and a corresponding target operation;
a first invoking module 802, configured to invoke at least two participant nodes based on the transaction information, and send an execution request to the at least two participant nodes, where the at least two participant nodes are configured to execute a corresponding target operation in the transaction information according to the execution request.
In one possible implementation, referring to fig. 9, the apparatus further includes:
a transaction information sending module 803, configured to invoke at least two participant nodes based on the transaction information, and send the transaction information to the at least two participant nodes, where the at least two participant nodes are configured to store the transaction information.
In one possible implementation, referring to fig. 9, the distributed system further includes a transaction management system, and the apparatus further includes:
a processing request sending module 804, configured to send a transaction processing request to a transaction management system, where the transaction processing request carries a transaction identifier, and the transaction management system is configured to register, according to the transaction processing request, a global transaction corresponding to the transaction identifier.
In one possible implementation, referring to fig. 9, the apparatus further includes:
a result receiving module 805, configured to receive execution results of at least two participant nodes;
and a state storage module 806, configured to store an execution state corresponding to the transaction information according to execution results of the at least two participant nodes.
In one possible implementation, referring to fig. 9, the distributed system further includes a transaction management system, and the apparatus further includes:
a query request receiving module 807, configured to receive a status query request sent by the transaction management system, where the status query request carries a transaction identifier;
and a state sending module 808, configured to send the execution state corresponding to the transaction identifier to the transaction management system.
In one possible implementation, referring to fig. 9, the apparatus further includes:
a compensation request receiving module 809, configured to receive a transaction compensation request sent by the transaction management system, where the transaction management system is used to send the transaction compensation request when the execution state is a failure state, the transaction compensation request carries a transaction identifier, and the failure state indicates that at least one target operation in target operations of at least two participant nodes fails to be executed;
the second invoking module 810 is configured to invoke again the participant node corresponding to the target operation that is failed to be executed according to the transaction compensation request, and send an execution request to the participant node, where the participant node is configured to execute again the target operation corresponding to the transaction information according to the execution request.
It should be noted that: in the transaction processing device provided in the above embodiment, only the division of the functional modules is illustrated when processing a transaction, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the system is divided into different functional modules to complete all or part of the functions described above. In addition, the embodiments of the transaction processing method provided in the foregoing embodiments belong to the same concept, and specific implementation processes thereof are described in detail in the embodiments of the method, and are not described herein again.
Fig. 10 is a schematic structural diagram of a server according to an embodiment of the present application, where the server 1000 may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 1001 and one or more memories 1002, where the memory 1002 stores at least one instruction, and the at least one instruction is loaded and executed by the processors 1001 to implement the methods provided by the foregoing method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input/output interface, so as to perform input/output, and the server may also include other components for implementing the functions of the device, which are not described herein again.
In an exemplary embodiment, a computer device is provided, which includes one or more processors and one or more memories having stored therein at least one instruction, which is loaded and executed by the one or more processors to implement a transaction processing method as in the above embodiments.
In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction is stored, and the at least one instruction is loaded and executed by a processor to implement the transaction processing method in the above embodiment. For example, the computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, there is also provided a computer program comprising at least one instruction loaded and executed by a processor to implement the transaction processing method as in the above embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only exemplary of the present application and should not be taken as limiting, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (24)

1. A transaction processing method applied to a distributed system, the distributed system comprising a transaction processing system and at least two participant nodes, the method comprising:
the transaction processing system acquires a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
the transaction processing system calls the at least two participant nodes based on the transaction information and sends execution requests to the at least two participant nodes;
and the at least two participant nodes execute corresponding target operation in the transaction information according to the execution request.
2. The method of claim 1, wherein the transaction processing system invokes the at least two participant nodes based on the transaction information, and wherein before sending execution requests to the at least two participant nodes, the method further comprises:
the transaction processing system calls the at least two participant nodes based on the transaction information and sends the transaction information to the at least two participant nodes;
the at least two participant nodes store the transaction information.
3. The method of claim 2, wherein the execution request carries the transaction identifier; the at least two participant nodes execute corresponding target operations in the transaction information according to the execution request, and the target operations comprise:
the at least two participant nodes inquire transaction information comprising the transaction identification;
and determining a target operation corresponding to the node information of the local end node in the transaction information, and executing the target operation.
4. The method of claim 1, wherein the distributed system further comprises a transaction management system, and wherein after the transaction processing system obtains the transaction request, the method further comprises:
the transaction processing system sends the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier;
and the transaction management system registers the global transaction corresponding to the transaction identification according to the transaction processing request.
5. The method of claim 1, wherein after the at least two participant nodes execute the corresponding target operations in the transaction information according to the execution request, the method further comprises:
the at least two participant nodes send the execution result of the target operation to the transaction processing system;
and the transaction processing system stores the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
6. The method of claim 5, wherein the distributed system further comprises a transaction management system, the method further comprising:
the transaction processing system receives a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and the transaction processing system sends the execution state corresponding to the transaction identifier to the transaction management system.
7. The method of claim 6, wherein after the transaction processing system sends the execution status corresponding to the transaction identifier to the transaction management system, the method further comprises:
when the execution state is a failure state, the transaction management system sends a transaction compensation request to the transaction processing system, the transaction compensation request carries the transaction identifier, and the failure state represents that at least one target operation in the target operations of the at least two participant nodes fails to be executed;
the transaction processing system calls the participant node corresponding to the target operation with failed execution again according to the transaction compensation request, and sends the execution request to the participant node;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
8. The method of claim 6, wherein after the transaction processing system sends the execution status corresponding to the transaction identifier to the transaction management system, the method further comprises:
when the execution state is a failure state, the transaction management system sends the execution request to a participant node corresponding to a target operation with failed execution;
and the participant node executes the corresponding target operation in the transaction information again according to the execution request.
9. A transaction processing method applied to a transaction processing system in a distributed system, the method comprising:
acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
and calling the at least two participant nodes based on the transaction information, and sending execution requests to the at least two participant nodes, wherein the at least two participant nodes are used for executing corresponding target operations in the transaction information according to the execution requests.
10. The method of claim 9, wherein the invoking the at least two participant nodes based on the transaction information further comprises, prior to sending an execution request to the at least two participant nodes:
and calling the at least two participant nodes based on the transaction information, and sending the transaction information to the at least two participant nodes, wherein the at least two participant nodes are used for storing the transaction information.
11. The method of claim 9, wherein the distributed system further comprises a transaction management system, and wherein after obtaining the transaction request, the method further comprises:
and sending the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier, and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
12. The method of claim 9, wherein after invoking the at least two participant nodes based on the transaction information and sending execution requests to the at least two participant nodes, the method further comprises:
receiving execution results of the at least two participant nodes;
and storing the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
13. The method of claim 12, wherein the distributed system further comprises a transaction management system, the method further comprising:
receiving a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and sending the execution state corresponding to the transaction identification to the transaction management system.
14. The method of claim 13, wherein after sending the execution status corresponding to the transaction identifier to the transaction management system, the method further comprises:
receiving a transaction compensation request sent by the transaction management system, wherein the transaction management system is used for sending the transaction compensation request when the execution state is a failure state, the transaction compensation request carries the transaction identifier, and the failure state represents that at least one target operation in target operations of the at least two participant nodes fails to be executed;
and according to the transaction compensation request, calling the participant node corresponding to the target operation with failed execution again, and sending the execution request to the participant node, wherein the participant node is used for executing the target operation corresponding to the transaction information again according to the execution request.
15. A transaction processing apparatus applied to a transaction processing system in a distributed system, the apparatus comprising:
the processing request acquisition module is used for acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
a first calling module, configured to call the at least two participant nodes based on the transaction information, and send execution requests to the at least two participant nodes, where the at least two participant nodes are configured to execute corresponding target operations in the transaction information according to the execution requests.
16. The apparatus of claim 15, further comprising:
a transaction information sending module, configured to invoke the at least two participant nodes based on the transaction information, and send the transaction information to the at least two participant nodes, where the at least two participant nodes are used to store the transaction information.
17. The apparatus of claim 15, wherein the distributed system further comprises a transaction management system, the apparatus further comprising:
and the processing request sending module is used for sending the transaction processing request to the transaction management system, wherein the transaction processing request carries the transaction identifier, and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
18. The apparatus of claim 15, further comprising:
a result receiving module, configured to receive execution results of the at least two participant nodes;
and the state storage module is used for storing the execution state corresponding to the transaction information according to the execution results of the at least two participant nodes.
19. The apparatus of claim 18, wherein the distributed system further comprises a transaction management system, the apparatus further comprising:
the query request receiving module is used for receiving a state query request sent by the transaction management system, wherein the state query request carries the transaction identifier;
and the state sending module is used for sending the execution state corresponding to the transaction identifier to the transaction management system.
20. The apparatus of claim 19, further comprising:
a compensation request receiving module, configured to receive a transaction compensation request sent by the transaction management system, where the transaction management system is configured to send the transaction compensation request when the execution state is a failure state, where the transaction compensation request carries the transaction identifier, and the failure state indicates that at least one target operation in target operations of the at least two participant nodes fails to be executed;
and the second calling module is used for calling the participant node corresponding to the target operation with failed execution again according to the transaction compensation request and sending the execution request to the participant node, and the participant node is used for executing the target operation corresponding to the transaction information again according to the execution request.
21. A transaction processing system, comprising one or more processors and one or more memories having at least one instruction stored therein, the at least one instruction being loaded and executed by the one or more processors to implement operations performed by the transaction processing method of any of claims 9 to 14.
22. A computer-readable storage medium having stored therein at least one instruction which is loaded and executed by a processor to perform operations performed by a transaction processing method as claimed in any one of claims 9 to 14.
23. A distributed system, comprising a transaction processing system and at least two participant nodes;
the transaction processing system is used for acquiring a transaction processing request, wherein the transaction processing request carries transaction information, and the transaction information comprises a transaction identifier, node information of at least two participant nodes and corresponding target operation;
the transaction processing system is further used for invoking the at least two participant nodes based on the transaction information and sending execution requests to the at least two participant nodes;
and the at least two participant nodes are used for executing corresponding target operation in the transaction information according to the execution request.
24. The distributed system of claim 23, wherein the distributed system further comprises a transaction management system;
the transaction processing system is further configured to send the transaction processing request to the transaction management system, where the transaction processing request carries the transaction identifier;
and the transaction management system is used for registering the global transaction corresponding to the transaction identifier according to the transaction processing request.
CN201911394348.2A 2019-12-30 2019-12-30 Transaction processing method, device, system and storage medium Withdrawn CN111143040A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911394348.2A CN111143040A (en) 2019-12-30 2019-12-30 Transaction processing method, device, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911394348.2A CN111143040A (en) 2019-12-30 2019-12-30 Transaction processing method, device, system and storage medium

Publications (1)

Publication Number Publication Date
CN111143040A true CN111143040A (en) 2020-05-12

Family

ID=70521775

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911394348.2A Withdrawn CN111143040A (en) 2019-12-30 2019-12-30 Transaction processing method, device, system and storage medium

Country Status (1)

Country Link
CN (1) CN111143040A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835687A (en) * 2021-01-22 2021-05-25 恒生电子股份有限公司 Computer transaction processing method and system
CN113515353A (en) * 2021-06-04 2021-10-19 深圳奥哲网络科技有限公司 Long transaction processing method, system, electronic device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325978A (en) * 2015-06-19 2017-01-11 阿里巴巴集团控股有限公司 Distributed transaction processing method and apparatus
CN108491252A (en) * 2018-03-13 2018-09-04 万惠投资管理有限公司 distributed transaction processing method and distributed system
CN109491767A (en) * 2018-11-13 2019-03-19 上海联寓智能科技有限公司 The processing method and distributed system of distributed transaction
CN109819023A (en) * 2018-12-29 2019-05-28 杭州励飞软件技术有限公司 Distributed transaction processing method and Related product
CN110457157A (en) * 2019-08-05 2019-11-15 腾讯科技(深圳)有限公司 Distributed transaction abnormality eliminating method, device, computer equipment and storage medium
CN110502319A (en) * 2019-08-23 2019-11-26 腾讯科技(深圳)有限公司 Processing method, device, electronic equipment and the storage medium of distributed transaction

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106325978A (en) * 2015-06-19 2017-01-11 阿里巴巴集团控股有限公司 Distributed transaction processing method and apparatus
CN108491252A (en) * 2018-03-13 2018-09-04 万惠投资管理有限公司 distributed transaction processing method and distributed system
CN109491767A (en) * 2018-11-13 2019-03-19 上海联寓智能科技有限公司 The processing method and distributed system of distributed transaction
CN109819023A (en) * 2018-12-29 2019-05-28 杭州励飞软件技术有限公司 Distributed transaction processing method and Related product
CN110457157A (en) * 2019-08-05 2019-11-15 腾讯科技(深圳)有限公司 Distributed transaction abnormality eliminating method, device, computer equipment and storage medium
CN110502319A (en) * 2019-08-23 2019-11-26 腾讯科技(深圳)有限公司 Processing method, device, electronic equipment and the storage medium of distributed transaction

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112835687A (en) * 2021-01-22 2021-05-25 恒生电子股份有限公司 Computer transaction processing method and system
CN112835687B (en) * 2021-01-22 2023-05-26 恒生电子股份有限公司 Method and system for processing computer transaction
CN113515353A (en) * 2021-06-04 2021-10-19 深圳奥哲网络科技有限公司 Long transaction processing method, system, electronic device and storage medium

Similar Documents

Publication Publication Date Title
US9417906B2 (en) Transaction participant registration with caveats
CN111091429A (en) Electronic bill identification distribution method and device and electronic bill generation system
US9055065B2 (en) Managing participant order in distributed transactions
US11681683B2 (en) Transaction compensation for single phase resources
CN111277639B (en) Method and device for maintaining data consistency
US7970737B2 (en) Recovery administration of global transaction participants
US20140337303A1 (en) Bandwidth optimized two-phase commit protocol for distributed transactions
CN113268471B (en) Method, proxy connection pool, system, device and medium for processing distributed transaction
CN111143040A (en) Transaction processing method, device, system and storage medium
WO2023082992A1 (en) Data processing method and system
CN113377875B (en) Cross-chain data processing method and device, electronic equipment and readable storage medium
CN114327799A (en) Distributed transaction processing method and device, electronic equipment and storage medium
CN112000444B (en) Database transaction processing method and device, storage medium and electronic equipment
CN107025257A (en) A kind of transaction methods and device
CN113297329A (en) Transaction processing method, device, equipment, storage medium and program product
CN112632093A (en) Work order processing method, device, system, storage medium and program product
CN112711466B (en) Hanging affair inspection method and device, electronic equipment and storage medium
WO2022206426A1 (en) Distributed transaction processing method and system, and related device
CN115208834A (en) Service flow limiting method based on database storage process design
CN114356596A (en) Message processing method and device for distributed system
CN115145997A (en) Distributed transaction implementation method and distributed system
CN114443232A (en) Transaction management method and device, electronic equipment and storage medium
CN115098528B (en) Service processing method, device, electronic equipment and computer readable storage medium
CN117573396B (en) Distributed workflow event processing method, device and medium
CN113849278A (en) Global transaction processing method and system

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
WW01 Invention patent application withdrawn after publication

Application publication date: 20200512

WW01 Invention patent application withdrawn after publication