Transaction processing method and apparatus, and device and medium

By generating and sending transaction identification information and write order in the blockchain, slave nodes are allowed to execute and write transactions in parallel, solving the problem of low efficiency in transaction processing of slave nodes and achieving consistency and accuracy of results.

WO2024216948A9PCT designated stage expired Publication Date: 2024-12-05TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/131700
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-04-21
Filing Date
2023-11-15
Publication Date
2024-12-05

AI Technical Summary

Technical Problem

In blockchain, the slave node needs to execute multiple transactions in serial to ensure consistency with the transaction snapshot results of the master node, resulting in low transaction processing efficiency.

Method used

The master node generates execution information containing transaction identification information and write order, instructing the slave node to execute multiple transactions in parallel and write transaction results in a specific order, ensuring the transaction processing efficiency and result consistency of the slave node.

Benefits of technology

It improves the transaction processing efficiency of slave nodes, ensures the consistency of execution results of slave nodes and master nodes in transaction snapshots, and improves the accuracy of transaction processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023131700_05122024_PF_FP_ABST
    Figure CN2023131700_05122024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are a transaction processing method and apparatus, and a device and a medium, which can be applied to various scenarios such as intelligent transportation, aided driving, cloud technology and artificial intelligence. The transaction processing method comprises: a slave node receiving execution information including transaction identification information and write information including an execution result write sequence, which are sent by a master node; then, executing in parallel a plurality of transactions corresponding to the transaction identification information, so as to obtain execution results of the plurality of transactions; and then sequentially writing the execution results of the plurality of transactions into a transaction snapshot of the slave node according to the write sequence. The technical solution of the present application improves the transaction processing efficiency and accuracy of the slave node.
Need to check novelty before this filing date? Find Prior Art

Description

Transaction processing methods, devices, equipment, and media

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 21, 2023, with application number 202310442652X and application name “Transaction Processing Method, Device, Equipment, and Medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] This application relates to the field of blockchain technology, and specifically to transaction processing technology in blockchain. Background Art

[0003] In the blockchain, nodes are divided into master nodes and slave nodes. Master nodes and slave nodes usually have differences in hardware configuration, resource allocation strategies, etc., so the time required for master nodes and slave nodes to process transactions is different.

[0004] In related technologies, when multiple transactions involve write-write conflicts, the master node can execute the multiple transactions in parallel. However, the time required for the slave node and the master node to process the transactions is different. In order to ensure that the execution results ultimately written into the respective transaction snapshots of the slave node and the master node are consistent, the slave node needs to execute the multiple transactions serially, which results in low transaction processing efficiency of the slave node.

[0005] Therefore, how to improve the transaction processing efficiency of slave nodes is an urgent problem to be solved.

[0006] Summary of the Invention

[0007] The embodiments of the present application provide a transaction processing method, apparatus, device, and medium, which improve the transaction processing efficiency of slave nodes.

[0008] In a first aspect, an embodiment of the present application provides a transaction processing method, which is executed by a computer device serving as a master node, the method comprising: generating execution information containing transaction identification information, the execution information being used to instruct a slave node to execute multiple transactions corresponding to the transaction identification information in parallel; generating write information containing an execution result writing order, the write information being used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order; and sending the execution information and the write information to the slave node.

[0009] In a second aspect, an embodiment of the present application provides a transaction processing method, which is executed by a computer device serving as a slave node, the method comprising: receiving execution information containing transaction identification information and write information containing the write order of execution results sent by a master node; executing multiple transactions corresponding to the transaction identification information in parallel to obtain the execution results of the multiple transactions; and writing the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order.

[0010] In a third aspect, an embodiment of the present application provides a transaction processing device, which is configured at a master node, and the device includes: a first generation module, configured to generate execution information containing transaction identification information, and the execution information is used to instruct the slave node to execute multiple transactions corresponding to the transaction identification information in parallel; a second generation module, configured to generate write information containing the write order of the execution results, and the write information is used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order; a sending module, configured to send the execution information and the write information to the slave node.

[0011] In a fourth aspect, an embodiment of the present application provides a transaction processing device, which is configured on a slave node, and the device includes: a receiving module, configured to receive execution information containing transaction identification information and write information containing the write order of execution results sent by the master node; an execution module, configured to execute multiple transactions corresponding to the transaction identification information in parallel to obtain the execution results of the multiple transactions; and a writing module, configured to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order.

[0012] In a fifth aspect, an embodiment of the present application provides an electronic device comprising one or more processors; and a memory for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to implement the transaction processing method as described above.

[0013] In a sixth aspect, an embodiment of the present application provides a computer-readable medium on which a computer program is stored, and when the computer program is executed by a processor, the transaction processing method as described above is implemented.

[0014] In a seventh aspect, an embodiment of the present application provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the transaction processing method described above.

[0015] In the technical solutions provided in the embodiments of this application:

[0016] The master node generates execution information containing transaction identification information and write information containing the execution result write order, and sends the execution information and write information to the slave node.

[0017] On the one hand, based on the execution information, the slave node executes multiple transactions corresponding to the transaction identification information in the execution information in parallel, and obtains execution results corresponding to the multiple transactions. This avoids the phenomenon in related technologies that the slave node serially executes multiple transactions corresponding to the transaction identification information, resulting in low transaction processing efficiency of the slave node. That is, the transaction processing efficiency of the slave node is greatly improved.

[0018] On the one hand, based on the write information, the slave node writes the execution results of multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order of the execution results in the write information, avoiding the phenomenon in related technologies that the execution results written into the transaction snapshot by the slave node are inconsistent with the execution results written into the transaction snapshot by the master node, that is, ensuring the consistency of the execution results of the slave node and the master node in the transaction snapshot, and improving the accuracy of transaction processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 is a schematic diagram of the structure of a blockchain network;

[0020] Figure 2 is a schematic diagram of the connection relationship between blocks in the blockchain;

[0021] FIG3 is a schematic diagram of an exemplary master node and slave node transaction processing process in the related art;

[0022] FIG4 is a schematic diagram of an exemplary implementation environment to which the technical solutions of the embodiments of the present application can be applied;

[0023] FIG5 is a schematic diagram of a transaction processing process between a master node and a slave node, shown in an exemplary embodiment of the present application;

[0024] FIG6 is a flow chart of a transaction processing method shown in an exemplary embodiment of the present application;

[0025] FIG7 is a flow chart of a transaction processing method shown in another exemplary embodiment of the present application;

[0026] FIG8 is a flow chart of a transaction processing method shown in another exemplary embodiment of the present application;

[0027] FIG9 is a flowchart of a transaction processing method shown in another exemplary embodiment of the present application;

[0028] FIG10 is a schematic diagram of an exemplary master node repeatedly executing transactions in the related art;

[0029] FIG11 is a flowchart of a transaction processing method shown in another exemplary embodiment of the present application;

[0030] FIG12 is a schematic diagram of a transaction processing process between a master node and a slave node shown in an exemplary embodiment of the present application;

[0031] FIG13 is a flow chart of a transaction processing method according to another exemplary embodiment of the present application;

[0032] FIG14 is a flow chart of a transaction processing method according to another exemplary embodiment of the present application;

[0033] FIG15 is a flowchart of a transaction processing method according to another exemplary embodiment of the present application;

[0034] FIG16 is a flow chart of a transaction processing method according to an exemplary embodiment of the present application;

[0035] FIG17 is a flow chart of a transaction processing method according to another exemplary embodiment of the present application;

[0036] FIG18 is a flow chart of a transaction processing method according to an exemplary embodiment of the present application;

[0037] FIG19 is a flowchart of a transaction processing method according to another exemplary embodiment of the present application;

[0038] FIG20 is a flowchart of a transaction processing method shown in another exemplary embodiment of the present application;

[0039] FIG21 is a flowchart of a transaction processing method shown in another exemplary embodiment of the present application;

[0040] FIG22 is a flowchart of a transaction processing method according to another exemplary embodiment of the present application;

[0041] FIG23 is a flowchart of a transaction processing method according to another exemplary embodiment of the present application;

[0042] FIG24 is a block diagram of a transaction processing device according to an embodiment of the present application;

[0043] FIG25 is a block diagram of a transaction processing device according to an embodiment of the present application;

[0044] FIG26 is a schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0045] Before introducing the technical solutions of the embodiments of the present application, the blockchain technology used in the embodiments of the present application is first introduced.

[0046] Blockchain is a new application model for computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, a blockchain is a decentralized database, a series of linked data blocks (i.e., blocks) generated using cryptographic methods. Each block contains information about a batch of online transactions, used to verify the validity of that information (to prevent counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, the platform product and service layer, and the application service layer.

[0047] As mentioned above, a blockchain is essentially a decentralized database, maintained by the nodes in a blockchain network. For example, referring to Figure 1, the blockchain network shown in Figure 1 may include multiple nodes 101, each of which may be the client nodes that form the blockchain network. Each node 101 may receive input information during normal operation and, based on the received input information, maintain shared data within the blockchain network. To ensure information interoperability within the blockchain network, information connections may exist between each node in the blockchain network, enabling information transmission between nodes via these connections. For example, when any node in the blockchain network receives input information, the other nodes in the blockchain network obtain the input information based on a consensus algorithm and store it as shared data, ensuring that the data stored by all nodes in the blockchain network is consistent.

[0048] Each node in a blockchain network has a corresponding node identifier, and each node in the blockchain network can store the node identifiers of other nodes so that it can subsequently broadcast generated blocks to other nodes in the blockchain network based on the node identifiers of other nodes. Each node can maintain a node identifier list, storing the node name and node identifier in the node identifier list. The node identifier can be an IP (Internet Protocol) address or any other information that can be used to identify the node.

[0049] Each node in a blockchain network stores an identical blockchain. A blockchain consists of multiple blocks. (See Figure 2.) The genesis block includes a block header and a block body. The block header stores input information features, a version number, a timestamp, and a difficulty value, while the block body stores the input information. The next block, with the genesis block as its parent, also includes a block header and a block body. The block header stores the input information features of the current block, the block header features, version number, timestamp, and difficulty value of the parent block, and so on. This ensures that the block data stored in each block in the blockchain is linked to the block data stored in the parent block, ensuring the security of the input information in the block.

[0050] Each node in the blockchain network can be a server or a terminal device. The server can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and intelligent platforms. The terminal device can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The nodes can be directly or indirectly connected through wired or wireless communication, which is not limited in this application.

[0051] Cloud computing, as mentioned above, refers to the delivery and usage model of IT infrastructure. Specifically, it refers to the on-demand, scalable access to required resources over the Internet. Broadly speaking, cloud computing refers to the delivery and usage model of services, meaning the on-demand, scalable access to required services over the Internet. These services can be related to IT, software, the internet, or other services. Cloud computing is the product of the convergence of traditional computer and network technologies, including grid computing, distributed computing, parallel computing, utility computing, network storage technologies, virtualization, and load balancing. Driven by the growth of the internet, real-time data streams, the diversity of connected devices, and the demands of search services, social networks, mobile commerce, and open collaboration, cloud computing has rapidly developed.

[0052] The aforementioned blockchains are generally divided into three types: public blockchain, private blockchain, and consortium blockchain. Furthermore, combinations of these types are possible, such as private blockchain + consortium blockchain, or consortium blockchain + public blockchain.

[0053] Public blockchains are the most decentralized. Participants in a public blockchain (also known as nodes in a blockchain network) can access data records, participate in transactions, and compete for the right to record new blocks. Furthermore, each node can freely join or leave the blockchain network and perform related operations.

[0054] In contrast, a private blockchain network's write permissions are controlled by a specific organization or institution, while data read permissions are regulated by that organization. Simply put, a private blockchain can be a weakly centralized system with strict node restrictions and a small number of nodes. This type of blockchain is more suitable for internal use within a specific organization.

[0055] Consortium blockchains are a cross between public and private blockchains, enabling partial decentralization. Each node in a consortium chain typically has a corresponding entity or organization. Nodes are authorized to join the network and form a stakeholder alliance to jointly maintain the operation of the blockchain network.

[0056] The aforementioned blockchains deploy smart contracts, which are computer protocols designed to communicate, verify, or execute contracts in an information-based manner. Smart contracts allow for trusted transactions without a third party. Smart contracts are essentially code deployed on the blockchain to implement specific functions.

[0057] Understandably, a transaction is a user's request for an operation on a smart contract interface deployed on the blockchain. A transaction is initiated by the user and sent from the user's client to a node in the blockchain (called a master node). Upon receiving the transaction, the node invokes the corresponding smart contract based on the contract address and interface specified in the transaction. It then notifies other nodes (called slave nodes) of the transaction. Upon receiving the transaction, the other nodes then invoke the corresponding smart contract based on the contract address and interface specified in the transaction.

[0058] As described in the blockchain technology described in the previous embodiments, master nodes and slave nodes in a blockchain typically differ in hardware configuration, resource allocation strategies, and other factors. Consequently, the time required for master and slave nodes to process transactions can vary. When multiple transactions involve write-write conflicts, the master node can execute these transactions in parallel. However, due to the different processing times required for slave and master nodes, to ensure consistency in the execution results ultimately written into their respective transaction snapshots, the slave nodes must execute these transactions serially, resulting in low transaction processing efficiency for the slave nodes.

[0059] For ease of understanding, please refer to FIG3 , which is a schematic diagram of the transaction processing process of the master node and the slave node in the related art; as shown in FIG3 :

[0060] The execution process of a smart contract consists of two parts. The first is to perform other operations (such as calculation operations), and then write the execution results of the transaction (corresponding to the KV) into the transaction snapshot of the master node. It can be understood that the step of performing other operations is the step of executing the transaction in parallel or serially to obtain the execution results of the transaction, and the step of writing the transaction snapshot is the step of writing the execution results of the transaction serially into the transaction snapshot after the transaction execution is completed and the execution results of the transaction are obtained in the embodiment of the present application.

[0061] It should be noted that for write-write conflicts, there is no process of querying K (distinguished from the read-write conflict described later), which is a forced overwrite situation.

[0062] On the master node side:

[0063] When executing other operations, they can be executed in parallel. This is because for write operations, the scope of influence during the execution process is only the current transaction execution cycle. The write set generated by the write operation will be updated to the transaction snapshot of the master node after the transaction execution is completed (if there is no conflict).

[0064] That is, for the master node, it executes three transactions, tx0, tx1, and tx2, in parallel. The transaction snapshot updated to the master node is the result of the last transaction corresponding to K, such as transaction tx1 in Figure 3. It can be understood that Figure 3 shows that transaction tx2 is executed and completed at time A, transaction tx0 is executed and completed at time B, and transaction tx1 is executed and completed at time C; that is, transaction tx2 is executed and written to the master node's transaction snapshot first, followed by transaction tx0. The execution result of transaction tx2 is replaced, and finally transaction tx1 is executed and written to the master node's transaction snapshot (the execution result of transaction tx0 is replaced).

[0065] After the master node executes transactions tx0, tx1, and tx2, it generates a Direct Acyclic Graph (DAG). The DAG instructs the slave nodes to execute transactions tx2, tx0, and tx1 serially, in the order tx2->tx0->tx1. It's understandable that when generating the DAG, the master node considers transactions tx0, tx1, and tx2 to be conflicting. This is because transactions tx0, tx1, and tx2 operate on the same key, resulting in a write-write conflict. Therefore, the master node constructs the DAG as a serial operation: tx2->tx0->tx1.

[0066] From the node side:

[0067] After receiving the DAG sent by the master node, it will operate according to the DAG, that is, serially execute transactions tx2, tx0, and tx1 in the order of tx2->tx0->tx1, and obtain the execution results of transactions tx2, tx0, and tx1; then the execution result of transaction tx2 will be written into the transaction snapshot of the slave node first, and then the execution result of transaction tx0 will be written into the transaction snapshot of the slave node, and finally the execution result of transaction tx1 will be written into the transaction snapshot of the slave node). This results in low transaction processing efficiency of the slave node.

[0068] Therefore, in order to improve the transaction processing efficiency of slave nodes, this application provides a transaction processing solution. Please refer to Figure 4, which is a schematic diagram of an implementation environment involved in this application. The implementation environment mainly includes a master node 401 and a slave node 402. It is understood that the master node 401 and the slave node 402 are connected via a network communication. The network can include various connection types, such as wireless communication links, wired and fiber optic cables, etc., wherein:

[0069] For example, master node 401 can be a server that provides various services, including but not limited to independent physical servers, server clusters or distributed systems composed of multiple physical servers, and cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. Master node 401 can also be a terminal device, including but not limited to smartphones, tablets, laptops, computers, intelligent voice interaction devices, smart home appliances, smart wearable devices, aircraft, etc.

[0070] For example, slave node 402 may be a server that provides various services, including but not limited to independent physical servers, server clusters or distributed systems composed of multiple physical servers, and cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks, and big data and artificial intelligence platforms. Slave node 402 may also be a terminal device, including but not limited to smartphones, tablets, laptops, computers, intelligent voice interaction devices, smart home appliances, smart wearable devices, aircraft, etc.

[0071] It should be noted that the number of master nodes 401 and slave nodes 402 in FIG. 4 is merely illustrative, and any number of master nodes 401 and slave nodes 402 may be provided according to actual needs.

[0072] In one embodiment of the present application, the transaction processing method may be executed by the master node 401 .

[0073] Exemplarily, the master node generates execution information containing transaction identification information, the execution information is used to instruct the slave node to execute multiple transactions corresponding to the transaction identification information in parallel; and generates write information containing the write order of the execution results, the write information is used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order; then, the execution information and the write information are sent to the slave node.

[0074] In one embodiment of the present application, the transaction processing method may be executed by the slave node 402 .

[0075] Exemplarily, the slave node receives execution information containing transaction identification information and write information containing the execution result writing order sent by the master node; then, multiple transactions corresponding to the transaction identification information are executed in parallel to obtain the execution results of the multiple transactions; then, the execution results of the multiple transactions are written into the transaction snapshot of the slave node in sequence according to the writing order.

[0076] For ease of understanding, please refer to FIG5 , which is a schematic diagram of the transaction processing process between the master node and the slave node in an embodiment of the present application; as shown in FIG5 :

[0077] On the master node side:

[0078] Execute transactions tx0, tx1, and tx2 in parallel. Afterwards, transaction tx2 is executed first and written into the transaction snapshot of the master node, followed by transaction tx0, and finally transaction tx1.

[0079] The generated DAGs are execution DAG and write DAG. The execution DAG instructs the slave node to execute transactions tx0, tx1, and tx2 in parallel. The write DAG instructs the slave node to first write the execution result of transaction tx2 to the slave node's transaction snapshot, then write the execution result of transaction tx0 to the slave node's transaction snapshot, and finally write the execution result of transaction tx1 to the slave node's transaction snapshot according to tx2->tx0->tx1.

[0080] From the node side:

[0081] Execute transactions in parallel according to the above execution DAG, that is, execute transactions tx0, tx1, and tx2 in parallel; then write the execution results of the transactions serially according to the above write DAG, that is, first write the execution result of transaction tx2 to the transaction snapshot of the slave node, then write the execution result of transaction tx0 to the transaction snapshot of the slave node, and finally write the execution result of transaction tx1 to the transaction snapshot of the slave node.

[0082] It is understandable that in order to reflect the difference between the slave node and the master node, the execution time of transaction tx0 and transaction tx1 has been deliberately adjusted in Figure 5. Specifically, Figure 5 illustrates that transaction tx1 is executed earlier than transaction tx0 on the slave node. However, when writing the execution result to the slave node's transaction snapshot, it is written according to the write DAG, that is, the execution result of transaction tx0 is written to the slave node's transaction snapshot first, and then the execution result of transaction tx1 is written to the slave node's transaction snapshot.

[0083] In this way, by implementing the embodiments of the present application, the master node generates an execution DAG and a write DAG, and the slave node executes transactions in parallel according to the execution DAG, thereby improving the transaction processing efficiency of the slave node. At the same time, the execution results of the transaction are written serially according to the write DAG, ensuring the consistency of the execution results of the slave node and the master node in the transaction snapshot.

[0084] The technical solution of the embodiment shown in Figure 4 can be applied to various scenarios, including but not limited to smart transportation, assisted driving, cloud technology, artificial intelligence, etc.; in actual applications, corresponding adjustments can be made according to specific application scenarios.

[0085] It should be noted that in the specific implementation of this application, user-related data is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0086] The following describes in detail the various implementation details of the technical solutions of the embodiments of the present application:

[0087] Please refer to Figure 6, which is a flowchart of a transaction processing method according to one embodiment of the present application. The transaction processing method can be executed by a computer device serving as a master node 401. As shown in Figure 6, the transaction processing method includes at least S601 to S603, which are described in detail as follows:

[0088] S601, generating execution information containing transaction identification information, where the execution information is used to instruct the slave node to execute multiple transactions corresponding to the transaction identification information in parallel.

[0089] In the embodiment of the present application, the transaction identification information refers to the identification information of the transaction, which is used to uniquely identify the transaction, and includes but is not limited to the transaction number, transaction name, transaction time, etc.

[0090] In the embodiment of the present application, the execution information includes identification information of multiple transactions, wherein the execution information is used to instruct the slave node to execute multiple transactions corresponding to the identification information of the multiple transactions in parallel.

[0091] For example, if the execution information includes identification information of three transactions: tx0, tx1, and tx2, then the execution information is used to instruct the slave node to execute transactions tx0, tx1, and tx2 in parallel.

[0092] S602: Generate write information containing the execution result writing order, where the write information is used to instruct the slave node to write the execution results of multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order.

[0093] The execution result writing order in the embodiments of the present application refers to the order in which the execution results of multiple transactions are written into the transaction snapshot. It is understandable that the execution result writing order is the order in which the master node writes the execution results of multiple transactions into the master node's transaction snapshot, and is also the order that the slave node should follow when writing the execution results of multiple transactions into the slave node's transaction snapshot; that is, the order in which the slave node writes the execution results of multiple transactions into the slave node's transaction snapshot is the same as the order in which the master node writes the execution results of multiple transactions into the master node's transaction snapshot, thus ensuring the consistency of the execution results ultimately written by the slave node and the master node into their respective transaction snapshots.

[0094] The write information in the embodiment of the present application includes the order in which the execution results of multiple transactions are written into the transaction snapshot of the slave node, wherein the write information is used to instruct the slave node to write the execution results of multiple transactions into the transaction snapshot of the slave node in this order.

[0095] For example, continuing with the previous example, assume that the write information includes the execution results of three transactions in the order of writing: tx2->tx0->tx1. At this time, the write information is used to instruct the slave node to write the execution result of transaction tx2 into the transaction snapshot of the slave node according to tx2->tx0->tx1, and then write the execution result of transaction tx0 into the transaction snapshot of the slave node, and finally write the execution result of transaction tx1 into the transaction snapshot of the slave node.

[0096] The transaction snapshot in the embodiment of the present application refers to the local ledger of the node, wherein the transaction snapshot of the master node refers to the local ledger of the master node, and the transaction snapshot of the slave node refers to the local ledger of the slave node, both of which are used to store the execution results of the transaction.

[0097] It should be noted that in the embodiment of the present application, S601 and S602 can be executed in parallel or in any order. In actual applications, they can be flexibly adjusted according to the specific application scenario.

[0098] S603: Send the execution information and the write information to the slave node.

[0099] In an embodiment of the present application, the master node generates execution information and write information, and then can send the execution information and write information to the slave node. Accordingly, the slave node receives the execution information and write information sent by the master node, and then, based on the transaction identification information contained in the execution information, executes multiple transactions corresponding to the transaction identification information in parallel, obtains the execution results of the multiple transactions, and then writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order contained in the write information.

[0100] In the embodiment of the present application, the master node generates execution information containing transaction identification information and write information containing the writing order of the execution results, and sends the execution information and write information to the slave node; then, the slave node can execute multiple transactions corresponding to the transaction identification information in the execution information in parallel, and obtain the execution results corresponding to the multiple transactions, thereby improving the transaction processing efficiency of the slave node. At the same time, the slave node writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order of the execution results in the write information, thereby ensuring the consistency of the execution results of the slave node and the master node in the transaction snapshot.

[0101] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG7 , the transaction processing method can include S701 to S704 and S603.

[0102] S701 to S704 are described in detail as follows:

[0103] S701, executing multiple transactions in parallel, and writing the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node.

[0104] In the embodiment of the present application, the master node can execute multiple transactions in parallel, and write the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node.

[0105] For example, if there are transactions to be executed including transaction tx0, transaction tx1 and transaction tx2, the master node executes transactions tx0, transaction tx1 and transaction tx2 in parallel, thereby obtaining the execution results of transaction tx0, the execution results of transaction tx1 and the execution results of transaction tx2; then, in the order of transaction completion, the execution result of transaction tx2 is first written into the transaction snapshot of the master node, then the execution result of transaction tx0 is written into the transaction snapshot of the master node, and finally the execution result of transaction tx1 is written into the transaction snapshot of the master node.

[0106] S702, obtaining the writing order of writing the execution results of multiple transactions into the transaction snapshot of the master node.

[0107] In an embodiment of the present application, the master node can write the execution results of multiple transactions obtained by executing multiple transactions in parallel into the transaction snapshot of the master node, and then obtain the writing order of writing the execution results of the multiple transactions into the transaction snapshot of the master node.

[0108] For example, continuing with the previous example, since the master node first writes the execution result of transaction tx2 into the master node's transaction snapshot, then writes the execution result of transaction tx0 into the master node's transaction snapshot, and finally writes the execution result of transaction tx1 into the master node's transaction snapshot; therefore, the master node obtains the execution results of transactions tx0, tx1, and tx2, and writes them into the master node's transaction snapshot in the order of tx2->tx0->tx1.

[0109] S703 , performing conflict detection on each transaction in sequence according to the writing order, and obtaining a first conflict detection result for each transaction.

[0110] In an embodiment of the present application, the master node obtains the writing order of writing the execution results of multiple transactions into the transaction snapshot of the master node. Afterwards, conflict detection can be performed on each transaction in turn according to the writing order to obtain the first conflict detection result of each transaction.

[0111] In the embodiment of the present application, conflict detection refers to detecting whether there is a conflict between reads and writes between transactions, where conflicts include write-write conflicts, read-write conflicts, and write-read conflicts.

[0112] In the embodiment of the present application, the first conflict detection result refers to the conflict detection result of each transaction obtained by performing conflict detection on each transaction during the stage of generating execution information and writing information by the master node.

[0113] For example, continuing with the previous example, since the execution results of transactions tx0, tx1, and tx2 are written into the transaction snapshot of the master node in the order of tx2->tx0->tx1, the master node first performs conflict detection on transaction tx2 and obtains the first conflict detection result C for transaction tx2. tx2 , then perform conflict detection on transaction tx0 and obtain the first conflict detection result C of transaction tx0 tx0 Finally, conflict detection is performed on transaction tx1 to obtain the first conflict detection result C of transaction tx1. tx1 .

[0114] S704: Generate execution information and write information based on the first conflict detection result.

[0115] In the embodiment of the present application, the master node obtains the first conflict detection result of each transaction, and then can generate execution information and write information based on the first conflict detection result.

[0116] For example, following the above example, we get the first conflict detection result C of transaction tx2. tx2 , the first conflict detection result C of transaction tx0 tx0 The first conflict detection result C of transaction tx1 tx1 , based on the first conflict detection result C of transaction tx2 tx2 ,,The first conflict detection result C of transaction tx0 tx0 The first conflict detection result C of transaction tx1 tx1 , generate execution information and write information.

[0117] It should be noted that, for the detailed description of S603 shown in FIG. 7 , please refer to S603 shown in FIG. 6 , which will not be repeated here.

[0118] In an embodiment of the present application, the master node executes multiple transactions in parallel, and writes the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node. Afterwards, conflict detection is performed on each transaction, and execution information and write information are generated based on the first conflict detection result of each transaction, thereby improving the accuracy of the execution information and write information generated by the master node, and providing strong support for the slave node to execute multiple transactions in parallel based on the execution information, and to write the execution results of the multiple transactions into the transaction snapshot of the slave node based on the write information.

[0119] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG8 , the transaction processing method may include S701 to S703, S801 to S804, and S603.

[0120] Any transaction in the embodiments of the present application refers to each transaction in the multiple transactions in the aforementioned embodiments.

[0121] For example, continuing with the above example, there are three transactions: transaction tx0, transaction tx1, and transaction tx2, where any transaction refers to transaction tx0, transaction tx1, or transaction tx2.

[0122] In the embodiment of the present application, the predecessor transaction of any transaction refers to a transaction whose execution result is written into the transaction snapshot of the master node earlier than the time when the execution result of any transaction is written into the transaction snapshot of the master node.

[0123] For example, assume that the transaction snapshot of the master node stores the execution results of i+n transactions, and assume that the execution result of transaction tx2 is the i-th transaction written into the transaction snapshot of the master node. Then the time when the execution results of the transactions corresponding to [0, 1, 2...i-1] are written into the transaction snapshot of the master node is earlier than the time when the execution result of transaction tx2 is written into the transaction snapshot of the master node. At this time, at least one of the transactions corresponding to [0, 1, 2...i-1] is a predecessor transaction.

[0124] S801 to S804 are described in detail as follows:

[0125] S801. If the first conflict detection result indicates that at least one of a read-write conflict and a write-read conflict exists between any transaction and a preceding transaction, then the identification information of any transaction is added to the first sequence, and the identification information of any transaction is sequentially added to the second sequence; wherein the execution result of the preceding transaction is written into the transaction snapshot of the master node earlier than the execution result of any transaction is written into the transaction snapshot of the master node.

[0126] In an embodiment of the present application, if the first conflict detection result indicates that there is at least one of a read-write conflict and a write-read conflict between any transaction and the previous transaction, the master node may add the identification information of any transaction to the first sequence, and add the identification information of any transaction to the second sequence in sequence.

[0127] In the embodiments of the present application, there is at least one of a read-write conflict and a write-read conflict between any transaction and the preceding transaction, including two situations:

[0128] Case 1: There is no write-write conflict between any transaction and the previous transaction, but there is at least one of a read-write conflict and a write-read conflict;

[0129] Case 2: There is a write-write conflict between any transaction and the previous transaction, and there is at least one of a read-write conflict and a write-read conflict.

[0130] For example, continuing the above example, Q1=[] represents the first sequence, and Q2=[] represents the second sequence; wherein:

[0131] Assume that during the conflict detection process for transaction tx2, the first conflict detection result C of transaction tx2 is detected. tx2 If there is at least one of a read-write conflict and a write-read conflict between transaction tx2 and its predecessor transaction, transaction tx2 is added to the first sequence Q1, i.e., Q1 = [tx2], and transaction tx2 is added to the second sequence Q2, i.e., Q2 = [tx2].

[0132] Assume that during the conflict detection process for transaction tx0, the first conflict detection result C of transaction tx0 is detected. tx0 If there is at least one of a read-write conflict and a write-read conflict between transaction tx0 and its predecessor transaction, transaction tx0 is added to the first sequence Q1, i.e., Q1 = [tx2, tx0], and transaction tx0 is added to the second sequence Q2, i.e., Q2 = [tx2->tx0].

[0133] Assume that during the conflict detection process for transaction tx1, the first conflict detection result C of transaction tx1 is detected. tx1 If there is at least one of a read-write conflict and a write-read conflict between transaction tx1 and its predecessor transaction, transaction tx1 is added to the first sequence Q1, i.e., Q1 = [tx2, tx0, tx1], and at the same time, transaction tx1 is added to the second sequence Q2, i.e., Q2 = [tx2->tx0->tx1].

[0134] Understandably, write-write conflicts can arise in a variety of scenarios:

[0135] For example, in a virtual resource transfer scenario, user 1 transfers quantity a of virtual resources to user 3, and user 2 transfers quantity b of virtual resources to user 3. User 3 then needs to write quantity a of virtual resources transferred by user 1, and also needs to write quantity b of virtual resources transferred by user 2. Therefore, a write-write conflict occurs.

[0136] For example, in a product purchase scenario, user 1 orders quantity a of product A, and user 2 also orders quantity b of product A. For product A's inventory, both quantity a ordered by user 1 and quantity b ordered by user 2 need to be written. This creates a write-write conflict.

[0137] Understandably, read-write conflicts can arise in a variety of scenarios:

[0138] For example, in a virtual resource transfer scenario, user 3 transfers quantity c of virtual resources to user 1, and user 2 transfers quantity b of virtual resources to user 3. For user 3, transferring quantity c of virtual resources to user 1 requires reading the current quantity of user 3's virtual resources, and also requires writing the quantity b of virtual resources transferred by user 2. At this time, there is a read-write conflict.

[0139] For example, in a product purchase scenario, user 1 cancels the order for quantity a of product A, and user 2 orders quantity b of product A. In this case, as far as the inventory of product A is concerned, user 1 cancels the order for quantity a of product A, and the inventory of product A needs to be read. At the same time, the inventory of product A ordered by user 2 for quantity b also needs to be written. In this case, there is a read-write conflict.

[0140] It is understandable that write-read conflicts can occur in a variety of scenarios:

[0141] For example, in a virtual resource transfer scenario, user 2 transfers quantity b of virtual resources to user 3, and at the same time user 3 transfers quantity c of virtual resources to user 1. In this case, user 3 needs to write quantity b of virtual resources transferred by user 2, and because user 3 transfers quantity c of virtual resources to user 1, user 3 also needs to read the current quantity of virtual resources of user 3. Therefore, there is a write-read conflict.

[0142] For example, in a commodity purchase scenario, user 2 orders quantity b of commodity A, and user 1 cancels the order for quantity a of commodity A. In this case, the inventory of commodity A needs to be written with the quantity b ordered by user 2. Since user 1 cancels the order for quantity a of commodity A, the inventory of commodity A also needs to be read. Therefore, there is a write-read conflict.

[0143] It should be noted that the commodities involved in the aforementioned commodity purchase scenarios may be train tickets, admission tickets, and items (such as clothing, jewelry, home appliances, food, etc.); at the same time, in actual applications, the scenarios in which write-write conflicts, read-write conflicts, and write-read conflicts are applied can be adaptively adjusted according to specific circumstances, and are not limited to the example scenarios.

[0144] S802: If the first conflict detection result indicates that there is only a write-write conflict between any transaction and the previous transaction, the identification information of any transaction is sequentially added to the second sequence.

[0145] In an embodiment of the present application, if the first conflict detection result indicates that there is only a write-write conflict between any transaction and the previous transaction, the master node can add the identification information of any transaction to the second sequence in sequence.

[0146] For example, following the above example, Q2=[] is used to represent the second sequence; wherein:

[0147] Assume that during the conflict detection process for transaction tx2, the first conflict detection result C of transaction tx2 is detected. tx2 If there is only a write-write conflict between transaction tx2 and its predecessor transaction, transaction tx2 is added to the second sequence Q2, i.e., Q2 = [tx2].

[0148] Assume that during the conflict detection process for transaction tx0, the first conflict detection result C of transaction tx0 is detected. tx0 If there is only a write-write conflict between transaction tx0 and its predecessor transaction, transaction tx0 is added to the second sequence Q2, i.e., Q2 = [tx2->tx0].

[0149] Assume that during the conflict detection process of transaction tx1, the first conflict detection result C of transaction tx1 is detected. tx1 If there is only a write-write conflict between transaction tx1 and its predecessor transaction, transaction tx1 is added to the second sequence Q2, i.e., Q2 = [tx2->tx0->tx1].

[0150] S803: Generate execution information based on the identification information of the multiple transactions included in the first sequence.

[0151] In the embodiment of the present application, after the master node completes conflict detection on multiple transactions, execution information can be generated based on the identification information of the multiple transactions contained in the first sequence.

[0152] For example, continuing the above example, if the first sequence Q1 = [tx2, tx0, tx1], the execution information can be generated: tx2, tx0, tx1.

[0153] S804: Generate write information based on the identification information of the multiple transactions contained in the second sequence and the arrangement order of the multiple transactions in the second sequence.

[0154] In the embodiment of the present application, after the master node completes the conflict detection of multiple transactions, it can generate write information based on the identification information of the multiple transactions contained in the second sequence and the arrangement order of the multiple transactions.

[0155] For example, continuing the above example, the second sequence Q2 = [tx2->tx0->tx1], then the write information can be generated: tx2->tx0->tx1.

[0156] It should be noted that, for the detailed description of S701 to S703 shown in FIG8 , please refer to S701 to S703 shown in FIG7 , and for the detailed description of S603 shown in FIG8 , please refer to S603 shown in FIG6 , which will not be repeated here.

[0157] In an embodiment of the present application, the master node adaptively adds the identification information of each transaction to the first sequence and the second sequence based on the first conflict detection result of each transaction, thereby achieving rapid and accurate generation of execution information and write information.

[0158] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG9 , the transaction processing method may include S701 to S702, S901 to S902, S704, and S603.

[0159] In an embodiment of the present application, the predecessor transaction of any transaction refers to a transaction whose execution result is written into the transaction snapshot of the master node earlier than the time when the execution result of any transaction is written into the transaction snapshot of the master node.

[0160] For example, assume that the transaction snapshot of the master node stores the execution results of i+n transactions, and assume that the execution result of transaction tx2 is the i-th transaction written into the transaction snapshot of the master node. Then the time when the execution results of the transactions corresponding to [0, 1, 2...i-1] are written into the transaction snapshot of the master node is earlier than the time when the execution result of transaction tx2 is written into the transaction snapshot of the master node. At this time, at least one transaction among the transactions corresponding to [0, 1, 2...i-1] is a predecessor transaction.

[0161] S901 to S902 are described in detail as follows:

[0162] S901, in a process of performing conflict detection on any transaction in a writing order, obtaining a predecessor transaction of any transaction; wherein the time when the execution result of the predecessor transaction is written into the transaction snapshot of the master node is earlier than the time when the execution result of any transaction is written into the transaction snapshot of the master node.

[0163] In the embodiment of the present application, when the master node performs conflict detection on any transaction in the writing order, it is necessary to obtain the predecessor transaction of any transaction.

[0164] For example, continuing with the previous example, the execution result of transaction tx2 is the i-th transaction snapshot written to the master node. In the process of conflict detection for transaction tx2, the predecessor transaction of transaction tx2 is first obtained, where the predecessor transaction of transaction tx2 can be at least one transaction corresponding to [0, 1, 2...i-1].

[0165] Assume that the execution result of transaction tx0 is the i+1th transaction snapshot written to the master node. Then, in the process of conflict detection for transaction tx0, the predecessor transaction of transaction tx0 is first obtained, where the predecessor transaction of transaction tx0 can be at least one transaction corresponding to [0, 1, 2...i-1, i].

[0166] Assume that the execution result of transaction tx1 is the i+2th transaction snapshot written to the master node. In the process of conflict detection for transaction tx1, the predecessor transaction of transaction tx1 is first obtained, where the predecessor transaction of transaction tx1 can be at least one transaction corresponding to [0, 1, 2...i-1, i, i+1].

[0167] It should be noted that the number of pre-transactions for any transaction can be flexibly adjusted according to the specific application scenario.

[0168] S902: Detect conflicts between any transaction and a preceding transaction, and obtain a first conflict detection result of any transaction.

[0169] In an embodiment of the present application, the master node obtains the preceding transaction of any transaction, and then can detect the conflict between any transaction and the preceding transaction, thereby obtaining a first conflict detection result of any transaction.

[0170] In one embodiment of the present application, the process of detecting a conflict between any transaction and a preceding transaction in S902 and obtaining a first conflict detection result for any transaction may include:

[0171] Get the read-write set of any transaction and the read-write set of the previous transaction;

[0172] Based on the read-write set of any transaction and the read-write set of the previous transaction, a conflict between any transaction and the previous transaction is detected to obtain a first conflict detection result of any transaction.

[0173] That is, in an optional embodiment, the master node implements conflict detection between any transaction and the preceding transaction through the read-write set of any transaction and the read-write set of the preceding transaction of any transaction.

[0174] For example, following the above example, in the process of conflict detection for transaction tx2, based on the read-write set of transaction tx2 and the read-write set of the preceding transaction of transaction tx2, the conflict between transaction tx2 and the preceding transaction of transaction tx2 is detected, thereby obtaining the first conflict detection result C for transaction tx2. tx2 .

[0175] In the process of conflict detection for transaction tx0, based on the read-write set of transaction tx0 and the read-write set of the preceding transaction of transaction tx0, the conflict between transaction tx0 and the preceding transaction of transaction tx0 is detected, thereby obtaining the first conflict detection result C of transaction tx0. tx0 .

[0176] In the process of conflict detection for transaction tx1, based on the read-write set of transaction tx1 and the read-write set of the preceding transaction of transaction tx1, the conflict between transaction tx1 and the preceding transaction of transaction tx1 is detected, thereby obtaining the first conflict detection result C of transaction tx1. tx1 .

[0177] In one embodiment of the present application, any transaction may be preceded by multiple transactions.

[0178] For example, continuing with the previous example, the predecessor transaction of transaction tx2 can be the transaction corresponding to [i-2, i-1], the predecessor transaction of transaction tx0 can be the transaction corresponding to [i-2, i-1, i], and the predecessor transaction of transaction tx1 can be the transaction corresponding to [i-2, i-1, i, i+1].

[0179] In one embodiment of the present application, if any transaction has multiple predecessor transactions, the process of obtaining the read-write set of any transaction and the read-write set of the predecessor transaction may include:

[0180] Get the read-write set of any transaction and the read-write sets of multiple preceding transactions.

[0181] That is, in an optional embodiment, if there are multiple predecessor transactions for any transaction, the master node needs to obtain the read-write set corresponding to each predecessor transaction when obtaining the read-write set of the predecessor transaction of any transaction.

[0182] For example, continuing with the previous example, during conflict detection for transaction tx2, assume that the transaction corresponding to the execution result in the transaction snapshot written to the master node (i-2) is transaction tx10, and the transaction corresponding to the execution result in the transaction snapshot written to the master node (i-1) is transaction tx11. Then, the read-write set of transaction tx2, the read-write set of transaction tx10, and the read-write set of transaction tx11 are obtained.

[0183] During the conflict detection process for transaction tx0, the read-write set of transaction tx0, the read-write set of transaction tx2, the read-write set of transaction tx10, and the read-write set of transaction tx11 are obtained.

[0184] During the conflict detection process for transaction tx1, the read-write set of transaction tx1, the read-write set of transaction tx0, the read-write set of transaction tx2, the read-write set of transaction tx10, and the read-write set of transaction tx11 are obtained.

[0185] Accordingly, based on the read-write set of any transaction and the read-write set of the preceding transaction, a process of detecting a conflict between any transaction and the preceding transaction and obtaining a first conflict detection result for any transaction may include:

[0186] Based on the read-write set of any transaction and the read-write sets of multiple preceding transactions, conflicts between any transaction and the multiple preceding transactions are detected, and multiple first conflict detection results of any transaction are obtained.

[0187] That is, in an optional embodiment, if there are multiple predecessor transactions for any transaction, the master node obtains the read-write set of any transaction and the read-write sets of multiple predecessor transactions, and then detects conflicts between any transaction and each predecessor transaction based on the read-write set of any transaction and the read-write set of each predecessor transaction, thereby obtaining multiple first conflict detection results for any transaction.

[0188] For example, following the above example, in the process of conflict detection for transaction tx2, the conflict between the read-write set of transaction tx2 and the read-write set of transaction tx10 is detected, and the conflict between the read-write set of transaction tx2 and the read-write set of transaction tx11 is detected, thereby obtaining the two first conflict detection results C for transaction tx2. tx2 .

[0189] In the process of conflict detection for transaction tx0, the conflict between the read-write set of transaction tx0 and the read-write set of transaction tx2 is detected, the conflict between the read-write set of transaction tx0 and the read-write set of transaction tx10 is detected, and the conflict between the read-write set of transaction tx0 and the read-write set of transaction tx11 is detected, thereby obtaining the three first conflict detection results C of transaction tx0. tx0 .

[0190] In the process of conflict detection for transaction tx1, the conflict between the read-write set of transaction tx1 and the read-write set of transaction tx0 is detected, the conflict between the read-write set of transaction tx1 and the read-write set of transaction tx2 is detected, the conflict between the read-write set of transaction tx1 and the read-write set of transaction tx10 is detected, and the conflict between the read-write set of transaction tx1 and the read-write set of transaction tx11 is detected, thereby obtaining the four first conflict detection results C of transaction tx1. tx1 .

[0191] It should be noted that, for the detailed description of S701 to S702 and S704 shown in FIG9 , please refer to S701 to S702 and S704 shown in FIG7 , and for the detailed description of S603 shown in FIG9 , please refer to S603 shown in FIG6 , which will not be repeated here.

[0192] In an embodiment of the present application, the master node obtains the predecessor transaction of the transaction in the process of conflict detection of the transaction in the order of writing, and then detects the conflict between the transaction and the predecessor transaction to obtain the first conflict detection result of the transaction, thereby realizing fast and accurate conflict detection of multiple transactions.

[0193] It is understandable that when multiple transactions involve read-write conflicts, the master node will usually execute the transactions repeatedly, which will lead to a waste of master node resources.

[0194] For ease of understanding, please refer to FIG10 , which is a schematic diagram of a master node repeatedly executing transactions in the related art; as shown in FIG10 :

[0195] Transactions tx0, tx1, and tx2 all execute the same smart contract. The execution process of the smart contract consists of two parts: first, other operations (such as calculation operations) are performed, and then it is determined whether the input K exists. If the input K exists, the process ends. If the input K does not exist, the execution result of the transaction (corresponding to KV) is written into the transaction snapshot of the master node.

[0196] In this process, a read-write conflict may occur because there are both read operations and write operations.

[0197] For example, suppose there is the following scenario:

[0198] 1) Other operations of transaction tx0 take 2 seconds, and KV operations take 1 second.

[0199] 2) Other operations of transaction tx1 take 1 second, and KV operations take 1 second.

[0200] 3) Other operations of transaction tx2 take 0 seconds, and KV operations take 1 second.

[0201] At the same time, if these three transactions are in the same block, then in order to speed up, the master node will execute the three transactions in parallel, which will produce the following situation:

[0202] 1) At time A (or time 1), transaction tx2 is executed and the execution result of transaction tx2 is written to the transaction snapshot of the master node. At this time, the write is successful because there is no conflict.

[0203] 2) At time B (or time 2), transaction tx1 is executed, but a conflict is detected between transactions tx1 and tx2, requiring re-execution of transaction tx1. This is mainly due to the following two reasons:

[0204] A) When transactions tx1 and tx2 begin executing, the master node's transaction snapshot contains the same number of transaction execution results (as shown in Figure 10, the transaction snapshot status starSeq is 0 when transactions tx1 and tx2 begin executing). However, when transaction tx1 is completed, the transaction snapshot status changes (as shown in Figure 10, the transaction snapshot status snapshot.seq is 1 when transaction tx1 is completed). This indicates that a transaction has completed a write during the execution of transaction tx1 (understandably, there is no conflict if there is no write, but there is no guarantee that there will be a conflict if there is actually a write). Therefore, conflict detection for the read-write set is performed.

[0205] B) During conflict detection, since there is a read-write conflict between transaction tx1 and the already executed transaction tx2 (the read-write set of transaction tx2 has been written to the transaction snapshot of the master node), it is determined that transaction tx1 needs to be re-executed;

[0206] 3) At time C (or time 3), transaction tx0 is executed. At this time, a conflict is detected between transaction tx0 and transaction tx2, and transaction tx0 needs to be re-executed. The main reason is the same as above and will not be repeated here.

[0207] 4) At time D (or time 4), transaction tx1 is re-executed and completed. At this time, because the transaction snapshot status at the start of transaction tx1 is consistent with the transaction snapshot status at the completion of writing (as shown in Figure 10, the transaction snapshot status starSeq at the start of transaction tx1 re-execution is 1, and the transaction snapshot status snapshot.seq at the completion of transaction tx1 re-writing is 1), it means that no transaction execution is completed during the re-execution of transaction tx1. The execution result of transaction tx1 is written into the transaction snapshot of the master node.

[0208] 5) At time E (or time 6), transaction tx0 is re-executed. Similarly, a conflict is detected between transaction tx0 and transaction tx1. It can be understood that transaction tx0 conflicts with transaction tx1. This is because the transaction snapshot state at the beginning of transaction tx0 re-execution already includes the execution result of transaction tx2, and the execution result of transaction tx1 was written to the transaction snapshot of the master node during the re-execution of transaction tx0, so transaction tx0 will be re-executed.

[0209] 6) At time P (or time 9), transaction tx0 is re-executed and completed.

[0210] As can be seen, transaction tx1 was executed once, and transaction tx0 was executed twice. In fact, the operations that affect the read-write conflict were all performed within the last second, and other operations did not affect the conflict. Therefore, although these three transactions do conflict, transactions tx0 and tx1 do not need to be executed repeatedly.

[0211] Therefore, in order to reduce the repeated execution of master node transactions and avoid wasting master node resources, in an embodiment of the present application, the master node can detect changes in the number of execution results written in the master node's transaction snapshot during the process of writing the execution result of any transaction into the master node's transaction snapshot (i.e., the KV operation phase), and then determine whether to re-execute the transaction based on the detection result.

[0212] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG11 , the transaction processing method may include S1101 to S1102, S702 to S704, and S603.

[0213] S1101 to S1102 are described in detail as follows:

[0214] S1101, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, a conflict detection is performed on any transaction to obtain a second conflict detection result of any transaction.

[0215] In an embodiment of the present application, when the master node is writing the execution result of any transaction into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, a conflict detection is performed on any transaction to obtain a second conflict detection result for any transaction.

[0216] Any transaction in the embodiments of the present application refers to each transaction of the multiple transactions in the aforementioned embodiments.

[0217] For example, there are three transactions: transaction tx0, transaction tx1, and transaction tx2, where any transaction refers to transaction tx0, transaction tx1, or transaction tx2.

[0218] In the embodiment of the present application, the second conflict detection result refers to the conflict detection result of each transaction obtained by performing conflict detection on each transaction at the stage when the master node writes the execution result of each transaction into the transaction snapshot of the master node.

[0219] For example, continuing with the above example, in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, a conflict detection is performed on transaction tx2 to obtain a second conflict detection result of transaction tx2.

[0220] In the process of writing the execution result of transaction tx0 into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, a conflict detection is performed on transaction tx0 to obtain a second conflict detection result of transaction tx0.

[0221] During the process of writing the execution result of transaction tx1 into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, a conflict detection is performed on transaction tx1 to obtain a second conflict detection result of transaction tx1.

[0222] S1102: If the second conflict detection result indicates that there is a read-write conflict between any transaction and the previous transaction, re-execute any transaction and write the execution result obtained by re-executing any transaction into the transaction snapshot of the master node; wherein the execution result of the previous transaction is written into the transaction snapshot of the master node earlier than the execution result of any transaction is written into the transaction snapshot of the master node.

[0223] In an embodiment of the present application, if the second conflict detection result indicates that there is a read-write conflict between any transaction and the previous transaction, then the transaction is re-executed at this time, and the execution result obtained by re-executing any transaction is written into the transaction snapshot of the master node.

[0224] In the embodiment of the present application, if the second conflict detection result indicates that there is no read-write conflict between any transaction and the preceding transaction, then there is no need to re-execute any transaction.

[0225] For the pre-transaction in the embodiment of this application, please refer to the introduction of the aforementioned embodiment and will not be repeated here.

[0226] For ease of understanding, please refer to FIG12, which is a schematic diagram of the master node transaction processing process in an embodiment of the present application; as shown in FIG12:

[0227] The master node executes the three transactions in parallel, resulting in the following:

[0228] 1) At time A (or time 1), transaction tx2 is executed and the execution result of transaction tx2 is written to the transaction snapshot of the master node. At this time, the write is successful because there is no conflict.

[0229] 2) At time B (or time 2), transaction tx1 is executed and the execution result of transaction tx1 is written to the transaction snapshot of the master node. The write is successful at this time because during the process of writing the execution result of transaction tx1 to the transaction snapshot of the master node (i.e., the KV operation phase of transaction tx1), the number of execution results written in the transaction snapshot of the master node has not changed, and no conflict is detected.

[0230] 3) At time C (or time 3), transaction tx0 is executed and the execution result of transaction tx0 is written to the transaction snapshot of the master node. The write is successful at this time because during the process of writing the execution result of transaction tx0 to the transaction snapshot of the master node (i.e., the KV operation phase of transaction tx0), the number of execution results written in the transaction snapshot of the master node has not changed, and no conflict is detected.

[0231] It can be seen that the master node no longer needs to repeatedly execute transactions tx0 and tx1.

[0232] In this way, by implementing the embodiments of the present application, the master node reduces the repeated execution of master node transactions and avoids the waste of master node resources.

[0233] It should be noted that, for a detailed description of S702 to S704 shown in FIG11 , please refer to S702 to S704 shown in FIG7 , and for a detailed description of S603 shown in FIG11 , please refer to S603 shown in FIG6 , which will not be repeated here.

[0234] It should also be noted that S1101 to S1102 shown in FIG11 can be executed independently without S702 to S704 and S603.

[0235] In an embodiment of the present application, the master node detects changes in the number of execution results written in the transaction snapshot of the master node during the process of writing the execution results of the transaction into the transaction snapshot of the master node (i.e., the KV operation phase), and then determines whether the transaction needs to be re-executed based on the detection result. This greatly reduces the repeated execution of transactions on the master node, thereby avoiding the waste of master node resources and improving the transaction processing efficiency of the master node.

[0236] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG13 , the transaction processing method can further include S1301 to S1303 before S1101.

[0237] S1301 to S1303 are described in detail as follows:

[0238] S1301, obtaining a starting time point for writing the execution result of any transaction into the transaction snapshot of the master node, and recording a first number of written execution results read from the transaction snapshot of the master node at the starting time point.

[0239] In an embodiment of the present application, the master node obtains the starting time point for writing the execution result of any transaction into the transaction snapshot of the master node, and records the first number of written execution results read from the transaction snapshot of the master node at the starting time point.

[0240] In the embodiment of the present application, the starting time point at which the execution result of any transaction is written into the transaction snapshot of the master node refers to the starting time point of the KV operation phase.

[0241] In the embodiment of the present application, the first quantity refers to the number of written execution results read from the transaction snapshot of the master node at the starting time point.

[0242] For example, continuing with the above example, please refer to Figure 12 again. For transaction tx2, the starting time point when the execution result of transaction tx2 is written into the transaction snapshot of the master node is time 0, and the first number rmin of written execution results read from the transaction snapshot of the master node at time 0 is 0.

[0243] For transaction tx1, the starting time point when the execution result of transaction tx1 is written into the transaction snapshot of the master node is time A (or time 1), and the first number rmin of written execution results read from the transaction snapshot of the master node at time A is 1.

[0244] For transaction tx0, the starting time point when the execution result of transaction tx0 is written into the transaction snapshot of the master node is time B (or time 2), and the first number rmin of written execution results read from the transaction snapshot of the master node at time B is 2.

[0245] S1302, obtaining the termination time point of writing the execution result of any transaction into the transaction snapshot of the master node, and recording the second number of written execution results read from the transaction snapshot of the master node at the termination time point.

[0246] In an embodiment of the present application, the master node also obtains the termination time point for writing the execution result of any transaction into the transaction snapshot of the master node, and records the second number of written execution results read from the transaction snapshot of the master node at the termination time point.

[0247] In the embodiment of the present application, the termination time point at which the execution result of any transaction is written into the transaction snapshot of the master node refers to the termination time point of the KV operation phase.

[0248] In this embodiment of the present application, the second number refers to the number of written execution results read from the transaction snapshot of the master node at the termination time point.

[0249] For example, continuing with the above example, please refer to Figure 12 again. For transaction tx2, the end time point when the execution result of transaction tx2 is written into the transaction snapshot of the master node is time A (or time 1), and the second number snapshot.seq of the written execution results read from the transaction snapshot of the master node at time A is 0.

[0250] For transaction tx1, the end time point when the execution result of transaction tx1 is written into the transaction snapshot of the master node is time B (or time 2), and the second number snapshot.seq of the written execution results read from the transaction snapshot of the master node at time B is 1.

[0251] For transaction tx0, the end time point when the execution result of transaction tx0 is written into the transaction snapshot of the master node is time C (or time 3), and the second number snapshot.seq of the written execution results read from the transaction snapshot of the master node at time C is 2.

[0252] S1303 , based on the first quantity and the second quantity, detecting a change in the quantity of the execution results written into the transaction snapshot of the master node during the process of writing the execution result of any transaction into the transaction snapshot of the master node.

[0253] In an embodiment of the present application, the master node obtains the first quantity and the second quantity, and then can detect, based on the first quantity and the second quantity, the change in the number of execution results written in the transaction snapshot of the master node during the process of writing the execution result of any transaction into the transaction snapshot of the master node.

[0254] It should be noted that for the detailed introduction of S1101 to S1102 shown in Figure 13, please refer to S1101 to S1102 shown in Figure 11; for the detailed introduction of S702 to S704 shown in Figure 13, please refer to S702 to S704 shown in Figure 7; for the detailed introduction of S603 shown in Figure 13, please refer to S603 shown in Figure 6, and no further details will be given here.

[0255] In an embodiment of the present application, the master node writes the start time point and the end time point in the transaction snapshot of the master node through the execution result of the transaction, and reads the corresponding number of execution results written in the transaction snapshot of the master node respectively, thereby realizing the detection of changes in the number of execution results written in the transaction snapshot of the master node during the process of writing the execution result of the transaction into the transaction snapshot of the master node. The detection process is simple and easy to implement.

[0256] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG14 , the transaction processing method may include S1401 to S1402, S1301 to S1302, S1101 to S1102, S702 to S704, and S603.

[0257] In an embodiment of the present application, the master node obtains the first quantity and the second quantity, and can determine, based on the first quantity and the second quantity, whether the number of execution results written in the transaction snapshot of the master node changes during the process of writing the execution result of any transaction into the transaction snapshot of the master node.

[0258] S1401 to S1402 are described in detail as follows:

[0259] S1401: If the first quantity and the second quantity do not match, a first quantity detection result is obtained, where the first quantity detection result is used to indicate that, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node changes.

[0260] In an embodiment of the present application, if the first quantity and the second quantity do not match, a first quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed.

[0261] For example, continuing with the above example, for transaction tx2, if the first quantity and the second quantity do not match, a first quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, the number of written execution results in the transaction snapshot of the master node has changed; that is, a transaction execution is completed and written during the KV operation phase of transaction tx2.

[0262] For transaction tx1, if the first quantity and the second quantity do not match, a first quantity detection result is obtained, which is used to indicate that during the process of writing the execution result of transaction tx1 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed; that is, a transaction execution is completed and written during the KV operation phase of transaction tx1.

[0263] For transaction tx0, if the first quantity and the second quantity do not match, a first quantity detection result is obtained, which is used to indicate that during the process of writing the execution result of transaction tx0 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed; that is, a transaction execution is completed and written during the KV operation phase of transaction tx0.

[0264] S1402: If the first quantity and the second quantity match, a second quantity detection result is obtained. The second quantity detection result is used to indicate that, during the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node has not changed.

[0265] In an embodiment of the present application, if the first quantity and the second quantity match, a second quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed.

[0266] For example, continuing with the previous example, for transaction tx2, the first quantity rmin is 0, and the second quantity snapshot.seq is 0. At this time, the first quantity and the second quantity match, and a second quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed; that is, no transaction execution is completed in the KV operation phase of transaction tx2.

[0267] For transaction tx1, the first quantity rmin is 1 and the second quantity snapshot.seq is 1. At this time, the first quantity and the second quantity match, and a second quantity detection result is obtained, which is used to indicate that during the process of writing the execution result of transaction tx1 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed; that is, no transaction execution completes the write during the KV operation phase of transaction tx1.

[0268] For transaction tx0, the first quantity rmin is 2, and the second quantity snapshot.seq is 2. At this time, the first quantity and the second quantity match, and a second quantity detection result is obtained, which is used to indicate that the number of execution results written in the transaction snapshot of the master node has not changed during the process of writing the execution result of transaction tx0 into the transaction snapshot of the master node; that is, no transaction execution is completed in the KV operation phase of transaction tx0.

[0269] It should be noted that for the detailed introduction of S1301 to S1302 shown in Figure 14, please refer to S1301 to S1302 shown in Figure 13; for the detailed introduction of S1101 to S1102 shown in Figure 14, please refer to S1101 to S1102 shown in Figure 11; for the detailed introduction of S702 to S704 shown in Figure 14, please refer to S702 to S704 shown in Figure 7; for the detailed introduction of S603 shown in Figure 14, please refer to S603 shown in Figure 6, and no further details will be given here.

[0270] In an embodiment of the present application, the master node can quickly and accurately obtain a first quantity detection result or a second quantity detection result for characterizing the change in the number of execution results written in the transaction snapshot of the master node during the process of writing the execution results of the transaction into the transaction snapshot of the master node by matching the first quantity and the second quantity.

[0271] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG15 , the transaction processing method may include S1501 to S1506, S1301 to S1302, S1101 to S1102, S702 to S704, and S603.

[0272] In an embodiment of the present application, the master node obtains the first quantity and the second quantity, and can also obtain the third quantity. Based on the first quantity, the second quantity and the third quantity, it can be determined whether the number of execution results written in the transaction snapshot of the master node changes in the process of writing the execution result of any transaction into the transaction snapshot of the master node.

[0273] S1501 to S1506 are described in detail as follows:

[0274] S1501 , within a time period between a start time point and an end time point, record a plurality of third quantities of written execution results respectively read from the transaction snapshot of the master node.

[0275] In an embodiment of the present application, the master node can record multiple third quantities of written execution results read from the transaction snapshot of the master node during the process of writing the execution result of any transaction into the transaction snapshot of the master node, that is, in the time period between the start time point and the end time point.

[0276] In this embodiment of the present application, the third number refers to the number of written execution results read from the transaction snapshot of the master node within the time period between the start time point and the end time point.

[0277] For example, continuing with the above example, for transaction tx2, multiple third quantities r2 of written execution results read from the transaction snapshot of the master node within the time period from time 0 to time A are recorded.

[0278] For transaction tx1, multiple third quantities r1 of written execution results read from the transaction snapshot of the master node during the time period from time A to time B are recorded.

[0279] For transaction tx0, multiple third quantities r0 of written execution results read from the transaction snapshot of the master node during the time period from time B to time C are recorded.

[0280] S1502: Select the largest third quantity from multiple third quantities.

[0281] In an embodiment of the present application, the master node records multiple third quantities corresponding to the written execution results read from the transaction snapshot of the master node, and then can select the largest third quantity from the multiple third quantities.

[0282] For example, continuing with the above example, for transaction tx2, the largest third quantity is selected from multiple third quantities r2, where the selected largest third quantity is recorded as r2max.

[0283] For transaction tx1, a largest third quantity is selected from multiple third quantities r1, where the selected largest third quantity is recorded as r1max.

[0284] For transaction tx0, a largest third quantity is selected from multiple third quantities r0, where the selected largest third quantity is recorded as r0max.

[0285] S1503: Match the first quantity with the selected third quantity to obtain a first matching result.

[0286] In an embodiment of the present application, the master node matches the first quantity with the selected third quantity to obtain a first matching result.

[0287] For example, continuing with the above example, for transaction tx2, the first quantity rmin and the third quantity r2max corresponding to transaction tx2 are matched to obtain a first matching result.

[0288] For transaction tx1, the first quantity rmin and the third quantity r1max corresponding to transaction tx1 are matched to obtain a first matching result.

[0289] For transaction tx0, the first quantity rmin and the third quantity r0max corresponding to transaction tx0 are matched to obtain a first matching result.

[0290] S1504: Match the second quantity with the selected third quantity to obtain a second matching result.

[0291] In the embodiment of the present application, the master node matches the second number with the selected third number to obtain a second matching result.

[0292] For example, continuing with the above example, for transaction tx2, the second quantity snapshot.seq and the third quantity r2max corresponding to transaction tx2 are matched to obtain a first matching result.

[0293] For transaction tx1, the second quantity snapshot.seq and the third quantity r1max corresponding to transaction tx1 are matched to obtain a first matching result.

[0294] For transaction tx0, the second quantity snapshot.seq and the third quantity r0max corresponding to transaction tx0 are matched to obtain a first matching result.

[0295] S1505: If at least one of the first matching result and the second matching result does not match, a first quantity detection result is obtained. The first quantity detection result is used to indicate that, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node changes.

[0296] In an embodiment of the present application, if at least one of the first matching result and the second matching result does not match, a first quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed.

[0297] For example, continuing with the previous example, for transaction tx2, if the first quantity rmin and the third quantity r2max corresponding to transaction tx2 do not match, and / or the second quantity snapshot.seq and the third quantity r2max corresponding to transaction tx2 do not match, then a first quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed; that is, there is a transaction execution completion write during the KV operation phase of transaction tx2.

[0298] For transaction tx1, if the first quantity rmin and the third quantity r1max corresponding to transaction tx1 do not match, and / or the second quantity snapshot.seq and the third quantity r1max corresponding to transaction tx1 do not match, then a first quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx1 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed; that is, a transaction execution is completed and written during the KV operation phase of transaction tx1.

[0299] For transaction tx0, if the first quantity rmin and the third quantity r0max corresponding to transaction tx0 do not match, and / or the second quantity snapshot.seq and the third quantity r0max corresponding to transaction tx0 do not match, then a second quantity detection result is obtained, which is used to indicate that during the process of writing the execution result of transaction tx0 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has changed; that is, a transaction execution is completed and written during the KV operation phase of transaction tx0.

[0300] S1506, if both the first matching result and the second matching result indicate a match, a second quantity detection result is obtained. The second quantity detection result is used to indicate that during the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node has not changed.

[0301] In an embodiment of the present application, if both the first matching result and the second matching result represent a match, a second quantity detection result is obtained, which is used to represent that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed.

[0302] For example, continuing with the previous example, for transaction tx2, the first quantity rmin is 0, the second quantity snapshot.seq is 0, and the third quantity r2max is 0. At this time, the first quantity rmin and the third quantity r2max match, and the second quantity snapshot.seq and the third quantity r2max match. Then, a second quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed; that is, no transaction execution is completed in the KV operation phase of transaction tx2.

[0303] For transaction tx1, the first quantity rmin is 1, the second quantity snapshot.seq is 1, and the third quantity r1max is 1. At this time, the first quantity rmin and the third quantity r1max match, and the second quantity snapshot.seq and the third quantity r1max match. Then, a second quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx1 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed; that is, no transaction execution is completed in the KV operation phase of transaction tx1.

[0304] For transaction tx0, the first quantity rmin is 2, the second quantity snapshot.seq is 2, and the third quantity r0max is 2. At this time, the first quantity rmin and the third quantity r0max match, and the second quantity snapshot.seq and the third quantity r0max match. Then, a second quantity detection result is obtained, which is used to characterize that in the process of writing the execution result of transaction tx0 into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed; that is, no transaction execution is completed in the KV operation phase of transaction tx0.

[0305] It should be noted that, for the detailed introduction of S1301 to S1302 shown in Figure 15, please refer to S1301 to S1302 shown in Figure 13; for the detailed introduction of S1101 to S1102 shown in Figure 15, please refer to S1101 to S1102 shown in Figure 11; for the detailed introduction of S702 to S704 shown in Figure 15, please refer to S702 to S704 shown in Figure 7; for the detailed introduction of S603 shown in Figure 15, please refer to S603 shown in Figure 6, and no further details will be given here.

[0306] In an embodiment of the present application, the master node can quickly and accurately obtain a first quantity detection result or a second quantity detection result for characterizing changes in the number of execution results written in the transaction snapshot of the master node during the process of writing the execution results of the transaction into the transaction snapshot of the master node by matching the first quantity with the third quantity and matching the second quantity with the third quantity.

[0307] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG16 , the transaction processing method may include S1601 to S1602, S1102, S702 to S704, and S603.

[0308] In an embodiment of the present application, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, the master node needs to perform conflict detection on any transaction, thereby obtaining a second conflict detection result for any transaction.

[0309] In the embodiment of the present application, conflict detection refers to detecting whether there is a conflict between reads and writes between transactions, where conflicts include write-write conflicts, read-write conflicts, and write-read conflicts.

[0310] In the embodiment of the present application, the second conflict detection result refers to the conflict detection result of each transaction obtained by performing conflict detection on each transaction at the stage when the master node writes the execution results of multiple transactions into the transaction snapshot of the master node.

[0311] S1601 to S1602 are described in detail as follows:

[0312] S1601, obtain the preceding transaction of any transaction.

[0313] S1602: Detect a conflict between any transaction and a preceding transaction, and obtain a second conflict detection result for any transaction.

[0314] In the embodiments of this application, please refer to the introduction of the aforementioned embodiments for the pre-transaction, which will not be repeated here.

[0315] In an embodiment of the present application, the master node performs conflict detection on any transaction and obtains a second conflict detection result of any transaction. Specifically, the master node obtains the predecessor transaction of any transaction, and then detects the conflict between any transaction and the predecessor transaction to obtain the second conflict detection result of any transaction.

[0316] For example, continuing with the previous example, for transaction tx2, in the process of writing the execution result of transaction tx2 into the transaction snapshot of the master node, it is detected that the number of execution results written in the transaction snapshot of the master node has changed. The master node then obtains the predecessor transaction of transaction tx2, and then detects the conflict between transaction tx2 and the predecessor transaction, thereby obtaining the second conflict detection result of transaction tx2.

[0317] For transaction tx1, when writing the execution result of transaction tx1 into the transaction snapshot of the master node, it is detected that the number of execution results written in the transaction snapshot of the master node has changed. The master node then obtains the predecessor transaction of transaction tx1, and then detects the conflict between transaction tx1 and the predecessor transaction, thereby obtaining the second conflict detection result of transaction tx1.

[0318] For transaction tx0, when writing the execution result of transaction tx0 into the transaction snapshot of the master node, it is detected that the number of execution results written in the transaction snapshot of the master node has changed. The master node then obtains the predecessor transaction of transaction tx0, and then detects the conflict between transaction tx0 and the predecessor transaction, thereby obtaining the second conflict detection result of transaction tx0.

[0319] In one embodiment of the present application, the process of detecting a conflict between any transaction and a preceding transaction in S1602 and obtaining a second conflict detection result for any transaction may include:

[0320] Get the read-write set of any transaction and the read-write set of the previous transaction;

[0321] Based on the read-write set of any transaction and the read-write set of the previous transaction, a conflict between any transaction and the previous transaction is detected to obtain a second conflict detection result of any transaction.

[0322] That is, in an optional embodiment, the master node implements conflict detection between any transaction and the preceding transaction through the read-write set of any transaction and the read-write set of the preceding transaction of any transaction.

[0323] For example, following the above example, in the process of conflict detection for transaction tx2, based on the read-write set of transaction tx2 and the read-write set of the preceding transaction of transaction tx2, the conflict between transaction tx2 and the preceding transaction of transaction tx2 is detected, thereby obtaining the second conflict detection result C for transaction tx2. tx2 .

[0324] In the process of conflict detection for transaction tx1, based on the read-write set of transaction tx1 and the read-write set of the preceding transaction of transaction tx1, the conflict between transaction tx1 and the preceding transaction of transaction tx1 is detected, thereby obtaining the second conflict detection result C of transaction tx1. tx1 .

[0325] In the process of conflict detection for transaction tx0, based on the read-write set of transaction tx0 and the read-write set of the preceding transaction of transaction tx0, the conflict between transaction tx0 and the preceding transaction of transaction tx0 is detected, thereby obtaining the second conflict detection result C of transaction tx0. tx0 .

[0326] In one embodiment of the present application, the process of detecting a conflict between any transaction and a preceding transaction in S1602 and obtaining a second conflict detection result for any transaction may include:

[0327] If, based on the read-write set of any transaction and the read-write set of the preceding transaction, a read-write conflict is detected between any transaction and the preceding transaction, a second conflict detection result is obtained, indicating that a read-write conflict exists between any transaction and the preceding transaction.

[0328] If, based on the read-write set of any transaction and the read-write set of the preceding transaction, it is detected that no read-write conflict exists between any transaction and the preceding transaction, a second conflict detection result is obtained, indicating that no read-write conflict exists between any transaction and the preceding transaction.

[0329] In an embodiment of the present application, if the master node detects that there is a read-write conflict between any transaction and the previous transaction based on the read-write set of any transaction and the read-write set of the previous transaction, a second conflict detection result is obtained to characterize that there is a read-write conflict between any transaction and the previous transaction.

[0330] For example, continuing with the previous example, for transaction tx2, if a read-write conflict is detected between transaction tx2 and the predecessor transaction of transaction tx2 based on the read-write set of transaction tx2 and the read-write set of the predecessor transaction of transaction tx2, then a second conflict detection result is obtained, which is used to characterize the presence of a read-write conflict between transaction tx2 and the predecessor transaction of transaction tx2.

[0331] For transaction tx1, if a read-write conflict is detected between transaction tx1 and its predecessor transaction based on the read-write set of transaction tx1 and the read-write set of its predecessor transaction, a second conflict detection result is obtained, which is used to characterize the presence of a read-write conflict between transaction tx1 and its predecessor transaction.

[0332] For transaction tx0, if a read-write conflict is detected between transaction tx0 and its predecessor transaction based on the read-write set of transaction tx0 and the read-write set of its predecessor transaction, a second conflict detection result is obtained, which is used to characterize the presence of a read-write conflict between transaction tx0 and its predecessor transaction.

[0333] In an embodiment of the present application, if, based on the read-write set of any transaction and the read-write set of the previous transaction, it is detected that there is no read-write conflict between any transaction and the previous transaction, a second conflict detection result is obtained to characterize that there is no read-write conflict between any transaction and the previous transaction.

[0334] For example, continuing with the above example, for transaction tx2, if it is detected that there is no read-write conflict between transaction tx2 and the predecessor transaction of transaction tx2 based on the read-write set of transaction tx2 and the read-write set of the predecessor transaction of transaction tx2, then a second conflict detection result is obtained, which is used to characterize that there is no read-write conflict between transaction tx2 and the predecessor transaction of transaction tx2.

[0335] For transaction tx1, if it is detected that there is no read-write conflict between transaction tx1 and its predecessor transaction based on the read-write set of transaction tx1 and the read-write set of its predecessor transaction, a second conflict detection result is obtained, which is used to characterize that there is no read-write conflict between transaction tx1 and its predecessor transaction.

[0336] For transaction tx0, if it is detected that there is no read-write conflict between transaction tx0 and the predecessor transaction of transaction tx0 based on the read-write set of transaction tx0 and the read-write set of the predecessor transaction of transaction tx0, then a second conflict detection result is obtained, which is used to characterize that there is no read-write conflict between transaction tx0 and the predecessor transaction of transaction tx0.

[0337] It should be noted that for a detailed introduction to S1102 shown in Figure 16, please refer to S1102 shown in Figure 11; for a detailed introduction to S702 to S704 shown in Figure 16, please refer to S702 to S704 shown in Figure 7; for a detailed introduction to S603 shown in Figure 16, please refer to S603 shown in Figure 6, and no further details will be given here.

[0338] In an embodiment of the present application, during the process of conflict detection on a transaction, the master node obtains the preceding transaction of the transaction, then detects the conflict between the transaction and the preceding transaction, and obtains a second conflict detection result of the transaction, thereby achieving fast and accurate conflict detection of multiple transactions.

[0339] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a master node 401. As shown in FIG17 , the transaction processing method may include S1701 to S1702 and S601 to S602.

[0340] S1701 to S1702 are described in detail as follows:

[0341] S1701, generating proposal information based on execution information and writing information.

[0342] S1702, sending the proposal information to the slave node, so that the slave node executes multiple transactions in parallel based on the execution information contained in the proposal information, obtains the execution results of the multiple transactions, and writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence based on the write information contained in the proposal information.

[0343] In an embodiment of the present application, the execution information generated by the master node may be in the form of a DAG, and / or the write information generated by the master node may also be in the form of a DAG.

[0344] In an embodiment of the present application, the master node may generate proposal information based on the execution information in the form of a DAG and the write information in the form of a DAG, and then send the proposal information to the slave node. That is, in an embodiment of the present application, the master node combines the execution information and the write information into the same information (i.e., the proposal information) and sends it to the slave node.

[0345] In one embodiment of the present application, the master node may send the execution information and the write information to the slave node separately, rather than combining the execution information and the write information into the same message (i.e., the proposal information). In actual applications, the transmission of the execution information and the write information can be flexibly adjusted according to the specific application scenario.

[0346] It should be noted that, for the detailed description of S601 to S602 shown in FIG17 , please refer to S601 to S602 shown in FIG6 , which will not be repeated here.

[0347] In an embodiment of the present application, when the master node sends execution information and write information to the slave node, the execution information and write information can be combined into one proposal information and sent to the slave node, thereby saving network resources consumed by information transmission and improving information transmission efficiency.

[0348] It should be noted that the embodiments shown in Figures 6 to 17 are described from the perspective of the master node. The following, in conjunction with Figures 18 to 20, will describe in detail the implementation details of the technical solution of the embodiment of the present application from the perspective of the slave node:

[0349] Please refer to Figure 18, which is a flowchart of a transaction processing method according to one embodiment of the present application. The transaction processing method can be executed by a computer device serving as a slave node 402. As shown in Figure 18, the transaction processing method includes at least S1801 to S1803, which are described in detail as follows:

[0350] S1801, receiving execution information containing transaction identification information and writing information containing the writing order of execution results sent by the master node.

[0351] In an embodiment of the present application, the master node generates execution information containing transaction identification information and write information containing the order in which the execution results are written. The master node can then send the execution information containing the transaction identification information and the write information containing the order in which the execution results are written to the slave node. Correspondingly, the slave node receives the execution information containing the transaction identification information and the write information containing the order in which the execution results are written, sent by the master node.

[0352] For example, the execution information includes identification information of three transactions: tx0, tx1, and tx2, and the write information includes the execution result write order of the three transactions: tx2->tx0->tx1.

[0353] S1802, executing multiple transactions corresponding to the transaction identification information in parallel to obtain execution results of the multiple transactions.

[0354] In an embodiment of the present application, the slave node receives execution information containing transaction identification information and write information containing the execution result writing order sent by the master node, and then can execute multiple transactions corresponding to the transaction identification information in parallel to obtain the execution results of the multiple transactions.

[0355] For example, continuing with the previous example, the slave node executes transactions tx0, tx1, and tx2 in parallel, and obtains the execution results of transactions tx0, tx1, and tx2.

[0356] S1803, writing the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order.

[0357] In an embodiment of the present application, the slave node obtains the execution results corresponding to the multiple transactions, and then the execution results of the multiple transactions can be written into the transaction snapshot of the slave node in sequence according to the writing order in the write information.

[0358] For example, continuing with the previous example, the slave node first writes the execution result of transaction tx0 into the transaction snapshot of the slave node, then writes the execution result of transaction tx1 into the transaction snapshot of the slave node, and finally writes the execution result of transaction tx2 into the transaction snapshot of the slave node.

[0359] In an embodiment of the present application, the slave node receives execution information containing transaction identification information and write information containing the execution result writing order sent by the master node, and can execute multiple transactions corresponding to the transaction identification information in parallel according to the execution information to obtain the execution results of the multiple transactions, thereby improving the transaction processing efficiency of the slave node. At the same time, the slave node writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the execution result writing order in the write information, thereby ensuring the consistency of the execution results of the slave node and the master node in the transaction snapshot.

[0360] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a slave node 402. As shown in Figure 19, the transaction processing method can include S1901 to S1902, S1801, and S1803.

[0361] S1901 to S1902 are described in detail as follows:

[0362] S1901, based on identification information of multiple transactions, obtaining transaction data of multiple transactions corresponding to the identification information of the multiple transactions.

[0363] S1902, executing the transaction data corresponding to the multiple transactions in parallel to obtain the execution results of the multiple transactions.

[0364] In an embodiment of the present application, the slave node can obtain transaction data corresponding to multiple transactions corresponding to the identification information of multiple transactions based on the identification information of multiple transactions, and then execute the transaction data corresponding to each of the multiple transactions in parallel to obtain the execution results of each of the multiple transactions.

[0365] For example, continuing with the previous example, the execution information includes identification information of three transactions: tx0, tx1, and tx2. Therefore, the transaction data corresponding to transaction tx0, the transaction data corresponding to transaction tx1, and the transaction data corresponding to transaction tx2 are obtained; then the transaction data corresponding to transaction tx0, the transaction data corresponding to transaction tx1, and the transaction data corresponding to transaction tx2 are executed in parallel, thereby obtaining the execution results of transaction tx0, the execution results of transaction tx1, and the execution results of transaction tx2.

[0366] In one embodiment of the present application, the process of executing the transaction data corresponding to the multiple transactions in parallel in S1902 to obtain the execution results of the multiple transactions may include:

[0367] In the process of executing the transaction data corresponding to multiple transactions in parallel, if it is detected that any transaction is completed, the execution status of any transaction is updated to the execution completion status.

[0368] That is, in an optional embodiment, during the parallel execution of transaction data corresponding to multiple transactions, if it is detected that any transaction is completed, the execution status of any transaction is updated, specifically updated to the execution completion status, to facilitate transaction management.

[0369] It should be noted that for the detailed introduction of S1801 and S1803 shown in FIG19 , please refer to S1801 and S1803 shown in FIG18 , which will not be repeated here.

[0370] In an embodiment of the present application, transaction data of multiple transactions corresponding to identification information of multiple transactions are obtained from the node, and then the transaction data of each of the multiple transactions are executed in parallel, thereby achieving rapid and accurate execution results of each of the multiple transactions.

[0371] In one embodiment of the present application, another transaction processing method is provided, which can be executed by a computer device serving as a slave node 402. As shown in FIG20 , the transaction processing method can include S2001 to S2002 and S1801 to S1802.

[0372] S2001 to S2002 are introduced in detail as follows:

[0373] S2001, if it is detected based on the write order that the execution result of the parent transaction of any transaction needs to be written, then after writing the execution result of the parent transaction into the transaction snapshot of the slave node, the execution result of any transaction is written into the transaction snapshot of the slave node; wherein, the parent transaction is the transaction that should be written before any transaction in the write order.

[0374] In an embodiment of the present application, the parent transaction of any transaction refers to the transaction that precedes any transaction in the write order; for example, the write information includes the execution result write order of three transactions: tx2->tx0->tx1, then the parent transaction of transaction tx0 is transaction tx2 and the parent transaction of transaction tx2, the parent transaction of transaction tx1 is transaction tx0 and the parent transaction of transaction tx0, and so on.

[0375] In an embodiment of the present application, if it is detected based on the write order that the execution result of the parent transaction of any transaction is to be written, the execution result of any transaction is written into the transaction snapshot of the slave node only after the execution result of the parent transaction is written into the transaction snapshot of the slave node, thereby ensuring the write accuracy between multiple transactions.

[0376] S2002: If it is detected based on the write order that a sub-transaction of any transaction has an execution result, then after the execution result of any transaction is written into the transaction snapshot of the slave node, the execution result of the sub-transaction is written into the transaction snapshot of the slave node; wherein the sub-transaction is a transaction that should be written after any transaction in the write order.

[0377] In an embodiment of the present application, the sub-transaction of any transaction refers to the transaction that follows any transaction in the write order; for example, the write information includes the execution result write order of three transactions: tx2->tx0->tx1, then the sub-transaction of transaction tx2 is transaction tx0 and the sub-transaction of transaction tx0, the sub-transaction of transaction tx0 is transaction tx1 and the sub-transaction of transaction tx1, and so on.

[0378] In an embodiment of the present application, if it is detected based on the write order that a sub-transaction of any transaction has an execution result, then after the execution result of any transaction is written into the transaction snapshot of the slave node, the execution result of the sub-transaction is written into the transaction snapshot of the slave node, thereby triggering the writing of the sub-transaction of any transaction.

[0379] It should be noted that, for the detailed description of S1801 to S1802 shown in FIG20 , please refer to S1801 to S1802 shown in FIG18 , which will not be repeated here.

[0380] In an embodiment of the present application, the slave node writes the execution result of the transaction into the transaction snapshot of the slave node only after writing the execution result of the parent transaction into the transaction snapshot of the slave node, thereby ensuring the writing accuracy between multiple transactions; at the same time, after writing the execution result of the transaction into the transaction snapshot of the slave node, the slave node also writes the execution result of the child transaction into the transaction snapshot of the slave node, triggering the writing of the child transaction of the transaction, thereby further ensuring the writing accuracy between multiple transactions.

[0381] The following is a detailed description of a specific scenario in an embodiment of the present application:

[0382] The write-write conflict optimization solution is as follows:

[0383] First, the generation process of the master node for the execution DAG (also called ED) and the write DAG (also called WD) is introduced.

[0384] Please refer to Figure 21, which is a flow chart of a transaction processing method according to an embodiment of the present application. As shown in Figure 21, the transaction processing method includes at least S2101 to S2114, which are described in detail as follows:

[0385] S2101, initialize execution DAG and write DAG.

[0386] Exemplarily, the initialization execution DAG may be recorded as a first sequence Q1=[]. Similarly, the initialization write DAG may be recorded as a second sequence Q2=[].

[0387] S2102, initialize the sequential transaction set Txs that needs to be traversed, i=0.

[0388] Continuing with the previous example, let Txs = {tx2, tx0, tx1}, where i corresponds to each transaction in the transaction set Txs, that is, i = 0 corresponds to transaction tx2, i = 1 corresponds to transaction tx0, and i = 2 corresponds to transaction tx1.

[0389] S2103, obtain transaction Tx = Txs[i].

[0390] It can be understood that here the transaction set Txs is traversed to implement conflict detection for each transaction in the transaction set Txs.

[0391] Continuing with the previous example, we will get transaction tx2.

[0392] S2104, obtain all read-write sets RWSet of Tx.

[0393] Continuing with the previous example, we will get all read-write sets (RWSets) of transaction tx2.

[0394] S2105, compare all read-write sets RWSet of Tx with the previous range transaction [0-i] for read-write set conflicts to form a conflict transaction set CTxs.

[0395] It can be understood that the read-write set conflict comparison is a comparison of K, including read-write conflict, write-write conflict, and write-read conflict.

[0396] Continuing with the previous example, all read-write sets RWSet of transaction tx2 are compared with the preceding range transaction [0-i] for read-write set conflicts to form the conflicting transaction set CTxs.

[0397] S2106, initialize j=0.

[0398] Continuing with the above example, let Txs = {ctx10, ctx6}, where j corresponds to each conflicting transaction in the conflicting transaction set CTxs, that is, j = 0 corresponds to the conflicting transaction ctx10, and j = 1 corresponds to the conflicting transaction ctx6.

[0399] S2107, obtain the conflicting transaction ctx=CTxs[j].

[0400] It can be understood that here the conflicting transaction set CTxs is traversed to implement conflict detection for each transaction in the transaction set Txs based on the conflicting transactions in the conflicting transaction set CTxs.

[0401] S2108, detect the conflict relationship between Tx and CTx; if all keys are write-write conflicts, execute S2109; if there are other conflicts, execute S2110.

[0402] Continuing with the previous example, we will now detect the conflict between transaction tx2 and conflicting transaction ctx10.

[0403] If all keys have write-write conflicts, transaction tx2 is added to the CTx sub-write sequence but not the sub-execution sequence. This indicates that transaction tx2 can be executed in parallel but cannot be written in parallel (i.e., it can only be written serially). Except for the case where all keys have write-write conflicts, transaction tx2 is added to the CTx sub-write sequence and sub-execution sequence.

[0404] For ease of understanding, please refer to Table 1, which is an example table for adding transactions to the CTx sub-write sequence.

[0405] Table 1

[0406] As shown in Table 1, CTx has a total of 7 transactions tx. Transaction tx2 corresponds to transaction tx0 and transaction tx1, indicating that transaction tx0 and transaction tx1 are written before transaction tx2. Transaction tx3 corresponds to transaction tx2, indicating that transaction tx2 is written before transaction tx3. The same applies to transactions tx5 and tx6. If transaction tx0, transaction tx1, and transaction tx4 correspond to Nil respectively, it indicates that there is no write timing relationship between transaction tx0, transaction tx1, and transaction tx4.

[0407] Similarly, add the transaction to the CTx sub-execution sequence and follow the analogy.

[0408] S2109, Tx joins the CTx sub-write sequence (ie, WD).

[0409] S2110 , Tx joins the CTx sub-write sequence and sub-execution sequence (ie, ED).

[0410] S2111, j++.

[0411] Continuing with the previous example, we will obtain the conflicting transaction ctx6.

[0412] S2112, check whether j is greater than or equal to the number of conflicting transactions in the conflicting transaction set CTxs, that is, check j ≥ len(CTxs); if so, execute S2113; if not, execute S2107.

[0413] Continuing with the above example, at this time j=1, len(CTxs)=2, then j<len(CTxs), and it is necessary to return to S2107 and repeat S2107 to S2112 until j≥len(CTxs), and exit the loop.

[0414] S2113, i++.

[0415] Continuing with the previous example, we will get transaction tx0.

[0416] S2114, check whether i is greater than or equal to the number of transactions in Txs, that is, check i≥len(Txs); if so, end the process, if not, execute S2103.

[0417] Continuing with the above example, at this time 1=1, len(Txs)=3, then i<len(Txs), and it is necessary to return to S2103 and repeat S2103 to S2114 until i≥len(Txs), and then exit the loop.

[0418] At this point, the master node obtains the execution DAG and write DAG corresponding to multiple transactions.

[0419] Secondly, the process of executing multiple transactions in parallel on the slave node based on ED and writing the transaction execution results into the transaction snapshot of the slave node based on WD is introduced.

[0420] Please refer to Figure 22, which is a flow chart of a transaction processing method according to an embodiment of the present application. As shown in Figure 22, the transaction processing method includes at least S2201 to S2211, which are described in detail as follows:

[0421] S2201, obtain the ED Head transaction list Txs.

[0422] It is understandable that Head transaction list Txs are transactions without parent transactions.

[0423] S2202: Put the transaction list into the transaction execution thread pool and wait for execution to be completed.

[0424] S2203: After each transaction (Tx) is executed, the transaction status is updated to "executed" and the transaction relationship is obtained from WD.

[0425] S2204, check whether the transaction has a parent transaction to be executed; if so, execute S2205, if not, execute S2208.

[0426] S2205, update the transaction status to completed.

[0427] S2206, obtain the sub-transaction set of the transaction from ED.

[0428] S2207, traverse the child transaction set and obtain the set ctxs of all parent transactions that have been executed.

[0429] S2208: Update the transaction write set to the transaction snapshot (also called ledger snapshot).

[0430] S2209, obtain all executed sub-transactions of the transaction.

[0431] S2210, traverse the child transaction set and obtain the child transaction set childs that has been written by all parent transactions.

[0432] S2211, update the childs read-write set to the transaction snapshot.

[0433] At this point, the slave node completes the parallel execution of multiple transactions based on ED and writes the transaction execution results into the slave node's transaction snapshot based on WD.

[0434] In the embodiment of the present application, in order to address write-write conflicts, the DAG generated by the master node in the related art is adjusted to an execution DAG and a write DAG, so that the slave node can execute multiple transactions in parallel based on the execution DAG, obtain the execution results corresponding to the multiple transactions, and write the execution results of the multiple transactions into the transaction snapshot of the slave node based on the write DAG, thereby improving the transaction processing efficiency of the slave node and ensuring the consistency of the execution results of the slave node and the master node in the transaction snapshot.

[0435] The read-write conflict optimization solution is as follows:

[0436] Please refer to Figure 23, which is a flow chart of a transaction processing method according to an embodiment of the present application. As shown in Figure 23, the transaction processing method includes at least S2301 to S2309, which are described in detail as follows:

[0437] First, the relevant parameters used in the embodiments of the present application are introduced.

[0438] TxSimContext: represents the transaction execution context. Each transaction will create an object before execution.

[0439] Add three variables in TxSimContext: readIdx, rmin, and rmax, where:

[0440] A) readIdx is used to indicate the first read operation, which facilitates the processing of rmin;

[0441] B) rmin represents the seq value of the first read operation during the execution of the transaction context. By default, this value is the seq value when TxSimContext is created (it can be understood that seq refers to the number of execution results of transactions added to the transaction snapshot when TxSimContext is created);

[0442] C) rmax represents the maximum seq value of the read operation during the execution of the transaction context. By default, this value is also the seq when TxSimContext is created.

[0443] Secondly, the corresponding process is introduced.

[0444] S2301, initialize the transaction execution context.

[0445] S2302, execute the smart contract in the transaction.

[0446] S2303, read operation.

[0447] S2304, obtain read set data; the data comes from the local read-write set and transaction snapshot.

[0448] S2305 , check whether readIdx is equal to 0, that is, check readIdx=0; if so, execute S2306 , if not, execute S2309 .

[0449] S2306, check whether rmin is less than currSeq, that is, check rmin<currSeq; if so, execute S2307, if not, execute S2309.

[0450] It can be understood that currSeq: represents the seq value read in real time by the read operation.

[0451] S2307, assign currSeq to rmin, that is, rmin = currSeq.

[0452] S2308, readIdx++.

[0453] S2309, rmax=max(currSeq, rmax).

[0454] In short, in the embodiments of the present application, if the following conditions are met:

[0455] (TxSimContext.rmin==TxSimContext.rmax)&&(TxSimContext.rmax==Snapshot.CurrSeq);

[0456] Therefore, there is no conflict with any other transaction execution during the read operation of TxSimContxet. Although there may be transactions added to the snapshot during the execution, there are no transactions during the read operation. This means that the execution result of the transaction is correct and does not need to be repeated.

[0457] At this point, the master node reduces the repeated execution of master node transactions and avoids the waste of master node resources.

[0458] It should be noted that, for the detailed description of S2301 to S2309 shown in FIG23 , please refer to the aforementioned embodiment and will not be repeated here.

[0459] In the embodiment of the present application, in order to address read-write conflicts, the process of writing the execution result of the transaction into the transaction snapshot of the master node is detected by adding an execution context tag, thereby avoiding the phenomenon of the master node repeatedly executing transactions in related technologies and saving the resources of the master node.

[0460] Figure 24 is a block diagram of a transaction processing device according to an embodiment of the present application. As shown in Figure 24, the transaction processing device includes:

[0461] A first generating module 2401 is configured to generate execution information containing transaction identification information, wherein the execution information is used to instruct a slave node to execute multiple transactions corresponding to the transaction identification information in parallel;

[0462] The second generating module 2402 is configured to generate write information containing an execution result writing order, wherein the write information is used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order;

[0463] The sending module 2403 is configured to send the execution information and the write information to the slave node.

[0464] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are specifically configured as follows:

[0465] Executing the multiple transactions in parallel, and writing the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node;

[0466] Obtaining a writing order for writing the execution results of the multiple transactions into the transaction snapshot of the master node;

[0467] performing conflict detection on each transaction in sequence according to the write order to obtain a first conflict detection result for each transaction;

[0468] Based on the first conflict detection result, the execution information and the write information are generated.

[0469] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0470] If the first conflict detection result indicates that at least one of a read-write conflict and a write-read conflict exists between any transaction and a preceding transaction, then adding the identification information of any transaction to the first sequence, and sequentially adding the identification information of any transaction to the second sequence; wherein the execution result of the preceding transaction is written into the transaction snapshot of the master node earlier than the execution result of any transaction is written into the transaction snapshot of the master node;

[0471] If the first conflict detection result indicates that there is only a write-write conflict between any one of the transactions and the preceding transaction, then sequentially adding the identification information of any one of the transactions to the second sequence;

[0472] generating the execution information based on identification information of the plurality of transactions contained in the first sequence;

[0473] The write information is generated based on identification information of multiple transactions contained in the second sequence and an arrangement order of the multiple transactions in the second sequence.

[0474] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0475] In the process of performing conflict detection on any transaction according to the write order, obtaining a predecessor transaction of any transaction; wherein the execution result of the predecessor transaction is written into the transaction snapshot of the master node earlier than the execution result of any transaction is written into the transaction snapshot of the master node;

[0476] Detecting a conflict between any one of the transactions and the preceding transaction to obtain a first conflict detection result for the any one of the transactions.

[0477] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0478] Obtain the read-write set of any transaction and the read-write set of the preceding transaction;

[0479] Based on the read-write set of any one transaction and the read-write set of the preceding transaction, a conflict between the any one transaction and the preceding transaction is detected to obtain a first conflict detection result of the any one transaction.

[0480] In one embodiment of the present application, there are multiple transactions preceding any one of the transactions; the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0481] Obtaining the read-write set of any transaction and the read-write sets of multiple preceding transactions;

[0482] Based on the read-write set of any one transaction and the read-write sets of the multiple preceding transactions, conflicts between the any one transaction and the multiple preceding transactions are detected to obtain multiple first conflict detection results for the any one transaction.

[0483] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0484] During the process of writing the execution result of any transaction into the transaction snapshot of the master node, if it is detected that the number of execution results written in the transaction snapshot of the master node has changed, performing conflict detection on the any transaction to obtain a second conflict detection result for the any transaction;

[0485] If the second conflict detection result indicates that there is a read-write conflict between any one of the transactions and the preceding transaction, then re-execute any one of the transactions, and write the execution result obtained by re-executing any one of the transactions into the transaction snapshot of the master node; wherein the time when the execution result of the preceding transaction is written into the transaction snapshot of the master node is earlier than the time when the execution result of any one of the transactions is written into the transaction snapshot of the master node.

[0486] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0487] Obtaining a starting time point for writing the execution result of any one of the transactions into the transaction snapshot of the master node, and recording a first number of written execution results read from the transaction snapshot of the master node at the starting time point;

[0488] Obtaining a termination time point for writing the execution result of any one of the transactions into the transaction snapshot of the master node, and recording a second number of written execution results read from the transaction snapshot of the master node at the termination time point;

[0489] Based on the first quantity and the second quantity, a change in the quantity of the execution results written into the transaction snapshot of the master node during the process of writing the execution result of any transaction into the transaction snapshot of the master node is detected.

[0490] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0491] If the first quantity and the second quantity do not match, a first quantity detection result is obtained, where the first quantity detection result is used to indicate that, during the process of writing the execution result of any transaction into the transaction snapshot of the master node, the quantity of the execution results written into the transaction snapshot of the master node has changed;

[0492] If the first quantity and the second quantity match, a second quantity detection result is obtained, and the second quantity detection result is used to indicate that in the process of writing the execution result of any one of the transactions into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed.

[0493] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0494] During a time period between the starting time point and the ending time point, recording a plurality of third quantities of written execution results respectively read from the transaction snapshot of the master node;

[0495] Selecting the largest third quantity from the plurality of third quantities;

[0496] Matching the first quantity with the selected third quantity to obtain a first matching result;

[0497] Matching the second quantity with the selected third quantity to obtain a second matching result;

[0498] If at least one representation of the first matching result and the second matching result does not match, a first quantity detection result is obtained, where the first quantity detection result is used to indicate that, during the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node has changed;

[0499] If both the first matching result and the second matching result indicate a match, a second quantity detection result is obtained, and the second quantity detection result is used to indicate that, in the process of writing the execution result of any one of the transactions into the transaction snapshot of the master node, it is detected that the number of execution results written into the transaction snapshot of the master node has not changed.

[0500] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0501] Obtain the preceding transaction of any of the transactions;

[0502] Detecting a conflict between any one of the transactions and the preceding transaction to obtain a second conflict detection result for the any one of the transactions.

[0503] In one embodiment of the present application, the first generation module 2401 and the second generation module 2402 are further specifically configured as follows:

[0504] If a read / write conflict is detected between the any transaction and the preceding transaction based on the read / write set of the any transaction and the read / write set of the preceding transaction, a second conflict detection result is obtained, indicating that a read / write conflict exists between the any transaction and the preceding transaction;

[0505] If, based on the read-write set of any transaction and the read-write set of the preceding transaction, it is detected that no read-write conflict exists between any transaction and the preceding transaction, a second conflict detection result is obtained, indicating that no read-write conflict exists between any transaction and the preceding transaction.

[0506] In one embodiment of the present application, the sending module 2403 is specifically configured as follows:

[0507] generating proposal information based on the execution information and the written information;

[0508] The proposal information is sent to the slave node, so that the slave node executes the multiple transactions in parallel based on the execution information contained in the proposal information, obtains the execution results of the multiple transactions, and writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence based on the write information contained in the proposal information.

[0509] FIG25 is a block diagram of a transaction processing device according to an embodiment of the present application. As shown in FIG25 , the transaction processing device includes:

[0510] Receiving module 2501, configured to receive execution information containing transaction identification information and write information containing the execution result write order sent by the master node;

[0511] An execution module 2502 is configured to execute multiple transactions corresponding to the transaction identification information in parallel and obtain execution results of the multiple transactions;

[0512] The writing module 2503 is configured to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order.

[0513] In one embodiment of the present application, the transaction identification information includes identification information of multiple transactions; the execution module 2502 is specifically configured to:

[0514] Based on the identification information of the multiple transactions, acquiring transaction data of the multiple transactions corresponding to the identification information of the multiple transactions;

[0515] Execute the transaction data corresponding to the multiple transactions in parallel to obtain execution results of the multiple transactions.

[0516] In one embodiment of the present application, the transaction identification information includes identification information of multiple transactions; the execution module 2502 is further specifically configured to:

[0517] During the process of executing the transaction data corresponding to the multiple transactions in parallel, if it is detected that any transaction is completed, the execution status of the transaction is updated to an execution completion status.

[0518] In one embodiment of the present application, the writing module 2503 is specifically configured as follows:

[0519] If it is detected based on the write order that the execution result of the parent transaction of any transaction is to be written, then after writing the execution result of the parent transaction into the transaction snapshot of the slave node, the execution result of the any transaction is written into the transaction snapshot of the slave node; wherein the parent transaction is the transaction that should be written before the any transaction in the write order;

[0520] If it is detected based on the writing order that a sub-transaction of any transaction has an execution result, then after the execution result of any transaction is written into the transaction snapshot of the slave node, the execution result of the sub-transaction is written into the transaction snapshot of the slave node; wherein the sub-transaction is a transaction that should be written after the any transaction in the writing order.

[0521] It should be noted that the apparatus provided in the aforementioned embodiment and the method provided in the aforementioned embodiment belong to the same concept, wherein the specific manner in which each module and unit performs operations has been described in detail in the method embodiment.

[0522] An embodiment of the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, which enables the electronic device to implement the transaction processing method as described above when the one or more programs are executed by the one or more processors.

[0523] FIG26 is a schematic diagram of the structure of a computer system suitable for implementing an electronic device according to an embodiment of the present application.

[0524] It should be noted that the computer system 2600 of the electronic device shown in FIG26 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present application.

[0525] As shown in Figure 26, computer system 2600 includes a central processing unit (CPU) 2601, which can perform various appropriate actions and processes according to the program stored in read-only memory (ROM) 2602 or the program loaded from storage section 2608 into random access memory (RAM) 2603, such as the method for executing the above embodiment. Various programs and data required for system operation are also stored in RAM 2603. CPU 2601, ROM 2602 and RAM 2603 are connected to each other via bus 2604. Input / output (I / O) interface 2605 is also connected to bus 2604.

[0526] The following components are connected to the I / O interface 2605: an input section 2606 including a keyboard, a mouse, and the like; an output section 2607 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 2608 including a hard disk; and a communication section 2609 including a network interface card such as a LAN (Local Area Network) card or a modem. The communication section 2609 performs communication processing via a network such as the Internet. A drive 2610 is also connected to the I / O interface 2605 as needed. Removable media 2611, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 2610 as needed, so that computer programs read from the removable media can be installed in the storage section 2608 as needed.

[0527] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 2609, and / or installed from a removable medium 2611. When the computer program is executed by the central processing unit (CPU) 2601, the various functions defined in the system of the present application are executed.

[0528] It should be noted that the computer-readable medium shown in the embodiments of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable medium may be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries a computer-readable computer program. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, or any suitable combination thereof.

[0529] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, program segment, or part of the code, and the above-mentioned module, program segment, or part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0530] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. In some cases, the names of these units do not constitute limitations on the units themselves.

[0531] Another aspect of the present application provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the transaction processing method described above. The computer-readable medium may be included in the electronic device described in the above embodiments, or may exist independently and not be incorporated into the electronic device.

[0532] Another aspect of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable medium. A processor of a computer device reads the computer instructions from the computer-readable medium and executes the computer instructions, causing the computer device to perform the transaction processing method provided in each of the above embodiments.

[0533] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. Ordinary technicians in this field can easily make corresponding changes or modifications based on the main ideas and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.

Claims

1. A transaction processing method, executed by a computer device as a master node, comprising: Generate execution information containing transaction identification information, wherein the execution information is used to instruct the slave node to execute multiple transactions corresponding to the transaction identification information in parallel; Generate write information containing an execution result write order, wherein the write information is used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the write order; The execution information and the write information are sent to the slave node.

2. According to the method of claim 1, the step of generating the execution information including the transaction identification information and the step of generating the write information including the execution result write order comprises: Execute the multiple transactions in parallel, and write the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node; Obtaining a writing order for writing the execution results of the multiple transactions into the transaction snapshot of the master node; Performing conflict detection on each of the transactions in sequence according to the writing order to obtain a first conflict detection result for each of the transactions; Based on the first conflict detection result, the execution information and the write information are generated.

3. The method according to claim 2, wherein generating the execution information and the write information based on the first conflict detection result comprises: If the first conflict detection result indicates that at least one of a read-write conflict and a write-read conflict exists between any transaction and a preceding transaction, the identification information of any transaction is added to the first sequence, and the identification information of any transaction is added to the second sequence in sequence; wherein the time when the execution result of the preceding transaction is written into the transaction snapshot of the master node is earlier than the time when the execution result of any transaction is written into the transaction snapshot of the master node; If the first conflict detection result indicates that there is only a write-write conflict between any transaction and the preceding transaction, then adding the identification information of any transaction to the second sequence in sequence; generating the execution information based on identification information of the plurality of transactions contained in the first sequence; The write information is generated based on identification information of multiple transactions contained in the second sequence and an arrangement order of the multiple transactions in the second sequence.

4. The method according to claim 2, wherein the conflict detection is performed on each of the transactions in the writing order to obtain a first conflict detection result for each of the transactions, comprising: In the process of performing conflict detection on any transaction according to the writing order, obtaining a preceding transaction of any transaction; wherein the time when the execution result of the preceding transaction is written into the transaction snapshot of the master node is earlier than the time when the execution result of any transaction is written into the transaction snapshot of the master node; Detect a conflict between any one of the transactions and the preceding transaction, and obtain a first conflict detection result of any one of the transactions.

5. According to the method of claim 4, the detecting a conflict between the any transaction and the preceding transaction to obtain a first conflict detection result of the any transaction comprises: Obtaining the read-write set of any transaction and the read-write set of the preceding transaction; Based on the read-write set of any transaction and the read-write set of the preceding transaction, a conflict between any transaction and the preceding transaction is detected to obtain a first conflict detection result of any transaction.

6. According to the method of claim 5, there are multiple transactions preceding any one of the transactions; The obtaining of the read-write set of any transaction and the read-write set of the preceding transaction includes: Obtaining the read-write set of any transaction and the read-write sets of multiple preceding transactions; The detecting a conflict between the any transaction and the preceding transaction based on the read-write set of the any transaction and the read-write set of the preceding transaction, and obtaining a first conflict detection result of the any transaction, comprises: Based on the read-write set of any transaction and the read-write sets of the multiple preceding transactions, conflicts between any transaction and the multiple preceding transactions are detected to obtain multiple first conflict detection results of any transaction.

7. According to the method according to any one of claims 2 to 6, writing the execution results of the multiple transactions obtained by executing the multiple transactions in parallel into the transaction snapshot of the master node comprises: In the process of writing the execution result of any transaction into the transaction snapshot of the master node, if it is detected that the number of the execution results written into the transaction snapshot of the master node has changed, conflict detection is performed on the any transaction to obtain a second conflict detection result of the any transaction; If the second conflict detection result indicates that there is a read-write conflict between any of the transactions and a preceding transaction, then re-execute any of the transactions, and write the execution result obtained by re-executing any of the transactions into the transaction snapshot of the master node; wherein the time when the execution result of the preceding transaction is written into the transaction snapshot of the master node is earlier than the time when the execution result of any of the transactions is written into the transaction snapshot of the master node.

8. The method according to any one of claims 2 to 7, further comprising: Obtaining a starting time point for writing the execution result of any transaction into the transaction snapshot of the master node, and recording a first number of written execution results read from the transaction snapshot of the master node at the starting time point; Obtaining a termination time point for writing the execution result of any one of the transactions into the transaction snapshot of the master node, and recording a second number of written execution results read from the transaction snapshot of the master node at the termination time point; Based on the first quantity and the second quantity, a change in the quantity of the execution results written into the transaction snapshot of the master node during the process of writing the execution result of any transaction into the transaction snapshot of the master node is detected.

9. The method according to claim 8, wherein the detecting, based on the first quantity and the second quantity, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, a change in the quantity of the execution results written into the transaction snapshot of the master node comprises: If the first quantity and the second quantity do not match, a first quantity detection result is obtained, where the first quantity detection result is used to indicate that, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of the execution results written into the transaction snapshot of the master node changes; If the first quantity and the second quantity match, a second quantity detection result is obtained, and the second quantity detection result is used to characterize that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written in the transaction snapshot of the master node has not changed.

10. The method according to claim 8, wherein the detecting, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, based on the first quantity and the second quantity, a change in the quantity of the execution results written into the transaction snapshot of the master node comprises: In a time period between the starting time point and the ending time point, a plurality of third quantities of written execution results respectively read from the transaction snapshot of the master node are recorded; Selecting the largest third quantity from the plurality of third quantities; Matching the first quantity with the selected third quantity to obtain a first matching result; Matching the second number with the selected third number to obtain a second matching result; If at least one of the first matching result and the second matching result does not match, a first quantity detection result is obtained, where the first quantity detection result is used to indicate that, in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of the execution results written into the transaction snapshot of the master node changes; If both the first matching result and the second matching result indicate a match, a second quantity detection result is obtained, and the second quantity detection result is used to indicate that in the process of writing the execution result of any transaction into the transaction snapshot of the master node, the number of execution results written into the transaction snapshot of the master node has not changed.

11. The method according to claim 7, wherein the performing conflict detection on any transaction to obtain a second conflict detection result of any transaction comprises: Obtain the previous transaction of any of the transactions; Detect a conflict between any one of the transactions and the preceding transaction, and obtain a second conflict detection result of any one of the transactions.

12. The method according to claim 11, wherein the detecting a conflict between the any transaction and the preceding transaction to obtain a second conflict detection result of the any transaction comprises: If a read / write conflict is detected between any transaction and the preceding transaction based on the read / write set of any transaction and the read / write set of the preceding transaction, a second conflict detection result is obtained for indicating that a read / write conflict exists between any transaction and the preceding transaction; If, based on the read-write set of any transaction and the read-write set of the preceding transaction, it is detected that there is no read-write conflict between any transaction and the preceding transaction, a second conflict detection result is obtained for indicating that there is no read-write conflict between any transaction and the preceding transaction.

13. The method according to any one of claims 1 to 12, wherein sending the execution information and the write information to the slave node comprises: generating proposal information based on the execution information and the write information; The proposal information is sent to the slave node, so that the slave node executes the multiple transactions in parallel based on the execution information contained in the proposal information to obtain the execution results of the multiple transactions, and writes the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence based on the write information contained in the proposal information.

14. A transaction processing method, executed by a computer device as a slave node, comprising: Receive execution information containing transaction identification information and write information containing the execution result write order sent by the master node; Execute multiple transactions corresponding to the transaction identification information in parallel to obtain execution results of the multiple transactions; According to the writing order, the execution results of the multiple transactions are sequentially written into the transaction snapshot of the slave node.

15. The method according to claim 14, wherein the transaction identification information includes identification information of multiple transactions; The parallel execution of the multiple transactions corresponding to the transaction identification information to obtain the execution results of the multiple transactions includes: Based on the identification information of the multiple transactions, acquiring transaction data of the multiple transactions respectively corresponding to the identification information of the multiple transactions; The transaction data corresponding to the multiple transactions are executed in parallel to obtain the execution results of the multiple transactions respectively.

16. A transaction processing device, comprising: A first generating module is configured to generate execution information containing transaction identification information, wherein the execution information is used to instruct the slave node to execute multiple transactions corresponding to the transaction identification information in parallel; A second generating module is configured to generate writing information containing an execution result writing order, wherein the writing information is used to instruct the slave node to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order; The sending module is configured to send the execution information and the write information to the slave node.

17. A transaction processing device, comprising: A receiving module, configured to receive execution information containing transaction identification information and writing information containing the writing order of execution results sent by the master node; an execution module, configured to execute multiple transactions corresponding to the transaction identification information in parallel and obtain execution results of the multiple transactions; The writing module is configured to write the execution results of the multiple transactions into the transaction snapshot of the slave node in sequence according to the writing order.

18. A computer device comprising: one or more processors; A memory for storing one or more programs, which, when executed by the electronic device, enables the electronic device to implement the transaction processing method described in any one of claims 1 to 15.

19. A computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the transaction processing method according to any one of claims 1 to 15.

20. A computer program product, comprising computer instructions, which, when executed by a processor, implement the transaction processing method according to any one of claims 1 to 15.