Method and device for concurrently executing transactions in a blockchain

By using variable access tables in blockchain nodes to record the read and write operations of transactions to variables, and determining the order of transaction execution, the problem of inefficient concurrent execution transactions in blockchain is solved, and efficient transaction processing is achieved.

CN113570460BActive Publication Date: 2025-04-22ANTCHAIN TECHNOLOGY PTE LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110839216.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-08-30
Publication Date
2025-04-22
Estimated Expiration
2039-08-30

AI Technical Summary

Technical Problem

The prior art has inefficient problems when multiple transactions are executed concurrently in blockchain, especially when there are dependencies between transactions, which will affect the final result.

Method used

By presetting the variable access table in the nodes of the blockchain, recording the read and write operations of the transaction to the same variable, determining the order of transaction execution, allowing concurrent execution of transactions without dependencies and serial execution of transactions.

Benefits of technology

While ensuring the consistency of calculation results, it improves transaction processing speed and performance and saves processing time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113570460B_ABST
    Figure CN113570460B_ABST
Patent Text Reader

Abstract

An embodiment of the present specification provides a method for concurrently executing multiple transactions in a blockchain, wherein the multiple transactions have a predetermined submission order, including a first transaction, and the method is executed at a first node in the blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the method includes: for each previous transaction, determining based on the write field: whether the write operation on the first variable in the previous transaction has been executed, wherein the previous transaction is a transaction in the multiple transactions whose submission order is before the first transaction; and based on the determination result, executing a read operation on the first variable in the first transaction.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application with application number 201910816544.8 filed on August 30, 2019, and entitled “Method and device for concurrently executing transactions in blockchain”. Technical Field

[0002] The embodiments of this specification relate to the field of blockchain technology, and more specifically, to a method and device for concurrently executing multiple transactions in a blockchain. Background Art

[0003] Blockchain technology is a new distributed infrastructure and computing paradigm built on a peer-to-peer (P2P) network, using chain data structures to verify and store data, using distributed node consensus algorithms to generate and update data, using cryptography to ensure the security of data transmission and access, and using smart contracts composed of automated script codes to program and operate data. Blockchain technology, also known as distributed ledger technology, is a decentralized distributed database technology characterized by decentralization, openness, transparency, immutability, and trustworthiness. Every piece of data in the blockchain will be broadcast to blockchain nodes across the entire network, and each full node has full and consistent data. Nodes in the blockchain perform services such as transfers and data storage by sending transactions. The accounting nodes in the blockchain collect transactions in the blockchain in the transaction pool, execute the transactions, and after executing the transactions, package the transactions into blocks and spread them to the blockchain. The verification nodes in the blockchain will verify the blocks sent from the accounting nodes. After the verification is passed, each node will execute each transaction included in the block when receiving the block. In order to ensure the data consistency of each node, when executing multiple transactions in a block in each node, the submission order of the multiple transactions needs to be consistent, so that a consistent execution result can be obtained. Therefore, in the prior art, the accounting node will number the multiple transactions to be executed according to a predetermined rule before executing the transaction, and execute the multiple transactions in sequence according to the order of the numbers, that is, submit the multiple transactions in sequence, and other nodes will also execute and submit the multiple transactions in sequence according to the above transaction number order after receiving the block. However, the multiple transactions are not necessarily interdependent. In the case where there is no dependency between the two transactions, the concurrent execution of the two transactions does not affect the final result. If there is a dependency between the two concurrently executed transactions, the concurrent execution will affect the final result.

[0004] Therefore, a more efficient method of executing multiple transactions concurrently in a blockchain is needed. Summary of the invention

[0005] The embodiments of this specification are intended to provide a more efficient method for concurrently executing multiple transactions in a blockchain to address the deficiencies in the prior art.

[0006] To achieve the above-mentioned purpose, in one aspect, the present specification provides a method for concurrently executing multiple transactions in a blockchain, wherein the multiple transactions have a predetermined submission order, including a first transaction, and the method is executed at a first node in the blockchain, the first node is preset with a variable access table, and the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the method includes:

[0007] For each previous transaction, determining based on the write field: whether a write operation on the first variable in the previous transaction has been executed, wherein the previous transaction is a transaction in the plurality of transactions whose submission order is before the first transaction; and

[0008] Based on the determination result, a read operation on the first variable in a first transaction is performed.

[0009] In one embodiment, the variable access table is stored locally, wherein, based on the determination result, performing a read operation on the first variable in the first transaction includes, for each previous transaction, in the case where it is determined based on the write field that a write operation on the first variable is not performed, performing a read operation on the first variable in the first transaction.

[0010] In one embodiment, based on the determination result, executing the read operation on the first variable in the first transaction includes, for a second transaction whose submission order is before the first transaction in the multiple transactions, in a case where it is determined based on the write field that the write operation on the first variable in the second transaction has been executed, waiting relative to the first transaction to execute the read operation on the first variable in the first transaction after submitting the second transaction.

[0011] In one embodiment, the variable access table is stored locally, wherein for each previous transaction, determining based on the write field whether a write operation to the first variable in the previous transaction has been performed comprises sending a report to local dedicated hardware to request the dedicated hardware to perform the determination,

[0012] Based on the determination result, executing the read operation on the first variable in the first transaction includes executing the read operation on the first variable in the first transaction while sending the report, and determining whether to re-execute the first transaction based on the determination result received from the dedicated hardware before submitting the first transaction.

[0013] In one embodiment, the variable access table is stored in a dedicated server, wherein for each previous transaction, determining based on the write field whether a write operation on the first variable in the previous transaction has been performed comprises sending a report to the dedicated server to request the dedicated server to make the determination,

[0014] Based on the determination result, executing the read operation on the first variable in the first transaction includes, while sending the report, requesting the dedicated server to execute the read operation on the first variable in the first transaction, and before submitting the first transaction, determining whether to re-execute the first transaction based on the determination result received from the dedicated server.

[0015] In one embodiment, the variable access table also includes a read field corresponding to the first variable, and the read field is used to record the execution of the read operation on the first variable in the multiple transactions. The method also includes, after executing the read operation on the first variable in the first transaction, modifying the read field accordingly.

[0016] In one embodiment, the read field includes a plurality of bits corresponding to the plurality of transactions respectively, wherein modifying the read field accordingly includes modifying the bit in the read field corresponding to the first transaction accordingly.

[0017] In one embodiment, the multiple transactions further include a second transaction, wherein the submission order of the second transaction is ranked first among the multiple transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, the method further includes:

[0018] Based on the read field, determining whether a read operation on the first variable in a first transaction has been performed;

[0019] In the case where it is determined that the read operation on the first variable in the first transaction has been executed, the local device is notified to re-execute the read operation on the first variable in the first transaction.

[0020] In one embodiment, the multiple transactions further include a third transaction, wherein the submission order of the third transaction is between the first transaction and the second transaction, and the method further includes:

[0021] After receiving a notification from a local device to re-execute the read operation on the first variable in the first transaction, determining based on the write field whether the write operation on the first variable in the third transaction has been executed;

[0022] In the case where it is determined that the write operation in the third transaction has been executed, waiting is performed to re-execute the read operation on the first variable in the first transaction after the write operation on the first variable in the third transaction is committed.

[0023] In one embodiment, a predetermined number of bits included in the write field correspond to a predetermined number of transactions respectively, and the method further includes, after submitting the second transaction, restoring a first value of the bit in the write field corresponding to the second transaction, wherein the first value is used to record that a write operation on the first variable in the second transaction has been executed.

[0024] In one embodiment, a predetermined number of bits included in the read field correspond to a predetermined number of transactions respectively, and the second transaction also includes a read operation on the first field. The method also includes, after submitting the second transaction, restoring a first value of the bit in the read field corresponding to the second transaction, wherein the first value is used to record that the read operation on the first variable in the second transaction has been executed.

[0025] In one embodiment, a transaction execution window is preset in the first node, and the multiple transactions are multiple transactions currently included in the transaction execution window, wherein the number of the multiple transactions is less than or equal to the predetermined number, and the method further includes, after submitting the second transaction, moving the transaction execution window backward by one transaction among the multiple transactions included in the first node and arranged in a predetermined submission order.

[0026] In one embodiment, the variable access table further includes a first global variable for indicating the position of the transaction execution window.

[0027] In one embodiment, the variable access table also includes a serial number field corresponding to the first variable, which is used to indicate a transaction batch corresponding to the first variable.

[0028] In one embodiment, the variable access table includes a key corresponding to the first variable, and the key is a hash value of the first variable.

[0029] On the other hand, the present specification provides a device for concurrently executing multiple transactions in a blockchain, wherein the multiple transactions have a predetermined submission order, including a first transaction, the device is deployed in a first node in the blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the device includes:

[0030] A first determining unit is configured to determine, for each previous transaction, based on the write field: whether a write operation on the first variable in the previous transaction has been executed, wherein the previous transaction is a transaction in the plurality of transactions whose submission order is before the first transaction; and

[0031] The execution unit is configured to execute a read operation on the first variable in the first transaction based on the determination result.

[0032] In one embodiment, the variable access table is stored locally, wherein the execution unit is further configured to, in a case where it is determined based on the write field that a write operation on the first variable is not performed for each previous transaction, execute a read operation on the first variable in the first transaction.

[0033] In one embodiment, the execution unit is further configured to, for a second transaction in the multiple transactions whose submission order is before the first transaction, wait relative to the first transaction in a case where it is determined based on the write field that the write operation on the first variable in the second transaction has been executed, so as to execute the read operation on the first variable in the first transaction after submitting the second transaction.

[0034] In one embodiment, the variable access table is stored locally, wherein the first determination unit is further configured to send a report to local dedicated hardware to request the dedicated hardware to perform the determination,

[0035] The execution unit is further configured to, while sending the report, execute a read operation on the first variable in the first transaction, and determine whether to re-execute the first transaction based on a determination result received from the dedicated hardware before submitting the first transaction.

[0036] In one embodiment, the variable access table is stored in a dedicated server, wherein the first determination unit is further configured to send a report to the dedicated server to request the dedicated server to perform the determination,

[0037] The execution unit is further configured to, while sending the report, execute a read operation on the first variable in the first transaction, and determine whether to re-execute the first transaction based on a determination result received from the dedicated server before submitting the first transaction.

[0038] In one embodiment, the variable access table also includes a read field corresponding to the first variable, and the read field is used to record the execution of the read operation on the first variable in the multiple transactions. The device also includes a modification unit configured to modify the read field accordingly after executing the read operation on the first variable in the first transaction.

[0039] In one embodiment, the read field includes a plurality of bits corresponding to the plurality of transactions respectively, wherein the modification unit is further configured to modify the bit in the read field corresponding to the first transaction accordingly.

[0040] In one embodiment, the multiple transactions further include a second transaction, wherein the submission order of the second transaction is ranked first among the multiple transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, the device further includes:

[0041] a second determining unit configured to determine, based on the read field, whether a read operation on the first variable in the first transaction has been performed;

[0042] The notification unit is configured to, when it is determined that the read operation on the first variable in the first transaction has been executed, notify the local to re-execute the read operation on the first variable in the first transaction.

[0043] In one embodiment, the multiple transactions further include a third transaction, wherein the submission order of the third transaction is between the first transaction and the second transaction, and the apparatus further includes:

[0044] a third determining unit configured to, after receiving a notification from a local device to re-execute the read operation on the first variable in the first transaction, determine whether the write operation on the first variable in the third transaction has been executed based on the write field;

[0045] The waiting unit is configured to wait, if it is determined that the write operation in the third transaction has been executed, so as to re-execute the read operation on the first variable in the first transaction after the write operation on the first variable in the third transaction is committed.

[0046] In one embodiment, a predetermined number of bits included in the write field correspond to a predetermined number of transactions respectively, and the device further includes a first restoration unit configured to, after submitting the second transaction, restore a first value of a bit in the write field corresponding to the second transaction, wherein the first value is used to record that a write operation on the first variable in the second transaction has been executed.

[0047] In one embodiment, a predetermined number of bits included in the read field correspond to a predetermined number of transactions respectively, the second transaction also includes a read operation on the first field, and the device also includes a second restoration unit configured to, after submitting the second transaction, restore a first value of the bit in the read field corresponding to the second transaction, wherein the first value is used to record that the read operation on the first variable in the second transaction has been executed.

[0048] In one embodiment, a transaction execution window is preset in the first node, and the multiple transactions are multiple transactions currently included in the transaction execution window, wherein the number of the multiple transactions is less than or equal to the predetermined number, and the device also includes a window moving unit configured to, after submitting the second transaction, move the transaction execution window backward by one transaction among the multiple transactions arranged in a predetermined submission order included in the first node.

[0049] On the other hand, the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the above methods.

[0050] On the other hand, the present specification provides a computing device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, any of the above methods is implemented.

[0051] By using the scheme for concurrently executing transactions in a blockchain according to the embodiments of the present specification, by using a variable access table to record the read and write operations on the same variable performed by multiple transactions executed concurrently in a transaction execution window, multiple transactions without mutual dependence can be executed concurrently, and multiple transactions with mutual dependence can be executed serially, thereby accelerating the processing speed and improving the processing performance while ensuring the consistency of the calculation results. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The embodiments of this specification are described in conjunction with the accompanying drawings to make the embodiments of this specification clearer:

[0053] Figure 1 The blockchain system according to the embodiment of this specification is shown;

[0054] Figure 2 A flow chart showing a method for concurrently executing multiple transactions in a blockchain according to an embodiment of this specification;

[0055] Figure 3 Show Figure 1 The entry in the variable access table in that corresponds to the first variable;

[0056] Figure 4 A schematic diagram of a transaction execution window according to an embodiment of the present specification is shown;

[0057] Figure 5 An apparatus 5000 for concurrently executing multiple transactions in a blockchain according to an embodiment of this specification is shown. DETAILED DESCRIPTION

[0058] The embodiments of this specification will be described below with reference to the accompanying drawings.

[0059] Figure 1 A schematic diagram of a blockchain system according to an embodiment of this specification is shown. Figure 1 As shown, the system includes multiple nodes constituting a blockchain (six nodes are schematically shown in the figure), and these nodes are connected in pairs, including, for example, node 11, node 12 and node 13. As known to those skilled in the art, in a blockchain, some nodes collect multiple transactions in the blockchain and put them into a transaction pool and compete for the right to keep accounts. For example, node 11 in the figure becomes a bookkeeping node by acquiring the right to keep accounts. After becoming a bookkeeping node, node 11 will execute multiple transactions in its transaction pool, and package the multiple transactions into blocks and send them to other nodes, such as node 12. Node 12 will verify the block and similarly execute multiple transactions in the block. After a predetermined number of nodes verify the block, that is, a consensus is reached on the block, other nodes in the blockchain (such as node 13) will not need to continue to verify the block, but directly execute the transactions in the block to update local related data.

[0060] The multiple transactions may involve calculations of multiple variables. When the same variables are not involved in two transactions, the execution order will not affect the final calculation results. However, when the same variables are involved in two transactions, the execution order will affect the final calculation results. Therefore, in the embodiments of the present specification, in order to ensure that the execution results of multiple transactions by each node are the same, each node is preset with its own variable access table, such as variable access table 11, variable access table 12, and variable access table 13 corresponding to node 11, node 12, and node 13, respectively. The variable access table includes entries for each variable involved in multiple transactions, and the variable entries include execution records of the variable by each transaction. For example, as shown in the enlarged view of variable access table 11 for node 11 in the figure, the variable access table includes k1, k2, ...k n etc., and with k1, k2, …k n The corresponding write field, read field, window position (field) and sequence number (field) are k1, k2, ... k nThey are keys corresponding to the variables included in multiple transactions, which are, for example, hash values ​​of the variables. n can take a larger value, such as 1 million. Among them, the write field is used to record the write operation performed by the execution body corresponding to each transaction on the corresponding variable, and the read field is used to record the read operation performed by the execution body corresponding to each transaction on the corresponding variable. The execution body can be, for example, any one of a thread, a process, and a coroutine. In the embodiment of this specification, due to the large number of transactions, a transaction execution window can be set, that is, only multiple transactions in the transaction execution window are currently executed concurrently. In this case, as shown in the figure, the window position in the variable access table is used to indicate the position of the current transaction execution window, and the window position field value can be obtained based on the global variable preset corresponding to the window position. The serial number is the transaction batch number.

[0061] Thus, when executing multiple transactions in a block (for example, multiple transactions in a transaction execution window), by referring to the variable access table, multiple transactions that do not have mutual dependencies can be executed concurrently, and multiple transactions that have mutual dependencies can be executed serially by rereading, waiting, etc., thereby ensuring that the calculation results of each node are consistent and executing some transactions concurrently, saving processing time and improving calculation efficiency.

[0062] Understandably, the above Figure 1 The description is for illustration only and is not intended to limit the scope of the embodiments of this specification. For example, the variable access table is not limited to Figure 1 The table shown in , but can be changed as needed. For example, the variable access table does not necessarily include the window position field and the sequence number field, etc. The process of concurrently executing transactions according to the embodiment of this specification will be described in detail below.

[0063] Figure 2 A flow chart of a method for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification is shown, wherein the multiple transactions have a predetermined submission order, including a first transaction, the method is executed at a first node in the blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the method includes:

[0064] Step S202, for each previous transaction, determining based on the write field: whether a write operation on the first variable in the previous transaction has been executed, wherein the previous transaction is a transaction in the multiple transactions whose submission order is before the first transaction; and

[0065] Step S204: Based on the determination result, executing a read operation on the first variable in the first transaction.

[0066] As mentioned above Figure 1 As described in, the method is executed in a node of the blockchain. When the node is packaging a block, or after the node receives a newly generated block, it will execute and submit multiple related transactions. For example, a block may include thousands of transactions, and these thousands of transactions may involve hundreds of variables, wherein multiple transactions may access different variables, or multiple transactions may access the same variable. In the prior art, in the accounting node, the transaction numbers of the multiple transactions to be packaged into a block have been determined according to a predetermined rule, and the order of the transaction numbers indicates the execution order and submission order of the transactions. In the embodiments of the present specification, in order to make the final calculation result the same as the serial calculation result in the prior art, a predetermined submission order is retained for multiple transactions in a block, that is, the numbering order of each transaction is used as its respective submission order. At the same time, based on the variable access table preset by each node, transactions without dependencies can be executed concurrently, and transactions with dependencies are executed serially according to the order of their numbers. Among them, for transactions 1 and 2 numbered successively, if the first variable is written in transaction 1 and the first variable is read in transaction 2, then transaction 2 depends on the result of transaction 1.

[0067] Figure 3 Show Figure 1 The entry in the variable access table in corresponds to the first variable. Figure 3 As shown in , the first variable corresponds to k1 in the variable access table, for example, and k1 is the key value of the first variable, which is, for example, the hash value of the first variable. It can be understood that k1 is not limited to the hash value of the first variable, but can also be any identifier of the first variable. In the variable access table, the fields corresponding to k1 include the following fields corresponding to the first variable: a write field, a read field, a window position field, and a serial number field. Among them, the write field and the read field both include a predetermined number of bits (only 6 bits are schematically shown in the figure), for example, the number of bits is 64 bits, which should be greater than or equal to the maximum number of transactions executed concurrently in the blockchain, so that each concurrently executed transaction can uniquely correspond to a bit in the field. Among them, as Figure 3As shown in , the initial values ​​of each bit in the write field and the read field are all 0. The write field is used to record whether each write operation included in the multiple transactions executed concurrently has been executed, and the read field is used to record whether each read operation included in the multiple transactions executed concurrently has been executed. For example, in the write field, for a predetermined number of multiple transactions executed concurrently (for example, 5 transactions), the corresponding bit in 64 bits can be determined by taking the transaction number modulo 64. That is, in order to save memory, the read-write field is set as a ring buffer so that multiple transactions can reuse the read-write field. For example, the access information of up to 64 transactions can be recorded in the read-write field, so that transaction 1 and transaction 65 will use the same position for recording. In the bit corresponding to the first transaction in the write field, for example, when the first transaction does not perform a write operation on the first variable, the value in the bit corresponding to the first transaction is 0. After the first transaction performs a write operation on the first variable, the value in the bit can be modified to 1. In the embodiment of the present specification, executing a write operation on a variable means executing the write operation in the local memory without actually writing the variable. In the present embodiment, the actual write operation is performed on the variable only when the transaction is submitted. The values ​​of each bit of the read field can be modified similarly. For example, when the first transaction does not perform a read operation on the first variable, the value in the bit corresponding to the first transaction in the read field is 0. After the first transaction performs a read operation on the first variable, the value in the bit can be modified to 1. In the embodiment of the present specification, executing a read operation on a variable means reading the stored variable to obtain the current value of the variable.

[0068] Understandably, Figure 3 The read-write fields shown are only a specific implementation of the read-write fields according to this example. The read-write fields according to the embodiments of this specification are not limited to Figure 3 The specific form shown is sufficient as long as it can record the read / write operations of the execution bodies of each concurrently executed transaction on the first variable.

[0069] Usually, when there are a large number of transactions to be executed, a transaction execution window can be set when executing transactions, and the transaction execution window may include a predetermined number of transactions. The purpose of the transaction execution window is to allow the execution body to know that "the input information obtained by this transaction is the latest, and it can be finally submitted without waiting for other transactions" when the execution body completes the transaction at the lower limit of the window. For transactions in the middle of the window, the execution body cannot be sure whether the transaction has obtained the latest input after executing the transaction, so it has to wait until it is at the lower limit of the window before it can be finally submitted. Before submission, the transaction may find that it has been marked for redo; the upper limit of the window is used to limit the amount of resources used to execute transactions. If the upper limit is infinite, even if no transaction is finally submitted, the execution body can continue to process transactions until the memory resources are exhausted.

[0070] The transaction execution window is slid among multiple transactions arranged in submission order (or transaction number), so that multiple transactions in the transaction execution window can be executed concurrently in the blockchain node, and it can be set that each time a transaction is submitted, the transaction execution window is slid back by one transaction. Figure 4 FIG. 1 shows a schematic diagram of a transaction execution window according to an embodiment of the present specification. Figure 4 As shown in the figure, the ten numbers 1 to 10 in the figure represent ten transactions numbered 1 to 10, and the transaction execution window may include, for example, 5 transactions. The transaction execution window may initially fall on transactions 1 to 5. After transaction 1 is submitted, the window moves back one transaction, that is, falls on transactions 2 to 6. Similarly, after transaction 2 is submitted, the window moves back one transaction, and thus falls on transactions 3 to 7 as shown in the figure.

[0071] thereby, Figure 3 The window position field in is used to indicate the current position of the transaction execution window. The window position field corresponds to the first global variable, so that the field corresponding to each variable can obtain the current window position based on the first global variable. The first global variable can be set to be equal to the starting transaction number, the ending transaction number, etc. of the current window. For example, in the window position such as Figure 4 In the case shown, Figure 3 The window position in the window can be filled with "3", that is, in this case, the window position is identified by the starting transaction in the window. The window position field can correspond to multiple values, for example, the first value corresponds to the transaction number that should be submitted serially at present, the second value corresponds to the maximum number of transactions in the processing state, or the second value can be the number of transactions included in the window, etc.

[0072] In the case where a block includes several thousand transactions, these transactions can be executed in batches. For example, each batch of transactions can be set to include 1,000 transactions, and a batch number can be set for each batch of transactions. Thus, the serial number field can indicate the batch number of the currently processed transaction. For example, when executing a write or read operation on a first variable by a first transaction, the current batch number of the first transaction can be compared with the batch number indicated in the serial number field of the first variable recorded in the variable access table. If the two are consistent, the operation can continue to be executed. If the two are inconsistent, the existing data corresponding to the first variable in the variable access table can be cleared. For example, Figure 3The serial number shown is "2", which means that the transaction being executed is the second batch of transactions. The second batch of transactions are also numbered from 1 to 1000, and are distinguished from the transactions numbered from 1 to 1000 in the first batch by the serial number "2". By adding a serial number field to the variable access table, the clearing setting of the variable access table can be avoided. In the variable access table, the access rate of each variable may be different, and some variables (such as variable k2) may easily cause conflicts. For the variable k2, it is necessary to mark it so that the read access to the variable k2 will proceed after the previous transaction is submitted. If the serial number field is used, by judging whether the batch number is out of date, it can be used as a mark for the variable k2. If the serial number method is not used, it can be cleared asynchronously.

[0073] Understandably, Figure 3 The variable access table shown is only illustrative and is not intended to limit the scope of the embodiments of this specification. For example, in the case where the number of concurrently executed transactions is small, there is no need to batch the transactions, nor is there a need to control the number of transaction executions through the transaction execution window, so that the variable access table may only include a write field and a read field. In one embodiment, the variable access table may only include a write field, so that when executing a read operation in a transaction, the read operation can be performed by judging whether the concurrently executed transaction with the previous number has performed a write operation based on the write field, and when executing a write operation in a transaction, the transactions with the subsequent number can be notified so that the transactions with the subsequent number that have performed a read operation can re-execute the read operation. In one embodiment, the variable access table may only include a read field, so that when executing a read operation in a transaction, it can be performed directly, and when executing a write operation in a transaction, it can be judged whether the concurrently executed transaction with the subsequent number has performed a read operation based on the read field, and after submission, the transaction that has performed the read operation can be notified to re-execute the read operation.

[0074] The steps in this method are described in detail below.

[0075] First, in step S202, for each previous transaction, it is determined based on the write field whether a write operation on the first variable in the previous transaction has been executed, wherein the previous transaction is a transaction in the multiple transactions whose submission order is before the first transaction.

[0076] For example, refer to Figure 4, for example, the window falls on transactions 3 to 7 as shown in the figure, that is, transactions 3 to 7 are currently being executed concurrently in the blockchain node, for example, transactions 3 to 7 can be executed concurrently by 5 execution bodies 3 to 7, for example, in the Ethereum node, transactions 3 to 7 are specifically executed concurrently in the virtual machine. In this case, assuming that transaction 6 is the first transaction, it is about to perform a read operation on the first variable. Since transactions 3 to 7 are submitted in sequence according to the transaction number sequence, transaction 6 needs to determine whether transactions 3 to 5 being executed simultaneously have performed a write operation. If any of transactions 3 to 5 performs a write operation, the write operation will eventually change the value of the first variable. Therefore, transaction 6 needs to wait until the previous transaction including the write operation is submitted before it can read the value of the first variable after the write operation. For example, transaction 4 includes a write operation on a first variable, and the write operation in transaction 4 has currently been executed in the node, so that the bit corresponding to transaction 4 in the write field corresponding to the first variable in the variable access table is modified to 1, and the execution body corresponding to transaction 6 in the node can know that other execution bodies in the node have executed the write operation on the first variable in transaction 4 based on the variable access table.

[0077] In one embodiment, the blockchain node is deployed on a server, so that the variable access table is stored in a local shared memory. In this case, the execution body corresponding to transaction 6 can obtain the search result almost at the same time as searching the variable access table.

[0078] In one embodiment, the blockchain node is deployed on multiple servers, so that the variable access table is stored on a dedicated server, for example, and other servers in the node can receive information in the variable access table from the dedicated server by accessing the dedicated server.

[0079] In step S204, based on the determination result, a read operation on the first variable in the first transaction is performed.

[0080] In one embodiment, in the case where the variable access table is stored in a local shared memory, the execution body corresponding to transaction 6 can obtain the search result almost at the same time as the variable access table is searched, and perform subsequent operations based on the result after obtaining the search result. For example, after performing the above query on each transaction before it, transaction 6 determines that transactions 3 to 5 have not currently performed a write operation on the first variable, that is, the execution of transactions 3 to 5 has not currently changed the value of the first variable, so the execution body 6 performs a read of the value of the first variable. For example, after performing the above query on each transaction before it, the execution body 6 determines that the execution body 4 has performed a write operation on the first variable, then transaction 6 waits until transaction 4 is submitted, and then determines whether to read the first variable. After transaction 4 is submitted, as described above, the transaction execution window will move to 5 to 9, and the execution body 6 can again perform the above query on each transaction before it, that is, query whether the execution body 5 has performed a write operation on the first variable based on the variable access table. In the case where the execution body 5 has also performed the write operation, the execution body 6 will wait until transaction 5 is submitted before reading. For another example, after executing the above query for each transaction before it, Executor 6 determines that both Transaction 4 and Executor 5 have performed write operations on the first variable, then Transaction 6 waits until Transaction 5 is committed before reading the first variable. That is, Executor 6 needs to wait until the write operation of the transaction that is before Transaction 6 and closest to Transaction 6 among the multiple transactions executed concurrently is committed before performing the read operation. The write operation of the transaction that is after Transaction 6 among the concurrent transactions does not affect the execution of the read operation of Transaction 6.

[0081] In one embodiment, the variable access table is stored locally, and the execution body corresponding to transaction 6 can send a report to the local dedicated hardware to request the determination in the above steps of the dedicated hardware. The dedicated hardware is, for example, a local CPU or FPGA dedicated to accessing and rewriting the variable access table. While sending the report, the execution body 6 performs a read operation on the first variable, that is, the first variable is read directly without waiting for the query result to be received. Before transaction 6 is submitted, the execution body 6 determines whether to re-read the first variable based on the information received from the dedicated hardware. For example, after the dedicated hardware receives the report and performs a query, it is determined that there is a transaction that performs a write operation on the first variable in transactions 3 to 5 before transaction 6. In this case, the dedicated hardware notifies the execution body 6 to re-read the first variable.

[0082] In the case where the variable access table is stored on a dedicated server, for example, transactions 3 to 7 are currently executed concurrently by server 1, and the execution body corresponding to transaction 6 in server 1 is about to perform a read operation on the first variable. Server 1 sends a report to the dedicated server that the first variable will be read, so as to request the dedicated server to determine whether the execution body of the concurrently executed transaction before transaction 6 has performed a write operation on the first variable. While server 1 sends the report, the execution body 6 requests the dedicated server to perform a read operation on the first variable, that is, since it takes a long communication time to receive the query result from the dedicated server, the first variable is directly read without waiting for the query result to be received. Before transaction 6 is submitted, the execution body 6 determines whether to re-read the first variable based on the information received from the dedicated server. For example, after the dedicated server receives the report and performs a query, it is determined that there is a transaction that performs a write operation on the first variable in transactions 3 to 5 before transaction 6. In this case, the dedicated server notifies the execution body 6 to re-read the first variable. Here, in order to reduce the difficulty of development, the execution body 6 usually re-executes all transactions 6 after receiving the notification. For example, in the above query, no transaction is found that performs a write operation on the first variable in transactions 3 to 5, but the execution bodies of transactions 3 to 5 subsequently perform a write operation after execution body 6 reads, and writes into the variable access table of the dedicated server after submission, so that the dedicated server notifies execution body 6 to re-read the first variable based on the write, and execution body 6 re-executes transaction 6 before submission. In the above query, no transaction is found that performs a write operation on the first variable in transactions 3 to 5, and the execution bodies of transactions 3 to 5 do not perform a write operation after execution body 6 reads, that is, the dedicated server does not notify execution body 6 to re-read, and execution body 6 can directly submit transaction 6.

[0083] After the execution body 6 performs a read operation on the first variable as described above, the bit corresponding to transaction 6 in the read field corresponding to the first variable in the variable access table is modified to, for example, "1", which is, for example, 0 before the execution body 6 performs the read operation.

[0084] In one embodiment, the multiple transactions further include a second transaction, wherein the submission order of the second transaction is ranked first among the multiple transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, Figure 2 As shown in the dotted box, the method further includes the following steps:

[0085] Step S206, determining whether a read operation on the first variable in the first transaction has been performed based on the read field; and

[0086] Step S208: in the case where it is determined that the read operation on the first variable in the first transaction has been executed, notify the local to re-execute the read operation on the first variable in the first transaction.

[0087] In the above embodiment, for example Figure 4 The transaction 3 shown in is the second transaction. After the execution body 6 performs the read operation as described above, for example, the execution body 3 performs a write operation. Specifically, the execution body 3 stores the value to be written to the first variable in a predetermined position in the memory, and then modifies the bit corresponding to the transaction 3 in the write field corresponding to the first variable in the variable access table to "1". After this modification, for example, the execution body 7 will perform a read operation on the first variable after this modification. Similar to the above, by querying the variable access table, it can be known that the execution body 3 has performed a write operation on the first variable, so that the execution body 7 will wait for the transaction 3 to be submitted before performing the above read operation.

[0088] Since transaction 3 is located at the far left of the transaction execution window, after executing transaction 3, execution body 3 will submit transaction 3. For example, process 3 can determine whether to submit transaction 3 based on the window position field in the table. After submitting transaction 3, the first variable is actually written and the value of the first variable is modified. After submitting transaction 3, the following steps will be performed.

[0089] In step S206 , based on the read field, it is determined whether a read operation on the first variable in the first transaction has been performed.

[0090] After the transaction 3 is submitted, the execution body 3 determines whether the corresponding execution body has performed a read operation on the first variable for the other transactions (i.e., transactions 4 to 7) in the window before the submission, and if the read operation has been performed, the corresponding execution body is notified to re-perform the read operation. For example, as described above, transaction 6 (i.e., the first transaction) is a transaction after transaction 3 in the window, and the execution body 3 determines whether the execution body 6 has performed a read operation on the first variable based on the bit corresponding to transaction 6 in the read field.

[0091] In step S208, if it is determined that the read operation on the first variable in the first transaction has been executed, the local device is notified to re-execute the read operation on the first variable in the first transaction.

[0092] After the determination through the above steps, the executive body 3 notifies the executive body 6 to re-execute the read operation on the first variable after determining that the executive body 6 has performed the read operation based on the variable access table. In the case where the variable access table is stored in the local shared memory, the executive body 3 can mark in the private storage space of the transaction 6 to notify the executive body 6 to perform the reread operation, and the transaction 6 checks whether the reread mark exists before submission or at other times. Alternatively, after performing the marking, the executive body 3 can send an asynchronous signal to the executive body 6, and after receiving the asynchronous signal, the executive body 6 checks whether the current transaction is set to need to be reread (because the executive body may no longer be executing the transaction 6 when receiving the asynchronous signal), and if necessary, it enters the reread process. In the case where the variable access table is stored in another dedicated server, the server entrusts the host where the executive body 6 is located to mark through the network to notify the executive body 6 to perform the reread operation.

[0093] Executor 6 may immediately re-execute the read operation, or, alternatively, Executor 6 may check from the variable access table whether Executors 4 and 5 subsequently perform write operations. For example, if Executor 4 also performs a write operation, Executor 6 may wait until Transaction 4 is committed before re-executing the read operation.

[0094] In addition, after transaction 3 is submitted, the transaction execution window moves one position backward, that is, it is located on transactions 4 to 8. In this case, the execution body 3 also clears the bit corresponding to transaction 3 in the write field corresponding to the first variable in the variable access table so as not to affect the use of the bit by subsequent transactions. Similarly, if transaction 3 also includes a read operation, the execution body 3 also modifies the corresponding bit in the read field to 1 after executing the read operation before, and after submitting transaction 3, the execution body 3 also clears the bit.

[0095] Figure 5 An apparatus 5000 for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification is shown, wherein the multiple transactions have a predetermined submission order, including a first transaction, the apparatus is deployed in a first node in the blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the apparatus includes:

[0096] A first determining unit 501 is configured to determine, for each previous transaction, based on the write field: whether a write operation on the first variable in the previous transaction has been performed, wherein the previous transaction is a transaction in the multiple transactions whose submission order is before the first transaction; and

[0097] The execution unit 502 is configured to execute a read operation on the first variable in the first transaction based on the determination result.

[0098] In one embodiment, the variable access table is stored locally, wherein the execution unit 502 is further configured to, for each previous transaction, perform a read operation on the first variable in the first transaction in the case where it is determined based on the write field that a write operation on the first variable is not performed.

[0099] In one embodiment, the execution unit 502 is further configured to, for a second transaction in the multiple transactions whose submission order is before the first transaction, wait relative to the first transaction in a case where it is determined based on the write field that the write operation on the first variable in the second transaction has been executed, so as to execute the read operation on the first variable in the first transaction after submitting the second transaction.

[0100] In one embodiment, the variable access table is stored locally, wherein the first determination unit 501 is further configured to send a report to the local dedicated hardware to request the dedicated hardware to perform the determination.

[0101] The execution unit 502 is further configured to, while sending the report, execute a read operation on the first variable in the first transaction, and determine whether to re-execute the first transaction based on a determination result received from the dedicated hardware before submitting the first transaction.

[0102] In one embodiment, the variable access table is stored in a dedicated server, wherein the first determining unit 501 is further configured to send a report to the dedicated server to request the dedicated server to perform the determination.

[0103] The execution unit 502 is further configured to, while sending the report, request the dedicated server to execute a read operation on the first variable in the first transaction, and to determine whether to re-execute the first transaction based on a determination result received from the dedicated server before submitting the first transaction.

[0104] In one embodiment, the variable access table also includes a read field corresponding to the first variable, and the read field is used to record the execution of the read operation on the first variable in the multiple transactions. The device also includes a modification unit 503, configured to modify the read field accordingly after executing the read operation on the first variable in the first transaction.

[0105] In one embodiment, the read field includes a plurality of bits corresponding to the plurality of transactions respectively, wherein the modification unit is further configured to modify the bit in the read field corresponding to the first transaction accordingly.

[0106] In one embodiment, the multiple transactions further include a second transaction, wherein the submission order of the second transaction is ranked first among the multiple transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, the device further includes:

[0107] A second determining unit 504 is configured to determine, based on the read field, whether a read operation on the first variable in the first transaction has been performed; and

[0108] The notification unit 505 is configured to, when it is determined that the read operation on the first variable in the first transaction has been executed, notify the local to re-execute the read operation on the first variable in the first transaction.

[0109] In one embodiment, the multiple transactions further include a third transaction, wherein the submission order of the third transaction is between the first transaction and the second transaction, and the apparatus further includes:

[0110] a third determining unit 506 configured to, after receiving a notification from a local device to re-execute the read operation on the first variable in the first transaction, determine whether the write operation on the first variable in the third transaction has been executed based on the write field;

[0111] The waiting unit 507 is configured to wait, if it is determined that the write operation in the third transaction has been executed, so as to re-execute the read operation on the first variable in the first transaction after the write operation on the first variable in the third transaction is committed.

[0112] In one embodiment, a predetermined number of bits included in the write field correspond to a predetermined number of transactions respectively, and the device also includes a first restoration unit 508 configured to, after submitting the second transaction, restore a first value of the bit in the write field corresponding to the second transaction, wherein the first value is used to record that the write operation on the first variable in the second transaction has been executed.

[0113] In one embodiment, a predetermined number of bits included in the read field correspond to a predetermined number of transactions respectively, and the second transaction also includes a read operation on the first field. The device also includes a second restoration unit 509, configured to, after submitting the second transaction, restore a first value of the bit in the read field corresponding to the second transaction, wherein the first value is used to record that the read operation on the first variable in the second transaction has been executed.

[0114] In one embodiment, a transaction execution window is preset in the first node, and the multiple transactions are multiple transactions currently included in the transaction execution window, wherein the number of the multiple transactions is less than or equal to the predetermined number, and the device also includes a window moving unit 510, configured to, after submitting the second transaction, move the transaction execution window backward by one transaction among the multiple transactions arranged in a predetermined submission order included in the first node.

[0115] On the other hand, the present specification provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute any one of the above methods.

[0116] On the other hand, the present specification provides a computing device, including a memory and a processor, wherein executable code is stored in the memory, and when the processor executes the executable code, any of the above methods is implemented.

[0117] By using the scheme for concurrently executing transactions in a blockchain according to the embodiments of the present specification, by using a variable access table to record the read and write operations on the same variable performed by multiple transactions executed concurrently in a transaction execution window, multiple transactions without mutual dependence can be executed concurrently, and multiple transactions with mutual dependence can be executed serially, thereby accelerating the processing speed and improving the processing performance while ensuring the consistency of the calculation results.

[0118] It should be understood that the descriptions of “first”, “second”, etc. in this article are only used to distinguish similar concepts for the sake of simplicity of description and do not have any other limiting effect.

[0119] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0120] The above is a description of a specific embodiment of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0121] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those of ordinary skill in the art may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0122] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented by hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0123] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for concurrently executing multiple transactions in a blockchain, wherein: The multiple transactions have a predetermined submission order, including a first transaction, the method is executed at a first node in the blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the method includes: In the execution of a first transaction, for each preceding transaction of the first transaction, determining based on the write field: whether a write operation on the first variable in the preceding transaction has been executed, wherein the preceding transaction is a transaction in the plurality of transactions whose commit order is before the first transaction; and Based on the determination result, executing a read operation on the first variable in a first transaction; The variable access table is stored locally, wherein, based on the determination result, performing a read operation on the first variable in the first transaction comprises, in a case where, for each previous transaction, it is determined based on the write field that a write operation on the first variable is not performed, performing a read operation on the first variable in the first transaction; Alternatively, based on the determination result, executing the read operation on the first variable in the first transaction includes, for a second transaction whose submission order is before the first transaction in the multiple transactions, in a case where it is determined based on the write field that the write operation on the first variable in the second transaction has been executed, waiting relative to the first transaction to execute the read operation on the first variable in the first transaction after submitting the second transaction.

2. The method according to claim 1, wherein: The variable access table is stored locally, wherein for each previous transaction, determining based on the write field whether a write operation on the first variable in the previous transaction has been performed includes sending a report to local dedicated hardware to request the dedicated hardware to perform the determination, Based on the determination result, executing the read operation on the first variable in the first transaction includes executing the read operation on the first variable in the first transaction while sending the report, and determining whether to re-execute the first transaction based on the determination result received from the dedicated hardware before submitting the first transaction.

3. The method according to claim 1, wherein: The variable access table is stored in a dedicated server, wherein for each previous transaction, determining based on the write field whether a write operation on the first variable in the previous transaction has been performed comprises sending a report to the dedicated server to request the dedicated server to make the determination, Based on the determination result, executing the read operation on the first variable in the first transaction includes, while sending the report, requesting the dedicated server to execute the read operation on the first variable in the first transaction, and before submitting the first transaction, determining whether to re-execute the first transaction based on the determination result received from the dedicated server.

4. The method according to claim 1, wherein: The variable access table also includes a read field corresponding to the first variable, and the read field is used to record the execution of the read operation on the first variable in the multiple transactions. The method also includes, after executing the read operation on the first variable in the first transaction, modifying the read field accordingly.

5. The method according to claim 4, wherein: The read field includes a plurality of bits corresponding to the plurality of transactions respectively, wherein correspondingly modifying the read field includes correspondingly modifying a bit in the read field corresponding to the first transaction.

6. The method according to claim 4, wherein: The plurality of transactions further include a second transaction, wherein the submission order of the second transaction is ranked first among the plurality of transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, the method further includes: Based on the read field, determining whether a read operation on the first variable in a first transaction has been performed; and In the case where it is determined that the read operation on the first variable in the first transaction has been executed, the local device is notified to re-execute the read operation on the first variable in the first transaction.

7. The method according to claim 6, wherein: The multiple transactions also include a third transaction, wherein the submission order of the third transaction is between the first transaction and the second transaction, and the method further includes: After receiving a notification from a local device to re-execute the read operation on the first variable in the first transaction, determining based on the write field whether the write operation on the first variable in the third transaction has been executed; In the case where it is determined that the write operation in the third transaction has been executed, waiting is performed to re-execute the read operation on the first variable in the first transaction after the write operation on the first variable in the third transaction is committed.

8. The method according to claim 6, wherein: A predetermined number of bits included in the write field correspond to a predetermined number of transactions respectively. The method also includes, after submitting the second transaction, restoring a first value of the bit in the write field corresponding to the second transaction, wherein the first value is used to record that a write operation on the first variable in the second transaction has been executed.

9. The method according to claim 8, wherein: A predetermined number of bits included in the read field correspond to a predetermined number of transactions respectively, and the second transaction also includes a read operation on the first field. The method also includes, after submitting the second transaction, restoring a first value of the bit in the read field corresponding to the second transaction, wherein the first value is used to record that the read operation on the first variable in the second transaction has been executed.

10. The method according to claim 8, wherein: A transaction execution window is preset in the first node, and the multiple transactions are multiple transactions currently included in the transaction execution window, wherein the number of the multiple transactions is less than or equal to the predetermined number, and the method also includes, after submitting the second transaction, moving the transaction execution window backward by one transaction among the multiple transactions included in the first node and arranged in a predetermined submission order.

11. The method according to claim 10, wherein the variable access table further comprises a first global variable for indicating a position of the transaction execution window.

12. According to the method of claim 1, the variable access table also includes a serial number field corresponding to the first variable, which is used to indicate a transaction batch corresponding to the first variable.

13. The method according to claim 1, wherein: The variable access table includes a key corresponding to the first variable, and the key is a hash value of the first variable.

14. A device for concurrently executing multiple transactions in a blockchain, wherein: The multiple transactions have a predetermined submission order, including a first transaction, the device is deployed at a first node in a blockchain, the first node is preset with a variable access table, the variable access table includes a write field corresponding to a first variable, wherein the write field is used to record the execution of a write operation on the first variable in the multiple transactions, and the device includes: a first determining unit configured to, in the execution of a first transaction, determine, based on the write field, for each preceding transaction of the first transaction: whether a write operation on the first variable in the preceding transaction has been executed, wherein the preceding transaction is a transaction in the plurality of transactions whose submission order is before the first transaction; and an execution unit configured to, based on the determination result, execute a read operation on the first variable in the first transaction; The variable access table is stored locally, wherein the execution unit is configured to, in a case where it is determined based on the write field that a write operation on the first variable is not performed for each previous transaction, execute a read operation on the first variable in the first transaction; Alternatively, the execution unit is configured to, for a second transaction in the multiple transactions whose submission order is before the first transaction, wait relative to the first transaction in a case where it is determined based on the write field that the write operation on the first variable in the second transaction has been executed, so as to execute the read operation on the first variable in the first transaction after submitting the second transaction.

15. The device according to claim 14, wherein: The variable access table also includes a read field corresponding to the first variable, and the read field is used to record the execution of the read operation on the first variable in the multiple transactions. The device also includes a modification unit configured to modify the read field accordingly after executing the read operation on the first variable in the first transaction.

16. The device according to claim 15, wherein: The plurality of transactions also include a second transaction, wherein the submission order of the second transaction is ranked first among the plurality of transactions, and the second transaction includes a write operation on the first variable. When the second transaction is submitted after the read field is modified accordingly, the apparatus further includes: a second determining unit configured to determine, based on the read field, whether a read operation on the first variable in the first transaction has been performed; and The notification unit is configured to, when it is determined that the read operation on the first variable in the first transaction has been executed, notify the local to re-execute the read operation on the first variable in the first transaction.

17. The device according to claim 16, wherein: The multiple transactions also include a third transaction, wherein the submission order of the third transaction is between the first transaction and the second transaction, and the device further includes: a third determining unit configured to, after receiving a notification from a local device to re-execute the read operation on the first variable in the first transaction, determine whether the write operation on the first variable in the third transaction has been executed based on the write field; The waiting unit is configured to wait, if it is determined that the write operation in the third transaction has been executed, so as to re-execute the read operation on the first variable in the first transaction after the write operation on the first variable in the third transaction is committed.

18. The device according to claim 16, wherein: A predetermined number of bits included in the write field correspond to a predetermined number of transactions respectively, and the device also includes a first restoration unit configured to, after submitting the second transaction, restore a first value of the bit in the write field corresponding to the second transaction, wherein the first value is used to record that a write operation on the first variable in the second transaction has been executed.

19. The device according to claim 18, wherein: A transaction execution window is preset in the first node, and the multiple transactions are multiple transactions currently included in the transaction execution window, wherein the number of the multiple transactions is less than or equal to the predetermined number, and the device also includes a window moving unit configured to, after submitting the second transaction, move the transaction execution window backward by one transaction among the multiple transactions arranged in a predetermined submission order included in the first node.

20. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 13.

21. A computing device comprising a memory and a processor, characterized in that: The memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 13 is implemented.

Citation Information

Patent Citations

  • Transaction parallel execution method, device, electronic device and system

    CN109508337A