CN116938927A - Distributed transaction processing method, device, computer equipment and storage medium - Google Patents

Distributed transaction processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116938927A
CN116938927A CN202210369977.5A CN202210369977A CN116938927A CN 116938927 A CN116938927 A CN 116938927A CN 202210369977 A CN202210369977 A CN 202210369977A CN 116938927 A CN116938927 A CN 116938927A
Authority
CN
China
Prior art keywords
transaction
service node
target
request
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210369977.5A
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.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New 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 Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202210369977.5A priority Critical patent/CN116938927A/en
Publication of CN116938927A publication Critical patent/CN116938927A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the application discloses a distributed transaction processing method, a distributed transaction processing device, computer equipment and a storage medium. The method comprises the following steps: the master service node sends a transaction processing request to a target slave service node in the slave service nodes, wherein the transaction processing request comprises effective processing time length of a transaction to be processed; capturing the transaction request by a target gateway node corresponding to the target slave service node, and sending the transaction request to the target slave service node; the target slave service node processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node; the target gateway node determines whether to send the transaction request to the service node again based on the transaction state and the effective processing time length, so that the target slave service node successfully processes the transaction to be processed. Further improving the operation efficiency and performance of the service node.

Description

Distributed transaction processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a distributed transaction processing method, a distributed transaction processing device, a computer device, and a storage medium.
Background
With the increasing complexity of business systems and the proliferation of third party cloud public services, the current design of large numbers of integrated cloud services and decentralization of server side systems has become a trend (e.g., micro services). This means that to complete a service logic, there will be multiple small service units participating simultaneously. A TCC-based distributed transaction scheme may be employed to complete a business logic. In a TCC distributed transaction-based system architecture, in order to ensure that service logic can successfully complete across multiple master service nodes (nodes initiating transactions) and multiple slave service nodes (one of the nodes in the process of processing transactions), the master service node and each slave service node are required to successfully process corresponding transactions, however, in the prior art, consideration and design of the slave service nodes are usually deficient, and the slave service nodes can have situations of slow running and complex system design in the nodes due to transaction retention caused by incapacity of asynchronous processing, allocation of multiple transactions, and the like, so that performance of the slave service nodes is poor.
Disclosure of Invention
The embodiment of the application provides a distributed transaction processing method, a device, computer equipment and a storage medium, which can improve the performance of a service node in a TCC distributed transaction architecture system.
The embodiment of the application provides a distributed transaction processing method, which is applied to a TCC distributed transaction architecture system, wherein the TCC distributed transaction architecture system comprises at least one main service node, at least one service node and gateway nodes corresponding to the service nodes, and comprises the following steps:
the master service node sends a transaction processing request to a target slave service node in the slave service nodes, wherein the transaction processing request comprises effective processing time length of a transaction to be processed;
capturing the transaction request by a target gateway node corresponding to the target slave service node, and sending the transaction request to the target slave service node;
the target slave service node processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node;
and the target gateway node determines whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
Correspondingly, the embodiment of the application also provides a distributed transaction processing device, which is applied to a TCC distributed transaction architecture system, wherein the TCC distributed transaction architecture system comprises at least one main service node, at least one service node and gateway nodes corresponding to the service nodes, and comprises:
a request sending unit, configured to enable the master service node to send a transaction processing request to a target slave service node in the slave service node, where the transaction processing request includes an effective processing duration of a transaction to be processed;
a request capturing unit, configured to enable the target gateway node corresponding to the target slave service node to capture the transaction request, and send the transaction request to the target slave service node;
the transaction processing unit is used for enabling the target slave service node to process the transaction to be processed according to the transaction processing request and feeding back a transaction processing state to the target gateway node;
and the determining unit is used for enabling the target gateway node to determine whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
Optionally, the transaction request includes a callback address for the main service node, and the determining unit is further configured to:
if the transaction state is a successful processing state, the target gateway node determines that the transaction request of the transaction to be processed is not sent to the service node any more;
and the target gateway node feeds back the information of successful processing of the target slave service node on the transaction to be processed to the master service node based on the callback address.
Optionally, the determining unit is further configured to:
if the transaction processing state is a failure processing state, the target gateway node determines whether the effective processing time length of the transaction processing request is exceeded or not based on the current moment;
if yes, the target gateway node determines that the transaction processing request of the transaction to be processed is not sent to the service node any more;
if not, the target gateway node determines to send the transaction processing request of the transaction to be processed to the target slave service node again based on the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
Optionally, the determining unit is further configured to:
The target gateway node sets processing requirement information of the transaction processing request based on the effective processing time length;
the target network node stores the processing requirement information and the transaction request into a buffer area corresponding to the target gateway node;
and the target gateway node sends a transaction processing request of the transaction to be processed to the target slave service node based on the processing requirement information and the effective processing time length until the target slave service node successfully processes the transaction to be processed.
Optionally, the processing requirement information includes a target number of times the target gateway node sends the transaction request to the target slave service node, and an interval duration of each time the transaction request is sent;
the determining unit is further configured to:
the target gateway node sequentially sends the transaction processing request of the transaction to be processed to the target slave service node based on the interval duration;
and if the number of times of sending the transaction processing request of the transaction to be processed to the target slave service node reaches the target number of times, or the target slave service node successfully processes the transaction to be processed, stopping sending the transaction processing request of the transaction to be processed.
Optionally, the transaction request includes a callback address for the main service node, and the determining unit is further configured to:
and the target gateway node feeds back the information of the failure of the target slave service node to process the transaction to be processed to the master service node based on the callback address.
Optionally, the request capturing unit is further configured to:
deriving a replica processing request based on the transaction request, the replica processing request being identical to the transaction request;
the determining unit is further configured to:
if not, the target gateway node generates a new transaction request which is sent to the target slave service node again based on the copy processing request;
and sending the new transaction request to the target slave service node again based on the effective processing duration.
Also, an embodiment of the present application further provides a computer device, including:
a memory for storing a computer program;
a processor for executing the steps of any of the distributed transaction methods.
Furthermore, the embodiment of the application also provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program realizes the steps of any one of the distributed transaction processing methods when being executed by a processor.
The embodiment of the application provides a distributed transaction processing method, a device, computer equipment and a storage medium, wherein a corresponding gateway node is arranged for each service node in a TCC distributed transaction architecture system, when a main service node sends a transaction processing request to the service node, the gateway node corresponding to the service node can capture the transaction processing request first and then send the transaction processing request to the service node, and when the service node fails to process once, the gateway node can send the transaction processing request to the service node for a plurality of times based on the effective processing time of the transaction processing request, so that the service node only needs to process the transaction processing request sent by the gateway node, and other operations such as other distribution of a plurality of transactions are not needed to be made for successfully processing the transaction processing request, so that the system design of the service node is simpler, and the running efficiency and the running performance of the service node are further improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be redeemed in the description of the embodiments will be briefly described below, it being obvious that the drawings in the description below are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a system schematic diagram of a TCC distributed transaction architecture system provided by an embodiment of the present application;
FIG. 2 is a flow chart of a distributed transaction processing method according to an embodiment of the present application;
FIG. 3 is another flow chart of a distributed transaction method provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a distributed transaction processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to fall within the scope of the application.
The embodiment of the application provides a distributed transaction processing method, a distributed transaction processing device, computer equipment and a storage medium. Specifically, the distributed transaction processing method of the embodiment of the present application may be performed by a computer device, where the computer device may be a device such as a terminal or a server. The terminal can be terminal equipment such as a smart phone, a tablet personal computer, a notebook computer, a touch screen, a game machine, a personal computer (Personal Computer, PC), a personal digital assistant (Personal Digital Assistant, PDA) and the like, and the server can be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, and can also be a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution network services, basic cloud computing services such as big data and an artificial intelligent platform and the like.
Referring to fig. 1, fig. 1 is a system schematic diagram of a TCC distributed transaction architecture system according to an embodiment of the present application. The system may comprise at least one master service node 101, a target slave service node 102, other service nodes 104, a slave service node 105, and a target gateway node 103 corresponding to the target slave service node 102. The master service node 101, the target slave service node 102 and the target gateway node 103 are connected with each other through a network, for example, the network may be a wireless network or a wired network, the wireless network may be a Wireless Local Area Network (WLAN), a Local Area Network (LAN), a cellular network, a 2G network, a 3G network, a 4G network, a 5G network, etc., and the master service node 101 sends a transaction request to the target slave service node 102, where the transaction request includes an effective processing duration of a transaction to be processed; the target gateway node 103 corresponding to the target slave service node 102 captures the transaction request and sends the transaction request to the target slave service node 102; the target slave service node 102 processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node 103; the target gateway node 103 determines, based on the transaction status and the valid processing duration, whether to send again a transaction request for the pending transaction to the service node 102, so that the target slave service node 102 successfully processes the pending transaction.
The following will describe in detail. The following description of the embodiments is not intended to limit the preferred embodiments.
The present embodiment will be described from the viewpoint of a distributed transaction processing apparatus, which may be integrated in a terminal device, and the terminal device may include a smart phone, a notebook computer, a tablet computer, a personal computer, and the like.
The embodiment of the application provides a distributed transaction processing method, which can be executed by a processor of a terminal, and is applied to a TCC distributed transaction architecture system, wherein the TCC distributed transaction architecture system comprises at least one main service node, at least one service node and gateway nodes corresponding to the service nodes, as shown in fig. 2, the specific flow of the distributed transaction processing method mainly comprises steps 201 to 204, and the detailed description is as follows:
step 201, the master service node sends a transaction request to a target slave service node in the slave service nodes, wherein the transaction request comprises the effective processing duration of a to-be-processed transaction.
In the embodiment of the present application, a transaction is a sequence of operations that completes a business unit and includes a series of operations that must be atomic, i.e., the operations cannot be split: either all successfully executed or none. Such as: the order is placed in the e-commerce system, and a series of other operations (e.g., a series of operations of inventory of goods, shopping cart of user, shopping record of user, sales data of goods, etc.) are performed in addition to the generation of the order. The TCC is an architecture concept for realizing distributed transactions, and comprises a main service node, wherein the main service node is an initiator of a transaction in the TCC architecture, for example, the main service node can be an operation of generating orders in an e-commerce system, the service node is a link in the whole transaction process in the TCC architecture, for example, the service node can be a node for processing commodity inventory, or modifying commodity sales data and the like. The gateway node is a front-end node on each service node for handling operations other than transaction operations from the service node, such as result callbacks, settings for re-processing within a valid processing duration after a transaction request processing failure, etc.
In the embodiment of the application, the transaction processing request is a request sent by the main service node to the service node to enable the service node to complete the next transaction operation according to the transaction operation completed by the main service node when the main service node completes one transaction operation. The transaction request may include transaction data of the transaction to be processed, an effective processing time length of the transaction to be processed, and a callback address of the main service node. The transaction data is the data required by the transaction operation which needs to be completed by the service node, the effective processing time length is the time length for executing effective processing on the transaction request by the service node, namely, the processing operation on the transaction request by the service node is invalid after the effective time length is exceeded, and the callback address is the address for feeding back the execution result information from the service node to the main service node. For example, after the main service node generates an order for purchasing the air ticket at the third party proxy platform, the main service node sends an air ticket reservation request to the third party proxy platform, that is, the third party proxy platform needs to enable the air ticket vending platform to reserve the air ticket according to the air ticket reservation request, and after the air ticket reservation is successful, the third party proxy platform feeds back reservation success information to the main service node, so that the main service node can confirm the purchase of the air ticket.
Step 202, the target gateway node corresponding to the target slave service node captures the transaction request and sends the transaction request to the target slave service node.
In one embodiment of the present application, in order to assist the target gateway node in performing operations such as feedback of a processing result of the transaction request by the target slave service node, and re-processing within an effective processing duration after the transaction request fails, the target gateway node needs to capture the transaction request of the corresponding target slave service node.
In addition, if the target slave service node fails to process the transaction processing request, the target gateway node needs to generate a copy processing request with the same content according to the transaction processing request sent by the master service node in order to send the same transaction processing request to the target slave service node again, and the generated copy processing request is stored in a redis cache of the target gateway node. That is, after the target captures the transaction request from the target gateway node corresponding to the service node in step 202, the method may further include: a replica processing request is derived based on the transaction request, the replica processing request being identical to the transaction request.
Step 203, the target slave service node processes the pending transaction according to the transaction request, and feeds back a transaction processing state to the target gateway node.
In the embodiment of the application, after the target slave service node processes the transaction to be processed according to the transaction processing request, the transaction processing state needs to be fed back to the target gateway node so that the target gateway node determines whether to send the transaction processing request again or feed back the transaction processing result to the master service node. Wherein the transaction states include a successful processing state and a failed processing state. The form of the target feeding back the transaction status from the service node to the target gateway node is not limited, e.g. the target may feed back the transaction status from the service node directly to the target gateway node in text form, or the target may feed back the status code identifying the difference to the target gateway node.
Step 204, the target gateway node determines whether to send the transaction processing request of the pending transaction to the target slave service node again based on the transaction processing state and the effective processing duration, so that the target slave service node successfully processes the pending transaction.
In the embodiment of the application, when the transaction processing state is a successful processing state, the target service node is indicated to no longer need to process the transaction to be processed, namely the target gateway node is no longer needed to send a transaction processing request to the target slave service node, a session can be generated, and the transaction processing result is fed back to the master service node through the generated session, so that the master service node can process the transaction in the next step. At this time, the transaction request includes a callback address for the master service node, and in the step 204, "the target gateway node determines whether to send the transaction request of the transaction to be processed to the target slave service node again based on the transaction state and the valid processing duration, so that the target slave service node successfully processes the transaction to be processed" may be:
if the transaction state is a successful processing state, the target gateway node determines that the transaction request is no longer sent to the service node;
and the target gateway node feeds back the information of successful processing of the target slave service node on the transaction to be processed to the master service node based on the callback address.
In the embodiment of the present application, when the transaction processing state is the failure processing state, since the transaction processing of each node in a service logic must be kept consistent, in order to keep the target slave service node and other service nodes in a successful processing state, the target slave service node needs to process the transaction to be processed again within the valid processing time period, that is, the target gateway node needs to send the transaction processing request to the target slave service node again within the valid processing time period, and in the step 204, "the target gateway node determines whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the valid processing time period, so that the target slave service node can successfully process the transaction to be processed" may be:
if the transaction processing state is a failure processing state, the target gateway node determines whether the effective processing time length of the transaction processing request is exceeded or not based on the current moment;
if yes, the target gateway node determines that the transaction request is not sent to the service node any more;
if not, the target gateway node determines to send the transaction processing request of the transaction to be processed to the target slave service node again based on the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
In one embodiment of the present application, since there may be a plurality of transaction requests of the transaction to be processed in the target gateway node, in order to make each transaction request have a chance to be processed by the target slave service node, the target gateway node may set processing requirement information of each transaction request, that is, the target gateway node sends the processing requirement information of each request to the target slave service node, so as to avoid a plurality of processing requirement information stagnation. The above step "the target gateway node determines to send the transaction request of the pending transaction to the target slave service node again based on the valid processing duration" may be:
the target gateway node sets processing requirement information of the transaction processing request based on the effective processing time length;
the target network node stores the processing requirement information and the transaction request into a buffer area corresponding to the target gateway node;
and the target gateway node sends the transaction processing request to the target slave service node based on the processing requirement information and the effective processing time length until the target slave service node successfully processes the transaction to be processed.
In one embodiment of the present application, the processing requirement information includes a target number of times the target gateway node transmits the transaction request to the target slave service node, and an interval duration of each transmission of the transaction request; the step "the target gateway node sends the transaction processing request to the target slave service node based on the processing requirement information and the valid processing duration until the target slave service node successfully processes the transaction to be processed" may be:
the target gateway node sequentially sends the transaction processing request to the target slave service node based on the interval duration;
and if the number of times that the target gateway node sends the transaction processing request to the target slave service node reaches the target number of times, or the target slave service node successfully processes the transaction to be processed, stopping sending the transaction processing request.
For example, the effective processing duration of one transaction request is 30 seconds, and the target gateway node may also send the transaction request to the target slave service node 3 times, and the time interval between each time is 10 seconds, that is, the target gateway node sends the transaction request to the target slave service node every 10 seconds according to the processing requirement information until the transaction request is sent to 3 times. Further, if in any one of them the target successfully processes the pending transaction from the service node, the subsequent retransmission is stopped.
In the embodiment of the application, the setting of the processing requirement information is not limited, and the setting of the processing requirement information can also be that only the time interval of each sending is set, for example, the effective processing duration of one transaction processing request is 30 seconds, the target gateway node is set to send to the target slave service node at intervals of 5 seconds for the first time, send to the target slave service node at intervals of 8 seconds for the second time, send to the target slave service node at intervals of 10 seconds for the third time, and send to the target slave service node at intervals of 8 seconds for the fourth time.
In one embodiment of the present application, after the transaction request includes the callback address for the master service node, and if the step is yes, the target gateway node determines that the transaction request is no longer sent to the slave service node, it may further be:
and the target gateway node feeds back the information of the failure of the target slave service node to process the transaction to be processed to the master service node based on the callback address.
In the embodiment of the application, after a transaction request timeout is discarded, the target gateway node can send failure processing information to the main service node based on the callback address. In addition, the target gateway node may not send failure processing information to the main service node, and after the main service node does not receive successful processing information within a certain time, the target gateway node may also automatically determine that the transaction to be processed fails.
In one embodiment of the present application, when the target gateway node obtains the transaction request sent by the main service node, and the target gateway node derives a copy processing request identical to the transaction request, the target gateway node may generate a new transaction request sent to the service node again according to the copy processing request. At this time, if no, the target gateway node determines that the transaction processing request of the transaction to be processed is sent to the target slave service node again based on the effective processing duration, and if no, the target gateway node generates a new transaction processing request sent to the target slave service node again based on the copy processing request; and sending the new transaction request to the target slave service node again based on the effective processing duration.
In the embodiment of the application, when the target slave service node successfully processes the transaction processing request, the copy processing request is not used any more. The target gateway node needs to periodically clear the generated copy processing request.
In the embodiment of the application, the target gateway node can directly resend the original transaction request to the target service node without generating a new transaction request based on the copy processing request.
All the above technical solutions may be combined to form an optional embodiment of the present application, and will not be described in detail herein.
The embodiment of the application provides a distributed transaction processing method, wherein corresponding gateway nodes are arranged for each service node in a TCC distributed transaction architecture system, when a main service node sends a transaction processing request to the service node, the gateway node corresponding to the service node can capture the transaction processing request first and then send the transaction processing request to the service node, and when the service node fails to process once, the gateway node can send the transaction processing request to the service node for a plurality of times based on the effective processing time of the transaction processing request, so that the service node only needs to process the transaction processing request sent by the gateway node, and other operations such as distributing a plurality of transactions are not needed to be made for successfully processing the transaction processing request, so that the system design of the service node is simpler, and the operation efficiency and the performance of the service node are further improved.
In the embodiment of the present application, please refer to another flowchart of the distributed transaction processing method shown in fig. 3, the master service node X sends a transaction request to the gateway node G, the gateway node G derives the request 1 according to the request, stores the request 1 in the redis cache of the gateway node G, then the gateway node G sends the request to the slave service node a, processes the request from the service node a, if the processing of the request from the service node a is successful, the gateway node G transmits the callback address of the master service node X to the return value of the service node a, if the processing of the service node a fails, the gateway node G resets the processing time of the request 1, the gateway node G determines all request lists of the requests 1 that the current time point needs to execute to satisfy the set processing time, determines the request 1 in the list in the validity period, and the gateway node G concurrently processes the request 1 in bulk, i.e. sends the request 1 in the validity period to the slave service node a again, determines the request 1 that is timed out in the list, and discards the request 1 from the redis cache.
In order to facilitate better implementation of the distributed transaction processing method according to the embodiment of the present application, the embodiment of the present application further provides a distributed transaction processing device. Referring to fig. 4, fig. 4 is a schematic structural diagram of a distributed transaction processing apparatus according to an embodiment of the application. The distributed transaction processing apparatus is applied to a TCC distributed transaction architecture system, which includes at least one master service node, at least one slave service node, and gateway nodes corresponding to the slave service nodes, and may include a request transmitting unit 401, a request capturing unit 402, a transaction processing unit 403, and a determining unit 404.
Wherein the request sending unit 401 is configured to cause the master service node to send a transaction request to a target slave service node in the slave service node, where the transaction request includes an effective processing duration of a transaction to be processed;
a request capturing unit 402, configured to cause a target gateway node corresponding to the target slave service node to capture the transaction request, and send the transaction request to the target slave service node;
a transaction processing unit 403, configured to enable the target slave service node to process the transaction to be processed according to the transaction processing request, and feed back a transaction processing state to the target gateway node;
A determining unit 404, configured to cause the target gateway node to determine, based on the transaction status and the valid processing duration, whether to send, again, a transaction request of the pending transaction to the target slave service node, so that the target slave service node successfully processes the pending transaction.
Optionally, the transaction request includes a callback address for the main service node, and the determining unit 404 is further configured to:
if the transaction state is a successful processing state, the target gateway node determines that the transaction request is no longer sent to the service node;
and the target gateway node feeds back the information of successful processing of the target slave service node on the transaction to be processed to the master service node based on the callback address.
Optionally, the transaction request includes a callback address for the main service node, and the determining unit 404 is further configured to:
if the transaction processing state is a failure processing state, the target gateway node determines whether the effective processing time length of the transaction processing request is exceeded or not based on the current moment;
if yes, the target gateway node determines that the transaction request is not sent to the service node any more;
If not, the target gateway node determines to send the transaction processing request of the transaction to be processed to the target slave service node again based on the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
Optionally, the determining unit 404 is further configured to:
the target gateway node sets processing requirement information of the transaction processing request based on the effective processing time length;
the target network node stores the processing requirement information and the transaction request into a buffer area corresponding to the target gateway node;
and the target gateway node sends the transaction processing request to the target slave service node based on the processing requirement information and the effective processing time length until the target slave service node successfully processes the transaction to be processed.
Optionally, the processing requirement information includes a target number of times the target gateway node sends the transaction request to the target slave service node, and an interval duration of each time the transaction request is sent;
the determining unit 404 is further configured to:
the target gateway node sequentially sends the transaction processing request to the target slave service node based on the interval duration;
And if the number of times that the target gateway node sends the transaction processing request to the target slave service node reaches the target number of times, or the target slave service node successfully processes the transaction to be processed, stopping sending the transaction processing request.
Optionally, the transaction request includes a callback address for the main service node, and the determining unit 404 is further configured to:
and the target gateway node feeds back the information of the failure of the target slave service node to process the transaction to be processed to the master service node based on the callback address.
Optionally, the request capturing unit 402 is further configured to:
deriving a replica processing request based on the transaction request, the replica processing request being identical to the transaction request;
the determining unit 404 is further configured to:
if not, the target gateway node generates a new transaction request which is sent to the target slave service node again based on the copy processing request;
and sending the new transaction request to the target slave service node again based on the effective processing duration.
All the above technical solutions may be combined to form an optional embodiment of the present application, and will not be described in detail herein.
In the distributed transaction processing device provided by the embodiment of the application, corresponding gateway nodes are arranged for each service node in the TCC distributed transaction architecture system, when a main service node sends a transaction processing request to the service node, the gateway node corresponding to the service node can capture the transaction processing request first and then send the transaction processing request to the service node, and when the service node fails in one-time processing, the gateway node can send the transaction processing request to the service node for a plurality of times based on the effective processing time of the transaction processing request, so that the service node only needs to process the transaction processing request sent by the gateway node, and other operations such as other distribution of a plurality of transactions are not needed to be made for successfully processing the transaction processing request, so that the system design of the service node is simpler, and the operation efficiency and the performance of the service node are further improved.
Correspondingly, the embodiment of the application also provides computer equipment, which can be a terminal, and the terminal can be terminal equipment such as a smart phone, a tablet personal computer, a notebook computer, a touch screen, a game machine, a personal computer, a personal digital assistant and the like. Fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application, as shown in fig. 5. The computer device 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. It will be appreciated by those skilled in the art that the computer device structure shown in the figures is not limiting of the computer device and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The processor 501 is a control center of the computer device 500, connects various parts of the entire computer device 500 using various interfaces and lines, and performs various functions of the computer device 500 and processes data by running or loading software programs and/or modules stored in the memory 502, and calling data stored in the memory 502, thereby performing overall monitoring of the computer device 500.
In the embodiment of the present application, the processor 501 in the computer device 500 loads the instructions corresponding to the processes of one or more application programs into the memory 502 according to the following steps, and the processor 501 executes the application programs stored in the memory 502, so as to implement various functions:
the master service node sends a transaction processing request to a target slave service node in the slave service nodes, wherein the transaction processing request comprises effective processing time length of a transaction to be processed;
capturing the transaction request by a target gateway node corresponding to the target slave service node, and sending the transaction request to the target slave service node;
the target slave service node processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node;
And the target gateway node determines whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Optionally, as shown in fig. 5, the computer device 500 further includes: a touch display screen 503, a radio frequency circuit 504, an audio circuit 505, an input unit 506, and a power supply 507. The processor 501 is electrically connected to the touch display 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art will appreciate that the computer device structure shown in FIG. 5 is not limiting of the computer device and may include more or fewer components than shown, or may be combined with certain components, or a different arrangement of components.
The touch display screen 503 may be used to display a graphical user interface and receive operation instructions generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. Wherein the display panel may be used to display information entered by a user or provided to a user as well as various graphical user interfaces of a computer device, which may be composed of graphics, text, icons, video, and any combination thereof. Alternatively, the display panel may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel may be used to collect touch operations on or near the user (such as the user redeeming a finger, stylus, or any other suitable object or accessory on or near the touch panel) and generate corresponding operational instructions, and the operational instructions execute a corresponding program. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 501, and can receive commands from the processor 501 and execute them. The touch panel may overlay the display panel, and upon detection of a touch operation thereon or thereabout, the touch panel is passed to the processor 501 to determine the type of touch event, and the processor 501 then provides a corresponding visual output on the display panel based on the type of touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 503 to realize the input and output functions. In some embodiments, however, the touch panel and the touch panel may be implemented as two separate components to perform the input and output functions. I.e. the touch sensitive display 503 may also implement an input function as part of the input unit 506.
The radio frequency circuitry 504 may be used to transceive radio frequency signals to establish wireless communications with a network device or other computer device via wireless communications.
The audio circuitry 505 may be used to provide an audio interface between a user and a computer device through speakers, microphones, and so on. The audio circuit 505 may transmit the received electrical signal after audio data conversion to a speaker, and convert the electrical signal into a sound signal for output by the speaker; on the other hand, the microphone converts the collected sound signals into electrical signals, which are received by the audio circuit 505 and converted into audio data, which are processed by the audio data output processor 501 for transmission to, for example, another computer device via the radio frequency circuit 504, or which are output to the memory 502 for further processing. The audio circuit 505 may also include an ear bud jack to provide communication of the peripheral ear bud with the computer device.
The input unit 506 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and to generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 507 is used to power the various components of the computer device 500. Alternatively, the power supply 507 may be logically connected to the processor 501 through a power management system, so as to implement functions of managing charging, discharging, and power consumption management through the power management system. The power supply 507 may also include one or more of any components, such as a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown in fig. 5, the computer device 500 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
As can be seen from the foregoing, in the computer device provided in this embodiment, a corresponding gateway node is set for each service node in the TCC distributed transaction architecture system, when the master service node sends a transaction request to the service node, the gateway node corresponding to the service node captures the transaction request first, and then sends the transaction request to the service node, and when the service node fails in one processing, the gateway node sends the transaction request to the service node multiple times based on the effective processing time of the transaction request, so that it is ensured that only the transaction request sent by the service node needs to be processed, and other operations such as distributing multiple transactions need not be made for successfully processing the transaction request, so that the system design of the service node is simpler, and the operation efficiency and performance of the service node are further improved.
Those of ordinary skill in the art will appreciate that all or a portion of the steps of the various methods of the above embodiments may be performed by instructions, or by instructions controlling associated hardware, which may be stored in a computer-readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer readable storage medium having stored therein a plurality of computer programs that can be loaded by a processor to perform the steps of any of the distributed transaction methods provided by the embodiments of the present application. For example, the computer program may perform the steps of:
the master service node sends a transaction processing request to a target slave service node in the slave service nodes, wherein the transaction processing request comprises effective processing time length of a transaction to be processed;
capturing the transaction request by a target gateway node corresponding to the target slave service node, and sending the transaction request to the target slave service node;
the target slave service node processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node;
And the target gateway node determines whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
The specific implementation of each operation above may be referred to the previous embodiments, and will not be described herein.
Wherein the storage medium may include: read Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The steps in any one of the distributed transaction processing methods provided by the embodiments of the present application may be executed by the computer program stored in the storage medium, so that the beneficial effects that any one of the distributed transaction processing methods provided by the embodiments of the present application may be achieved, which are detailed in the previous embodiments and will not be described herein.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and for parts of one embodiment that are not described in detail, reference may be made to related descriptions of other embodiments.
The foregoing describes in detail a distributed transaction processing method, apparatus, computer device and storage medium provided by the embodiments of the present application, and specific examples are applied to illustrate the principles and embodiments of the present application, where the foregoing examples are only used to help understand the technical solution and core ideas of the present application; those of ordinary skill in the art will appreciate that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (10)

1. A distributed transaction processing method, applied to a TCC distributed transaction architecture system including at least one master service node, at least one slave service node, and a gateway node corresponding to each of the slave service nodes, the method comprising:
the master service node sends a transaction processing request to a target slave service node in the slave service nodes, wherein the transaction processing request comprises effective processing time length of a transaction to be processed;
capturing the transaction request by a target gateway node corresponding to the target slave service node, and sending the transaction request to the target slave service node;
the target slave service node processes the transaction to be processed according to the transaction processing request and feeds back a transaction processing state to the target gateway node;
and the target gateway node determines whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
2. The method of claim 1, wherein the transaction request includes a callback address for the master service node, wherein the target gateway node determining whether to send the transaction request for the pending transaction again to the target slave service node based on the transaction state and the effective processing time period, to cause the target slave service node to successfully process the pending transaction, comprises:
If the transaction state is a successful processing state, the target gateway node determines that the transaction request of the transaction to be processed is not sent to the service node any more;
and the target gateway node feeds back the information of successful processing of the target slave service node on the transaction to be processed to the master service node based on the callback address.
3. The method of claim 1, wherein the target gateway node determining whether to send the transaction request again to the target slave service node based on the transaction state and the effective processing time period to cause the target slave service node to successfully process the pending transaction comprises:
if the transaction processing state is a failure processing state, the target gateway node determines whether the effective processing time length of the transaction processing request is exceeded or not based on the current moment;
if yes, the target gateway node determines that the transaction processing request of the transaction to be processed is not sent to the service node any more;
if not, the target gateway node determines to send the transaction processing request of the transaction to be processed to the target slave service node again based on the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
4. A method according to claim 3, wherein the target gateway node determining to send the transaction request for the pending transaction again to the target slave service node based on the effective processing duration comprises:
the target gateway node sets processing requirement information of the transaction processing request based on the effective processing time length;
the target network node stores the processing requirement information and the transaction request into a buffer area corresponding to the target gateway node;
and the target gateway node sends a transaction processing request of the transaction to be processed to the target slave service node based on the processing requirement information and the effective processing time length until the target slave service node successfully processes the transaction to be processed.
5. The method of claim 4, wherein the processing requirement information includes a target number of times the target gateway node sends the transaction request to the target slave service node, and an interval duration for each transmission of the transaction request;
the target gateway node sends a transaction processing request of the transaction to be processed to the target slave service node based on the processing requirement information and the effective processing duration until the target slave service node successfully processes the transaction to be processed, and the method comprises the following steps:
The target gateway node sequentially sends the transaction processing request of the transaction to be processed to the target slave service node based on the interval duration;
and if the number of times of sending the transaction processing request of the transaction to be processed to the target slave service node reaches the target number of times, or the target slave service node successfully processes the transaction to be processed, stopping sending the transaction processing request of the transaction to be processed.
6. A method according to claim 3, wherein the transaction request includes a callback address for the master service node, and if so, the target gateway node determines that the transaction request for the pending transaction is no longer sent to the slave service node, further comprising:
and the target gateway node feeds back the information of the failure of the target slave service node to process the transaction to be processed to the master service node based on the callback address.
7. A method according to claim 3, wherein after the target captures the transaction request from the target gateway node corresponding to the service node, further comprising:
deriving a replica processing request based on the transaction request, the replica processing request being identical to the transaction request;
If not, the target gateway node determines to send the transaction processing request of the pending transaction to the target slave service node again based on the effective processing duration, including:
if not, the target gateway node generates a new transaction request which is sent to the target slave service node again based on the copy processing request;
and sending the new transaction request to the target slave service node again based on the effective processing duration.
8. A distributed transaction processing apparatus for use in a TCC distributed transaction architecture system including at least one master service node, at least one slave service node, and a gateway node for each of the slave service nodes, the apparatus comprising:
a request sending unit, configured to enable the master service node to send a transaction processing request to a target slave service node in the slave service node, where the transaction processing request includes an effective processing duration of a transaction to be processed;
a request capturing unit, configured to enable the target gateway node corresponding to the target slave service node to capture the transaction request, and send the transaction request to the target slave service node;
The transaction processing unit is used for enabling the target slave service node to process the transaction to be processed according to the transaction processing request and feeding back a transaction processing state to the target gateway node;
and the determining unit is used for enabling the target gateway node to determine whether to send the transaction processing request of the transaction to be processed to the target slave service node again based on the transaction processing state and the effective processing time length so as to enable the target slave service node to successfully process the transaction to be processed.
9. A computer device, comprising:
a memory for storing a computer program;
a processor for implementing the steps in the distributed transaction processing method according to any of claims 1 to 7 when said computer program is executed.
10. A computer readable storage medium, characterized in that it has stored thereon a computer program which, when executed by a processor, implements the steps of the distributed transaction method according to any of claims 1 to 7.
CN202210369977.5A 2022-04-08 2022-04-08 Distributed transaction processing method, device, computer equipment and storage medium Pending CN116938927A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210369977.5A CN116938927A (en) 2022-04-08 2022-04-08 Distributed transaction processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210369977.5A CN116938927A (en) 2022-04-08 2022-04-08 Distributed transaction processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116938927A true CN116938927A (en) 2023-10-24

Family

ID=88374389

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210369977.5A Pending CN116938927A (en) 2022-04-08 2022-04-08 Distributed transaction processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116938927A (en)

Similar Documents

Publication Publication Date Title
EP3547715B1 (en) Method and apparatus for reducing continuous-wakeup delay of bluetooth loudspeaker, and bluetooth loudspeaker
CN104106060A (en) Power efficient brokered communication supporting notification blocking
CN109002349A (en) Application program exchange method, implementation method, device, equipment and medium
CN113506100B (en) Alliance chain data processing method, device, computer equipment and storage medium
CN111200606A (en) Deep learning model task processing method, system, server and storage medium
CN115345464A (en) Service order dispatching method and device, computer equipment and storage medium
CN112612496A (en) Intelligent contract operation management method, device, equipment and computer storage medium
CN115509770B (en) Micro-service calling method and device, electronic equipment and readable storage medium
CN104735134B (en) A kind of method and apparatus serviced for providing calculating
CN116938927A (en) Distributed transaction processing method, device, computer equipment and storage medium
CN113342776A (en) Transaction information migration method, device, equipment and medium based on intelligent contract
CN113806801B (en) Transaction information uplink method, device, computer equipment and storage medium
CN114422535B (en) Method, apparatus, computer device and storage medium for distributing contracts in blockchain
CN113360883B (en) Intelligent contract processing method and device, computer equipment and storage medium
CN116308786A (en) Processing method, system, electronic equipment and readable storage medium for blockchain transaction
CN115622968A (en) Black product behavior blocking method and device, computer equipment and storage medium
CN115222515A (en) Capital clearing method, device, computer equipment and storage medium
CN116128619A (en) Service processing method, device, computer equipment and storage medium
CN116233130A (en) Block chain-based registration method, device, electronic equipment and readable storage medium
CN116192845A (en) Device processing method, device, electronic device and storage medium
CN112905563A (en) Processing method and device of sign-in data, storage medium and computer equipment
CN114661804A (en) Data processing method and device, computer equipment and storage medium
CN115330206A (en) Service scale-based order dispatching method and device, computer equipment and storage medium
CN116384998A (en) DID contract management method, DID contract management device, electronic equipment and readable storage medium
CN116384997A (en) DID contract management method, DID contract management system, electronic device and readable storage medium

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