Transaction Processing Method and Apparatus
First Claim
1. A transaction processing method implemented by a network device, wherein a transaction comprises a series of operations on a tree data structure, wherein the tree data structure comprises a base tree, and wherein the transaction processing method comprises:
- obtaining M transactions from a transaction queue, wherein the M transactions are transactions that perform an update on a same base tree, wherein a first transaction and a second transaction are any two transactions in the M transactions that do not conflict wherein a conflict occurs when a common subtree of the first transaction is either a father or a child of a common subtree of the second transaction, wherein a common part of subtrees formed by operations performed on the base tree in any transaction constitutes a common subtree of the transaction, and wherein M is an integer greater than or equal to two;
performing reverse shallow copying in parallel for the M transactions to generate M temporary trees corresponding to the M transactions, wherein a temporary tree corresponding to each transaction comprises a tree that is formed after the transaction performs an update on the base tree;
merging M temporary trees; and
replacing the base tree with a merged temporary tree.
1 Assignment
0 Petitions
Accused Products
Abstract
A network device obtains, from a transaction queue, a plurality of transactions that do not conflict with each other, and performs reverse shallow copying in parallel for the transactions that do not conflict, to generate a plurality of temporary trees corresponding to the plurality of transactions. Because the plurality of transactions does not conflict with each other, processing the transactions in parallel can ensure accurate and proper transaction processing. In addition, generating the temporary trees in a reverse shallow copying manner can effectively reduce consumption of time and memory. Further, processing of the plurality of transactions is implemented by merging the plurality of temporary trees.
1 Citation
20 Claims
-
1. A transaction processing method implemented by a network device, wherein a transaction comprises a series of operations on a tree data structure, wherein the tree data structure comprises a base tree, and wherein the transaction processing method comprises:
-
obtaining M transactions from a transaction queue, wherein the M transactions are transactions that perform an update on a same base tree, wherein a first transaction and a second transaction are any two transactions in the M transactions that do not conflict wherein a conflict occurs when a common subtree of the first transaction is either a father or a child of a common subtree of the second transaction, wherein a common part of subtrees formed by operations performed on the base tree in any transaction constitutes a common subtree of the transaction, and wherein M is an integer greater than or equal to two; performing reverse shallow copying in parallel for the M transactions to generate M temporary trees corresponding to the M transactions, wherein a temporary tree corresponding to each transaction comprises a tree that is formed after the transaction performs an update on the base tree; merging M temporary trees; and replacing the base tree with a merged temporary tree. - View Dependent Claims (2, 3, 4, 5, 16, 17, 18)
-
-
6. A network device comprising;
-
a non transitory computer-readable memory comprising an instruction and a processor coupled to the non-transitory computer-readable memory and configured to execute the instruction to configure the network device to; obtain M transactions from a transaction queue, wherein the M transactions are transactions that perform an update on a same base tree, wherein a first transaction and a second transaction are any two transactions in the M transactions that do not conflict, wherein a conflict occurs when a common subtree of the first transaction is either a father or a child of a common subtree of the second transaction, wherein a common part of subtrees formed by operations performed on the base tree in any transaction constitutes a common subtree of the transaction, and wherein M is an integer greater than or equal to two; perform reverse shallow copying in parallel for the M transactions to generate M temporary trees corresponding to the M transactions, wherein a temporary tree corresponding to each transaction comprises a tree that is formed after the transaction performs an update on the base tree; merge the M temporary trees; and replace the base tree with a merged temporary tree. - View Dependent Claims (7, 8, 9, 10, 19)
-
-
11. A network device, comprising;
-
a memory configured to store a transaction queue; a scheduler configured to obtain M transactions from the transaction queue, wherein the M transactions are transactions that perform an update on a same base tree, wherein a first transaction and a second transaction are any two transactions in the M transactions that do not conflict, wherein a conflict occurs when common subtree of the first transaction is either a father or a child of a common subtree of the second transaction, wherein a common part of subtrees form formed by operations performed on the base tree in any transaction constitutes a common subtree of the transaction, and wherein M is an integer greater than or equal to two; and a processor that comprises at least M processor cores and that has a multi-task parallel processing capability, wherein the processor is configured to; perform reverse shallow copying in parallel for the M transactions to generate M temporary trees corresponding to the M transactions, wherein a temporary tree corresponding to each transaction comprises a tree that is formed after each transaction performs an update on the base tree; merge the M temporary trees; and
replace the base tree with a merged temporary tree. - View Dependent Claims (12, 13, 14, 15, 20)
-
Specification