CN113094375A - Multi-B + tree operation device and method thereof - Google Patents
Multi-B + tree operation device and method thereof Download PDFInfo
- Publication number
- CN113094375A CN113094375A CN202110551387.XA CN202110551387A CN113094375A CN 113094375 A CN113094375 A CN 113094375A CN 202110551387 A CN202110551387 A CN 202110551387A CN 113094375 A CN113094375 A CN 113094375A
- Authority
- CN
- China
- Prior art keywords
- command
- tree
- node
- search
- present application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2453—Query optimisation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The present application relates to an information processing technology, and in particular, to a multi B + tree operation device and a method thereof, wherein the B + tree operation device includes: a command interface, a memory, and a plurality of search units; the memory stores a plurality of B + trees; the command interface adds the command to be processed to a command queue associated with a search unit corresponding to the B + tree to be accessed according to the B + tree to be accessed by the command to be processed; the plurality of search units search the plurality of B + trees stored in the memory in parallel according to the keywords indicated by the commands to be processed in the command queue associated with each search unit, and provide the search results to the command interface. The method and the device realize the B + tree operation by using the hardware circuit, and realize the operation of efficiently processing each B + tree by using a plurality of B + trees to respectively store indexes.
Description
Technical Field
The present application relates to information processing technology, and in particular, to providing a multi B + tree operating device using integrated circuit hardware and a method of operating a plurality of B + trees using the same.
Background
The B + tree is a data structure, and is often used to store indexes in file systems, databases, and the like. Fig. 1 shows a B + tree. The B + tree includes a root node, a plurality of intermediate nodes, and a plurality of leaf nodes. Node 120 is the root node. Nodes 130, 132, and 134 are intermediate nodes, which are nodes that are neither root nor leaf nodes. The nodes (140, 142, 144 … … 150, 152, 154) are leaf nodes.
The middle node of the B + tree includes no more than m elements, with m being referred to as the rank of the B + tree. Each element of the root node and the intermediate node of the B + tree records a Key (Key) and a pointer to a subordinate node. For example, node 130 includes 3 elements, the first element having a key of 5 and a pointer to node 140, the second element having a key of 10 and a pointer to node 142, and the third element having a key of 20 and a pointer to node 144. The elements of the node are ordered by keyword.
In some embodiments, each element of the root and intermediate nodes records a pointer to a subordinate node, but not every element includes a key, but rather the root and intermediate nodes include one fewer key than the elements they include. For example, in node 120, the keyword "K: 5" may not be included, and in searching node 120, for a value less than the keyword "K: 28 "indicates the lower node 130 in the search result, and for a keyword no less than the keyword" K: 28 "and less than the keyword" K: 65 "indicates the lower node 134 in the search result.
The leaf nodes of the B + tree include no more than m elements. Each element of a leaf node records a Key (Key) and a Value (Value) corresponding to the Key. The elements of the leaf nodes are ordered by keyword. Thus, all keys of the B + tree have records in the leaf nodes, and the values corresponding to the keys can only be obtained from the leaf nodes.
In the prior art, software builds and operates a B + tree in a memory, and a binary method is used to search for a keyword in the B + tree, for example. The dichotomy is the search algorithm with almost the best performance available to software, but in the big data era, the number of data items increases, so that the performance of the search algorithm of the software operating the B + tree cannot meet the requirement.
Disclosure of Invention
Faster implementation of B + tree operations is required. Hardware circuitry is required to implement the B + tree operation. And in some information processing apparatuses, indexes are stored separately using a plurality of B + trees. For example, each B + tree stores an index of a respective file system. These file systems are accessed concurrently or independently. The B + tree manipulation device needs to be able to efficiently handle the manipulation of each B + tree.
According to a first aspect of the present application, there is provided a first B + tree operation method according to the first aspect of the present application, comprising the steps of: providing the command to be processed to a search unit corresponding to the B + tree according to the B + tree to be accessed by the command to be processed; and the searching unit searches the B + tree to be accessed according to the keywords indicated by the command to be processed and obtains a searching result.
According to the first B + tree operation method of the first aspect of the present application, there is provided the second B + tree operation method of the first aspect of the present application, wherein if the command to be processed is a search command, the search result provided by the search unit is a processing result of the command.
According to the first or second B + tree operation method of the first aspect of the present application, there is provided the third B + tree operation method of the first aspect of the present application, wherein if the command to be processed is an insert command or a delete command, the command to be processed is processed again according to the search result to obtain a processing result of the command.
According to the third B + tree operation method of the first aspect of the present application, there is provided the fourth B + tree operation method of the first aspect of the present application, wherein if the command to be processed is an insert command, a keyword or a keyword specified by the insert command is added to the node indicated by the search result together with the corresponding value, so as to process the command to be processed again.
According to the third or fourth B + tree operation method of the first aspect of the present application, there is provided the fifth B + tree operation method of the first aspect of the present application, wherein if the command to be processed is a delete command, the keyword or the keyword specified by the delete command and the corresponding value are deleted from the node indicated by the search result, so as to process the command to be processed again.
According to one of the first to fifth B + tree operation methods of the first aspect of the present application, there is provided the sixth B + tree operation method of the first aspect of the present application, wherein the command to be processed is added to a command queue associated with a search unit corresponding to the B + tree to supply the command to be processed to the search unit.
According to a sixth B + tree operation method of the first aspect of the present application, there is provided the seventh B + tree operation method of the first aspect of the present application, wherein if it is recognized that the command to be processed has the same identifier as that of the B + tree accessed by the command being processed by the search unit, the command to be processed is added to the command queue corresponding to the search unit.
According to a sixth or seventh B + tree operation method of the first aspect of the present application, there is provided the eighth B + tree operation method of the first aspect of the present application, wherein if it is recognized that the command to be processed has an identifier different from an identifier of a B + tree accessed by a command being processed by the search unit, the search unit is assigned to the command to be processed, and the command to be processed is added to a command queue corresponding to the search unit assigned thereto.
According to an eighth B + tree operation method of the first aspect of the present application, there is provided the ninth B + tree operation method of the first aspect of the present application, wherein an idle search unit that is not currently processing a command is allocated to the command to be processed.
According to the eighth or ninth B + tree operation method of the first aspect of the present application, there is provided the tenth B + tree operation method of the first aspect of the present application, wherein if there is no idle search unit currently, after the search unit finishes processing the command and becomes idle, an idle search unit is allocated to the command to be processed.
According to one of the eighth to tenth B + tree operation methods of the first aspect of the present application, there is provided the eleventh B + tree operation method of the first aspect of the present application, wherein a search unit with a low workload or an available search unit is assigned to the command to be processed.
According to the eleventh B + tree operation method of the first aspect of the present application, there is provided the twelfth B + tree operation method of the first aspect of the present application, wherein the load of the search unit is obtained according to the number of commands to be processed included in the command queue corresponding to the search unit.
According to one of the first to twelfth B + tree operating methods of the first aspect of the present application, there is provided the thirteenth B + tree operating method of the first aspect of the present application, wherein the searching unit searches the B + tree stored in the memory or one or more nodes of the B + tree stored in the data cache according to a key indicated by the command to be processed.
According to a thirteenth B + tree operation method of the first aspect of the present application, there is provided the fourteenth B + tree operation method of the first aspect of the present application, wherein if the node of the B + tree to be accessed by the search unit is not included in the data cache, the node of the B + tree to be accessed is loaded from the memory to the data cache by using the DMA unit.
According to the second B + tree operation method of the first aspect of the present application, there is provided the fifteenth B + tree operation method of the first aspect of the present application, wherein if the command to be processed is a search command, one or more keywords of a current node of the B + tree to be accessed are read and compared with the keywords indicated by the search command to access the B + tree to be accessed, so as to obtain a search result.
According to a fifteenth B + tree operation method of the first aspect of the present application, there is provided the sixteenth B + tree operation method of the first aspect of the present application, wherein the number of keywords of the current node of the B + tree to be accessed is obtained, the storage location of each keyword of the current node is determined according to the number of keywords of the current node, and one or more keywords of the current node are read according to the storage location of each keyword.
According to a fifteenth or sixteenth B + tree operation method of the first aspect of the present application, there is provided the seventeenth B + tree operation method of the first aspect of the present application, wherein the search command hits an ith key of the current node if the key indicated by the search command is ordered between the ith key and the (i + 1) th key of the current node.
According to one of the fifteenth to seventeenth B + tree operation methods of the first aspect of the present application, there is provided the eighteenth B + tree operation method of the first aspect of the present application, wherein if the current node is a non-leaf node, a next-level node indicated by an index corresponding to a keyword hit by the comparison is a current node of a next search.
According to one of the fifteenth to eighteenth B + tree operation methods of the first aspect of the present application, there is provided the nineteenth B + tree operation method of the first aspect of the present application, wherein if the current node is a leaf node, a search result is generated according to a hit keyword.
According to one of the third to nineteenth B + tree operation methods of the first aspect of the present application, there is provided the twentieth B + tree operation method of the first aspect of the present application, wherein if the command to be processed is an insert command, the search result indicates a node into which the keyword is to be inserted.
According to a twenty-first B + tree operation method of the first aspect of the present application, there is provided the twenty-first B + tree operation method of the first aspect of the present application, wherein, in response to searching for a current node into which a keyword is to be inserted: determining whether node splitting occurs after the current node is inserted into the keyword according to the number of the keywords of the current node; and if the current node is not subjected to node splitting, inserting the key words to be inserted into the current node.
According to a twenty-first B + tree operation method of the first aspect of the present application, there is provided the twenty-second B + tree operation method of the first aspect of the present application, wherein if the number of keywords of the current node is less than a threshold, the current node is not subjected to node splitting.
According to a twenty-first or twenty-second B + tree operation method of the first aspect of the present application, there is provided the twenty-third B + tree operation method of the first aspect of the present application, wherein, in response to insertion of a key to be inserted into the current node, all keys of the current node ordered after the key to be inserted are moved from the memory to the data cache.
According to a twenty-third B + tree operation method of the first aspect of the present application, there is provided the twenty-fourth B + tree operation method of the first aspect of the present application, wherein the key moved out of the memory is placed sequentially after the key to be inserted in the data cache.
According to a twenty-fourth B + tree operation method of the first aspect of the present application, there is provided the twenty-fifth B + tree operation method of the first aspect of the present application, wherein the current node in the memory is updated with all keys in the data cache having the order of the key to be inserted and the current node after the key to be inserted.
According to a twenty-fifth B + tree operation method of the first aspect of the present application, there is provided the twenty-sixth B + tree operation method of the first aspect of the present application, wherein all keys of the current node in the memory, which are ordered after the key to be inserted, are covered with all keys of the current node in the data cache, which are ordered after the key to be inserted, to update the current node in the memory.
According to one of the twenty-first to twenty-sixth B + tree operation methods of the first aspect of the present application, there is provided the twenty-seventh B + tree operation method of the first aspect of the present application, wherein if a node split occurs in a current node and a keyword to be inserted is to be inserted into a preceding node after the split, the keyword to be inserted is written into the data cache, and all keywords read out from the memory and having a ranking of the current node after the keyword to be inserted are written into the data cache; and writing the key words belonging to the split front node in the data cache into the memory to update the current node as the split front node, and writing the key words belonging to the split rear node in the data cache into the memory as the split rear node.
According to one of the twenty-first to twenty-seventh B + tree operation methods of the first aspect of the present application, there is provided the twenty-eighth B + tree operation method of the first aspect of the present application, wherein if a node split occurs in a current node and a key to be inserted is to be inserted into a post-split node, the key to be inserted is written into the data cache, and all keys belonging to the post-split node read from the memory are written into the data cache; and writing all the read keywords and the keywords to be inserted into the memory after sequencing into the memory as the split rear nodes, and clearing the read keywords in the current nodes to obtain the split front nodes.
According to a twenty-eighth B + tree operation method of the first aspect of the present application, there is provided the twenty-ninth B + tree operation method of the first aspect of the present application, wherein all keywords, which are read out and belong to a keyword belonging to a back node and are ranked first to a keyword to be inserted in a current node, are written in a data cache in front of the keyword to be inserted in order; and sequentially writing the read keywords belonging to the rear node from the keywords after the keywords are to be inserted to the last keywords belonging to the split rear node after the keywords are to be inserted into the data cache.
According to one of the twentieth to twenty-ninth B + tree operation methods of the first aspect of the present application, there is provided the thirty-ninth B + tree operation method of the first aspect of the present application, wherein in response to a node split occurring at the current node, a common parent node of the front node and the rear node after the split is updated.
According to a thirty-first B + tree operation method of the first aspect of the present application, there is provided a thirty-first B + tree operation method of the first aspect of the present application, wherein keys and corresponding indexes of front and rear nodes of the index are recorded in a parent node to update a common parent node of the front and rear nodes after splitting.
According to one of the twenty-first to thirty-first B + tree operation methods of the first aspect of the present application, there is provided the thirty-second B + tree operation method of the first aspect of the present application, wherein in inserting the key into the B + tree, a value of a leaf node associated with the key or a pointer to a lower node is also inserted.
According to one of the twenty-seventh to thirty-first B + tree operation methods of the first aspect of the present application, there is provided the thirty-third B + tree operation method of the first aspect of the present application, wherein if the number of keywords of the current node is greater than or equal to a threshold, the current node is subjected to node splitting.
According to one of the twenty-seventh to thirty-first B + tree operation methods of the first aspect of the present application, there is provided the thirty-fourth B + tree operation method of the first aspect of the present application, wherein the insertion of the key to be inserted into the front node or the rear node after the node splitting is determined according to the ranking positions of the key to be inserted in all keys before the key of the current node is split.
According to a third B + tree operation method of the first aspect of the present application, there is provided the thirty-fifth B + tree operation method of the first aspect of the present application, wherein if the command to be processed is a delete command, the search result indicates a node from which the keyword is to be deleted.
According to a thirty-fifth B + tree operation method of the first aspect of the present application, there is provided the thirty-sixth B + tree operation method of the first aspect of the present application, wherein, in response to searching for a current node of a keyword to be deleted, if the keyword to be deleted is a top-ranked keyword in the current node, a keyword of a parent node of the current node indexed by the current node is modified.
According to a thirty-sixth B + tree operation method of the first aspect of the present application, there is provided the thirty-seventh B + tree operation method of the first aspect of the present application, wherein a key of a current node indexed in a parent node is modified to a next key ordered after a key to be deleted in a key of the current node.
According to a thirty-sixth or thirty-seventh B + tree operation method of the first aspect of the present application, there is provided the thirty-eighth B + tree operation method of the first aspect of the present application, wherein, if the key to be deleted is not the top-ranked key in the current node, all keys subsequent to the key to be deleted of the current node are moved from the memory to the data cache, and the current node in the memory is updated with all keys subsequent to the key to be deleted in the data cache.
According to a thirty-eighth B + tree operation method of the first aspect of the present application, there is provided the thirty-ninth B + tree operation method of the first aspect of the present application, wherein all keys of the current node in the memory, starting from the node to be deleted to the last, are replaced with all keys following the key to be deleted in the data cache to update the current node in the memory.
According to a thirty-eighth or thirty-ninth B + tree operation method of the first aspect of the present application, there is provided the forty-eighth B + tree operation method of the first aspect of the present application, wherein if the updated number of keys of the current node is less than the threshold, node merging is performed.
According to a forty-first B + tree operation method of the first aspect of the present application, there is provided the forty-first B + tree operation method of the first aspect of the present application, wherein a current node is merged with a sibling node of the current node, and a key in a parent node of the current node, in which a plurality of nodes participating in the merging are indexed, is modified.
According to a second aspect of the present application, there is provided a first B + tree operating apparatus according to the second aspect of the present application, comprising: a command interface, a memory, and one or more search units; the command interface provides the command to be processed to a search unit corresponding to the B + tree according to the B + tree to be accessed by the command to be processed; the search unit searches the B + tree to be accessed stored in the memory according to the key word indicated by the command to be processed, and provides the search result to the command interface.
According to the first B + tree operating device of the second aspect of the present application, there is provided the second B + tree operating device of the second aspect of the present application, further comprising: and the searching unit searches the nodes stored in the data cache according to the key words indicated by the command to be processed so as to access the B + tree.
The first or second B + tree manipulation device according to the second aspect of the present application provides the third B + tree manipulation device according to the second aspect of the present application, further comprising: and the DMA unit loads the node of the B + tree to be accessed from the memory into the data cache if the node of the B + tree to be accessed by the searching unit is not included in the data cache.
According to one of the first to third B + tree operation apparatuses of the second aspect of the present application, there is provided the fourth B + tree operation apparatus of the second aspect of the present application, wherein the search unit reads one or more keywords of a current node of the B + tree to be accessed, and compares with the keyword indicated by the search command to access the B + tree to be accessed, to obtain the search result.
According to a fourth B + tree operation apparatus of the second aspect of the present application, there is provided the fifth B + tree operation apparatus of the second aspect of the present application, wherein the search unit acquires the number of keywords of the current node of the B + tree to be accessed, determines the storage positions of the respective keywords of the current node based on the number of keywords of the current node, and reads one or more keywords of the current node based on the storage positions of the respective keywords.
According to a fourth or fifth B + tree operation apparatus of the second aspect of the present application, there is provided the sixth B + tree operation apparatus of the second aspect of the present application, wherein the search command hits the ith key of the current node if the key indicated by the search command is ordered between the ith key and the (i + 1) th key of the current node.
According to one of the fourth to sixth B + tree operation apparatuses of the second aspect of the present application, there is provided the seventh B + tree operation apparatus of the second aspect of the present application, wherein if the current node is a non-leaf node, the search unit takes a next-level node indicated by an index corresponding to the hit keyword as a current node of a next round of search.
According to one of the fourth to seventh B + tree operation devices of the second aspect of the present application, there is provided the eighth B + tree operation device of the second aspect of the present application, wherein the search unit generates a search result from the hit keyword if the current node is a leaf node.
According to one of the first to eighth B + tree manipulation devices of the second aspect of the present application, there is provided a ninth B + tree manipulation device according to the second aspect of the present application, wherein the command interface includes: and the command queues corresponding to the search units one by one, and the to-be-processed commands are added to the command queues associated with the search units corresponding to the B + tree to be accessed so as to provide the to-be-processed commands to the search units.
According to a ninth B + tree manipulation apparatus of the second aspect of the present application, there is provided the tenth B + tree manipulation apparatus of the second aspect of the present application, wherein the command interface includes: and storing a command receiving buffer of the received commands to be processed, wherein the commands to be processed in the command receiving buffer are added to the command queue.
According to a tenth B + tree operation apparatus of the second aspect of the present application, there is provided the eleventh B + tree operation apparatus of the second aspect of the present application, wherein in response to the command reception buffer being added with a command or the periodic check command reception buffer being added with a command, a command to be processed is fetched from the command reception buffer to be added to the command queue.
According to one of the ninth to eleventh B + tree operation apparatuses of the second aspect of the present application, there is provided the twelfth B + tree operation apparatus of the second aspect of the present application, wherein the search unit has an identification derived from a B + tree accessed by a command it is processing, and if the to-be-processed command has the same identification as the search unit, the to-be-processed command is added to a command queue corresponding to the search unit.
According to one of the ninth to twelfth B + tree operation devices of the second aspect of the present application, there is provided the thirteenth B + tree operation device of the second aspect of the present application, wherein the command queue has an identification of the B + tree accessed from the command it contains, and if the to-be-processed command has the same identification as the identification of the command queue, the to-be-processed command is added to the command queue.
According to a twelfth or thirteenth B + tree operation device of the second aspect of the present application, there is provided the fourteenth B + tree operation device of the second aspect of the present application, wherein, if a to-be-processed command has an identification different from an identification of a search unit or an identification of a command queue, the search unit is allocated to the to-be-processed command, and the to-be-processed command is added to the command queue corresponding to the search unit allocated thereto.
According to a fourteenth B + tree operation device of the second aspect of the present application, there is provided the fifteenth B + tree operation device of the second aspect of the present application, wherein a free search unit of a currently unprocessed command is allocated to a command to be processed.
According to a fifteenth B + tree operation device of the second aspect of the present application, there is provided the sixteenth B + tree operation device of the second aspect of the present application, wherein if there is no idle search unit currently, after the search unit finishes processing the command and becomes idle, an idle search unit is allocated to the command to be processed.
According to a fourteenth B + tree operation device of the second aspect of the present application, there is provided the seventeenth B + tree operation device of the second aspect of the present application, wherein a search unit with a low workload or an available search unit is allocated for the command to be processed.
According to a seventeenth B + tree operation device of the second aspect of the present application, there is provided the eighteenth B + tree operation device of the second aspect of the present application, wherein the load of the search unit is determined in accordance with the number of commands to be processed included in the command queue corresponding to the search unit.
According to one of the first to eighteenth B + tree operating devices of the second aspect of the present application, there is provided a nineteenth B + tree operating device according to the second aspect of the present application, further comprising: and the extended command processing unit processes the command to be processed serving as the insertion command or the deletion command again according to the search result.
According to a nineteenth B + tree manipulation apparatus of the second aspect of the present application, there is provided the twentieth B + tree manipulation apparatus of the second aspect of the present application, wherein the command interface includes: and the extended command queue is used for storing the insertion command or the deletion command, and the extended command processing unit processes the insertion command or the deletion command again.
A twenty-first B + tree manipulation device according to the second aspect of the present application is provided, wherein the command interface comprises: and the extended command processing unit processes the command to be processed again according to the search result and the insertion command or the deletion command.
According to one of the nineteenth to twenty-first B + tree operation apparatuses of the second aspect of the present application, there is provided the twenty-second B + tree operation apparatus according to the second aspect of the present application, wherein the extended command processing unit adds a key specified by the insert command or a key together with a corresponding value to a node indicated by the search result to perform the re-processing of the command to be processed.
According to one of the nineteenth to twenty-second B + tree operation apparatuses of the second aspect of the present application, there is provided the twenty-third B + tree operation apparatus of the second aspect of the present application, wherein if the command to be processed is an insert command, the search result indicates a node into which the key is to be inserted.
According to a twenty-third B + tree operation device of the second aspect of the present application, there is provided the twenty-fourth B + tree operation device of the second aspect of the present application, wherein the expansion command processing unit identifies the number of keywords of the current node, determines whether node splitting occurs after the current node is inserted into the keyword, and inserts the keyword to be inserted into the current node if node splitting does not occur in the current node.
According to a twenty-fourth B + tree operation device of the second aspect of the present application, there is provided the twenty-fifth B + tree operation device of the second aspect of the present application, wherein if the number of keywords of the current node is less than the threshold, the node splitting does not occur in the current node.
According to a twenty-sixth B + tree operation device of the second aspect of the present application, in response to insertion of a key to be inserted into the current node, the expanded command processing unit moves all keys of the current node, which are ordered after the key to be inserted, from the memory to the data cache.
According to a twenty-sixth B + tree operation device of the second aspect of the present application, there is provided the twenty-seventh B + tree operation device of the second aspect of the present application, wherein the expansion command processing unit places the key moved out from the memory in the data cache sequentially after the key to be inserted.
According to a twenty-seventh B + tree operation device of the second aspect of the present application, there is provided the twenty-eighth B + tree operation device of the second aspect of the present application, wherein the extended command processing unit updates the current node in the memory with all keys in the data cache, the keys to be inserted and the keys having the current node sorted after the keys to be inserted.
According to a twenty-eighth B + tree operation apparatus of the second aspect of the present application, there is provided the twenty-ninth B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit overwrites all keys of the current node in the memory, which are ordered after the key to be inserted, with all keys of the key to be inserted and the current node in the data cache, which are ordered after the key to be inserted, to update the current node in the memory.
According to one of the twenty-fourth to twenty-ninth B + tree operation devices of the second aspect of the present application, there is provided the thirty-B + tree operation device of the second aspect of the present application, wherein the extended command processing unit recognizes that node splitting occurs in a current node, and a key to be inserted is to be inserted into a preceding node after the splitting, writes the key to be inserted into the data cache, and writes all keys of the current node read out from the memory, which are ordered after the key to be inserted, into the data cache; and writing the key words belonging to the split front node in the data cache into the memory to update the current node as the split front node, and writing the key words belonging to the split rear node in the data cache into the memory as the split rear node.
According to one of the twenty-fourth to twenty-ninth B + tree operation devices of the second aspect of the present application, there is provided the thirty-first B + tree operation device of the second aspect of the present application, wherein the expansion command processing unit recognizes that node splitting occurs in a current node, and a key to be inserted is to be inserted into a post-node after the splitting, writes the key to be inserted into the data cache, and writes all keys belonging to the post-node read out from the memory into the data cache; and writing all the read keywords and the keywords to be inserted into the memory after sequencing into the memory as the split rear nodes, and clearing the read keywords in the current nodes as the split front nodes.
According to a thirty-first B + tree operation apparatus of the second aspect of the present application, there is provided a thirty-second B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit writes, in order, read out all the keys of the key belonging to the following node, which are sorted before the key to be inserted, to the current node before the key to be inserted; and sequentially writing the read keywords belonging to the rear node from the keywords after the keywords are to be inserted to the last keywords belonging to the split rear node after the keywords are to be inserted into the data cache.
According to one of the thirty-third to thirty-second B + tree operation apparatuses of the second aspect of the present application, there is provided the thirty-third B + tree operation apparatus of the second aspect of the present application, wherein, in response to node splitting occurring at the current node, the extended command processing unit updates a common parent node of the front node and the rear node after the splitting.
According to a thirty-third B + tree operation apparatus of the second aspect of the present application, there is provided a thirty-fourth B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit records keys and corresponding indexes of the front node and the rear node of the index in the parent node to update the common parent node of the front node and the rear node after the split.
According to one of the thirty-fourth to thirty-fourth B + tree operation apparatuses of the second aspect of the present application, there is provided a thirty-fifth B + tree operation apparatus according to the second aspect of the present application, wherein if the number of keywords of the current node is greater than or equal to a threshold value, the current node is subjected to node splitting.
According to one of the thirty-sixth to thirty-fourth B + tree operation devices of the second aspect of the present application, there is provided a thirty-sixth B + tree operation device according to the second aspect of the present application, wherein the extended command processing unit determines to insert the inserted keyword to the preceding node or the following node after the node splitting, according to the sorting positions of the keywords to be inserted in all the keywords before the keyword of the current node is split.
According to one of the nineteenth to thirty-sixth B + tree operation devices of the second aspect of the present application, there is provided a thirty-seventh B + tree operation device according to the second aspect of the present application, wherein the extended command processing unit deletes the keyword or the keyword specified by the delete command together with the corresponding value from the node indicated by the search result to perform the reprocessing of the command to be processed.
According to a thirty-seventh B + tree operation apparatus of the second aspect of the present application, there is provided a thirty-eighth B + tree operation apparatus of the second aspect of the present application, wherein if the command to be processed is a delete command, the search result indicates a node from which the keyword is to be deleted.
According to a thirty-eighth B + tree operation apparatus of the second aspect of the present application, there is provided a thirty-ninth B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit identifies that the key to be deleted is the top-ranked key in the current node, and modifies the key of the current node indexed by the parent node of the current node.
According to a thirty-ninth B + tree operation apparatus of the second aspect of the present application, there is provided the forty-ninth B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit modifies a key indexing a current node in a parent node to a next key ordered after a key to be deleted in a key of the current node.
According to a thirty-ninth or forty-first B + tree operation apparatus of the second aspect of the present application, there is provided the forty-first B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit identifies that the key to be deleted is not the top-ranked key in the current node, moves all keys subsequent to the key to be deleted of the current node from the memory to the data cache, and updates the current node in the memory with all keys subsequent to the key to be deleted in the data cache.
According to a forty-first B + tree operation apparatus of the second aspect of the present application, there is provided the forty-second B + tree operation apparatus of the second aspect of the present application, wherein the extended command processing unit replaces all keys of the current node in the memory, starting from the node to be deleted to the last, with all keys following the key to be deleted in the data cache, to update the current node in the memory.
According to a forty-first or forty-second B + tree operation device of the second aspect of the present application, there is provided a forty-third B + tree operation device of the second aspect of the present application, wherein the extended command processing unit performs node merging if the updated number of keywords of the current node is less than a threshold value.
According to a forty-third B + tree operation apparatus of the second aspect of the present application, there is provided the forty-fourth B + tree operation apparatus of the second aspect of the present application, wherein the expansion command processing unit merges the current node with a sibling of the current node, and modifies a key in which a plurality of nodes participating in the merging are indexed among parent nodes of the current node.
According to one of the first to forty-fourth B + tree manipulation devices of the second aspect of the present application, there is provided a forty-fifth B + tree manipulation device of the second aspect of the present application, wherein the command interface includes: and the command result cache stores the processing result of the command.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 illustrates a B + tree;
FIG. 2 illustrates a block diagram of a B + tree manipulation apparatus according to an embodiment of the present application;
FIG. 3A is a schematic diagram illustrating operation of a B + tree using a B + tree operation apparatus according to an embodiment of the present application;
FIG. 3B shows a flow chart for operating a B + tree using a B + tree operating device according to an embodiment of the present application;
FIG. 4 is a flowchart of a B + tree operation device operating a plurality of B + trees according to an embodiment of the present application;
FIG. 5A illustrates a block diagram of a B + tree manipulation device according to an embodiment of the present application;
FIG. 5B illustrates a block diagram of a B + tree manipulation device according to yet another embodiment of the present application;
FIG. 5C illustrates a flow diagram for processing a search command according to the embodiment of FIG. 5A or FIG. 5B;
FIG. 6A illustrates a block diagram of a B + tree manipulation device according to yet another embodiment of the present application;
FIG. 6B illustrates a flow diagram for processing an insert command according to the embodiment of FIG. 6A;
FIG. 7A illustrates a block diagram of a B + tree manipulation device according to yet another embodiment of the present application;
FIG. 7B illustrates a flow diagram for processing a delete command according to the embodiment of FIG. 7A.
Detailed Description
The technical solutions in the embodiments of the present application are clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 2 shows a block diagram of a B + tree manipulation apparatus according to an embodiment of the present application.
The B + tree manipulation device according to an embodiment of the present application includes a command interface 210, one or more search units (220 … … 22n), a data cache 230, a DMA unit 240, an extended command processing unit 270, a bus 280, and a memory 290. Memory 290 stores one or more B + trees (B + tree 0 … … B + tree n).
An external unit such as a CPU operates the B + tree operating means to accomplish acceleration of the B + tree operation. The CPU provides commands to operate the B + tree to the B + tree operating device through command interface 210. The command to operate the B + tree (hereinafter, simply referred to as a command) includes a command to search the B + tree for a specified Key (Key) (referred to as a search command), a command to insert the specified Key into the B + tree (referred to as an insert command), and/or a command to delete the specified Key from the B + tree (referred to as a delete command), and the like. The command also indicates, for example, one of the B + trees to be accessed, a pointer or value associated with a key, etc., where keys of root or intermediate node records of the B + tree are associated with the pointer and keys of leaf node records of the B + tree are associated with the value.
The command interface 210 receives a command provided from an external unit and provides the command to the search unit and/or the extended command processing unit. The result of the command processing by the search unit and/or the extended command processing unit is provided to the command interface 210, so that the external unit obtains the result of the command processing through the command interface 210.
A search unit (220 … … 22n) searches the B + tree based on the keyword obtained from the command. The search unit (220 … … 22n) accesses the memory 290 through the bus 280 to retrieve the key of the node of the B + tree recorded by the memory 290 to identify whether the key in the command hits the key of the node to process the search command.
The data cache 230 stores one or more keys for nodes of the B + tree, or also stores pointers/values corresponding to the keys. DMA unit 240 moves data between data cache 230 and memory 290, the moved data including keys and/or pointers/values corresponding to the keys of the nodes of the B + tree. The extended command processing unit 270 accesses the data cache 230. DMA unit 240 accesses memory 290 through bus 280. Alternatively, the extended command processing unit 270 accesses the memory 290 through the bus 280.
Fig. 3A shows a schematic diagram of operating a B + tree using a B + tree operating apparatus according to an embodiment of the present application.
The command interface unit 310 of the B + tree operation device includes, for example, a command receiving buffer 312, a command result buffer 314, command queues (360, 361 … …, 36n) corresponding to the search units one by one, an extended command queue 316, and a search result queue 318. The command receiving buffer 312 and/or the command result buffer 314 are provided in the form of queues, FIFOs (first-in-first-out buffers), shared memories, and the like. Optionally, the command queues (360, 361 … …, 36n), extended command queue 316, and search result queue 318 are provided in shared memory, FIFO, or the like.
The external unit populates the command reception cache 312 with commands to operate the B + tree to the B + tree operating device, and acquires the processing results of the commands from the command result cache 314. The commands in the command receiving cache 312, according to the B + tree they are to operate on, are added to the command queue associated with the search unit corresponding to the B + tree to provide the commands to the search unit.
After the search is complete (350), for the search command (352), the search unit presents the command processing results and adds to the command results cache 314. For an insert command or a delete command (352), after the search unit performs a search on the B + tree based on the keywords in the command, the search unit also adds the command to the extended command queue 316 and the results of the search on the B + tree to the search results queue 318. As can be appreciated, commands in the extended command queue 316 are associated with search results in the search results queue 318 such that the search results with which the commands are associated are simultaneously retrieved from each of the extended command queue 316 and the search results queue 318.
The extended command processing unit 340 retrieves commands and search results from the extended command queue 316 and search results queue 318 and further processes the commands, such as adding or removing keywords to or from the B + tree. After further processing of the command by the extended command processing unit 340 is completed (342), the result of the processing of the command is added to the command result cache 314, so that the external unit can obtain the result of the processing of the command from the command result cache 314.
Fig. 3B shows a flow chart for operating a B + tree using a B + tree operating device according to an embodiment of the present application.
In response to the command reception buffer 312 being added with a command or periodically checking that the command reception buffer 312 is added with a command, a command provided from the external unit to the B + tree processing apparatus is acquired from the command reception buffer 312 (370). The command is added to one of the command queues (360, 361 … … 36n) according to the B + tree to be accessed by the fetched command. Optionally, the retrieved command is provided to an available search unit (372), or a search unit with a low workload, without selecting the search unit depending on the B + tree to which the command is to access.
Commands in the command queue (360, 361 … … 36n) are provided to a search unit coupled thereto. The search unit searches the B + tree (374) according to the key word (and the B + tree) indicated by the command and obtains a search result. If the command is a search command (376), the results of the processing of the command (search results) are added to the command results cache 314 (384). If the command is not a search command (e.g., is an insert command or a delete command) (376), the results of the processing of the command (search results) are added to the search results queue 318(378) and the command is added to the extended command queue 316 (380).
The extended command processing unit 342 retrieves the command from the extended command queue 316 and further processes the command (382). For example, for an insert command, a key specified by the command (along with a corresponding value) is added to the node indicated by the search result, or for a delete command, a key specified by the command (along with a corresponding value) is deleted from the node indicated by the search result. After further processing of the command by the extended command processing unit 342 is completed, the command processing result is added to the command result (e.g., command processing success or failure) cache 314 (384).
Fig. 4 is a flowchart of a B + tree operating apparatus operating a plurality of B + trees according to an embodiment of the present application.
The external unit populates the command receiving cache 312 of the command interface 310 with commands to provide the B + tree operating device with commands to operate the B + tree (see also fig. 3A). In response to the command receiving cache 312 being non-empty (410), a command provided by the external unit to the B + tree processing device is retrieved from the command receiving cache 312 (420). The command is added to one of the command queues (360, 361 … … 36n) according to the B + tree to be accessed by the fetched command. By way of example, the command queue (360, 361 … … 36n) is set with an identification derived from the B + tree that the command it contains accesses; or the search unit corresponding to the command queue is set with an identification derived from the B + tree accessed by the command it is processing. From the identification of the B + tree accessed by the command retrieved from the command receiving cache 312, it is identified whether there is an identification of the B + tree accessed by the command being processed by the search unit that has the same identification as the pending command retrieved from the command receiving cache (430). If the identification of the command to be processed is the same as the identification of the B + tree accessed by the command being processed by one of the search units (denoted as search unit A), the command to be processed is sent to the command queue corresponding to the search unit A (460). If the identity of the command to be processed is not the same as the identity of the B + tree accessed by the command being processed by any of the search units, then a search unit is assigned to the command to be processed (440), and the command to be processed is provided to the command queue corresponding to the search unit assigned to the command queue (450). By way of example, at step 440, the free search unit for the currently unprocessed command is selected as the allocated search unit. And if no idle searching unit exists currently, selecting the idle searching unit as the distributed searching unit after the searching unit becomes idle after finishing processing the command. As yet another example, in step 440, a search unit with a low workload is selected as the assigned search unit, wherein the load of the search unit is derived according to the number of commands included in the command queue corresponding to the search unit.
FIG. 5A shows a block diagram of a B + tree operation apparatus according to an embodiment of the present application.
The B + tree manipulation device according to an embodiment of the present application includes a command interface 510, one or more search units (520 … … 52n), a data cache 530, a DMA unit 540, a bus 580, and a memory 590.
Memory 590 stores one or more B + trees (B + tree 0 … … B + tree n). And data cache 530 stores one or more nodes of the operated-on B + tree (node 0 … … node n).
An external unit such as a CPU operates the B + tree operating means to accomplish acceleration of the B + tree operation. The CPU provides commands to operate the B + tree to the B + tree operating device through command interface 210.
The command interface 210 receives a search command provided from an external unit and provides the search command to one of the search units (520 … … 52 n). The result of the search unit's processing of the command is provided to the command interface 510, so that the external unit obtains the result of the processing of the command through the command interface 510.
A search unit (520 … … 52n) searches the B + tree based on the keyword obtained from the command. The search unit (520 … … 52n) acquires each key of a node of the B + tree from the data cache 530, compares the search command with each key of the node to identify a hit key, and acquires a key of a next node from the data cache 530 according to the hit key or, when the current node is a leaf node, acquires a processing result of the search command according to the hit key.
If the node to be accessed by the search unit is not included in data cache 530, data cache 530 may load the node to be accessed from memory 590 into data cache 530 via bus 580 using DMA unit 540.
FIG. 5B shows a block diagram of a B + tree operation device according to yet another embodiment of the present application.
In contrast to the embodiment shown in FIG. 5A, the search unit (570 … … 57n) of the B + tree operator of the embodiment of FIG. 5B obtains the node of the B + tree to be accessed (node 0 … … node n) directly from memory 590 over bus 580, without using data cache 530.
FIG. 5C illustrates a flow diagram for processing a search command according to the embodiment of FIG. 5A or FIG. 5B.
In response to obtaining the search command, one of the search units (520 … … 52n) obtains a root node of the B + tree to be accessed as an initial current node in processing the search command according to the search command. The search unit acquires the number of keywords of the current node (560). The keys of the nodes are placed in order in the memory 590 or the data cache 530, such that the number of keys of the node is used to determine the storage locations of the keys of the node, and one or more keys of the current node are read (562). The search unit compares the key indicated by the search command with the key of the node to obtain a hit key (564). For example, if the keyword indicated by the search command is ordered between the ith keyword and the (i + 1) th keyword of the current node, the search command hits the ith keyword of the current node.
The search unit identifies whether the current node is a leaf node (566). If the current node is a leaf node (566), a search result is generated based on the key of the hit current node and the search result is saved in a result queue of the command interface (569). If the current node is not a leaf node (566), the next node is obtained according to the key of the hit current node and is taken as the current node (568), and the process is returned to the step 560 to continue the process for the new current node.
FIG. 6A shows a block diagram of a B + tree operation device according to yet another embodiment of the present application.
The B + tree operation device according to the embodiment of the present application includes a command interface 610, one or more search units (620 … … 62n), a data cache 630, a DMA unit 640, an extended command processing unit 670, a bus 680, and a memory 690.
Memory 690 stores one or more B + trees (B + tree 0 … … B + tree n). For example, node 692 is the root node of the B + tree, and nodes (693, 694, and 695) are children of node 692.
The search unit (620 … … 62n) processes the search command. The extended command processing unit 670 processes an insert command and/or a delete command.
The extended command processing unit 670 obtains, for example, an insert command from the command interface 610 (see also FIG. 3, e.g., through the extended command queue 316). Based on the obtained insert command, the extended command processing unit 670 maintains one or more keys of the updated node in the data cache 630 and instructs the DMA unit 640 to move the one or more keys in the data cache 630 to the memory 690 to update the node in the memory 690 and/or to move the one or more keys of the node from the memory 690 to the data cache 630 via the DMA unit 640. The extended command processing unit 670 provides the command processing result to the command interface 610 in response to the insertion command being processed, so that the external unit obtains the processing result of the command through the command interface 610.
FIG. 6B illustrates a flow diagram for processing an insert command according to the embodiment of FIG. 6A.
Referring also to fig. 3A and 3B, the insert command is processed in two phases. A first stage of searching the insertion command by a search unit (620 … … 62n) to find a leaf node into which the keyword is to be inserted; in the second stage, a key is inserted into a leaf node by the extended command processing unit 670, and one or more upper nodes are updated in response to a possible node split.
Referring to FIG. 6B, the flow shown begins with obtaining the current node indicated in the search results of the search unit (650), it being understood that the insert operation of the B + tree by the extended command processing unit 670 begins with the leaf node being hit.
The extended command processing unit 670 obtains the number of keys of the current node (652) to determine whether node splitting is to occur after the current node is inserted with a new key (654). In the B + tree insertion operation, if the number of keys of a node is greater than a threshold, the node needs to be split into two nodes.
If the number of keys of the current node is identified to be not greater than the threshold (654) (i.e., no node splitting is caused after a new key is inserted into the current node), the key to be inserted indicated by the insert command is written into the data cache 630 (656). The extended command processing unit 670 also identifies all keys of the current node that are ordered after the key to be inserted (657) and instructs the DMA unit 640 to move those keys from the memory 690 to the data cache 630 (658). Optionally, the key moved from memory 690 is placed in order in data cache 630 after the key to be inserted. The extended command processing unit 670 updates 659 the current node in the memory 690 with all keys in the data cache 630 having a key to be inserted and a key of the current node ordered after the key to be inserted. Specifically, all the keys of the current node in the memory 690 ordered after the key to be inserted are overwritten with the key to be inserted in the data cache 630 and all the keys of the current node ordered after the key to be inserted to complete the processing of the insert command.
Returning to step 654, if the number of keys of the current node is identified to be greater than the threshold, it means that the current node needs to be split into two nodes after the key is inserted. Generally, when a node is split, the first half of the keys in the sequence belong to the front node, and the second half of the keys in the sequence belong to the rear node. The two nodes formed by splitting the current node are referred to as a front node and a back node respectively.
And determining whether the key to be inserted belongs to a front node or a rear node after the current node is split according to the position of the key to be inserted in the key of the current node (655). If the key to be inserted belongs to the front node (655), the key to be inserted is written into the data cache 630 (660). The extended command processing unit 670 also identifies all keys (661) of the current node ordered after the key to be inserted, reads out all keys of the current node ordered after the key to be inserted from the memory 690 and writes them into the data cache 630(662), writes the key of the previous node after the split in the data cache into the memory 690 to update the current node (663) as the previous node after the split, and writes the key of the next node after the split in the data cache 630 into the memory 690(664) as the next node after the split.
And as the splitting of the node occurs, the common parent node of the front node and the rear node after the splitting needs to be updated so as to record the keywords and the corresponding indexes (pointers) for indexing the front node and the rear node in the parent node. For this purpose, the extended command processing unit 670 takes the parent node as the current node (669), takes, for example, the top-ranked key of the following node as the key to be inserted, and returns to step 652.
Returning to step 655, if the key to be inserted belongs to the back node (655), the key to be inserted is written into the data cache 630 (665). Extended command processing unit 670 also identifies all keys belonging to the back node for the current node (666), writes all keys belonging to the back node to data cache 630(667), and clears the read keys in the current node to generate a split front node.
As an example, the extended command processing unit 670 sorts the read-out keys belonging to the back node together with the key to be inserted, and writes all the sorted keys into the memory 690 to generate the back node (668).
As still another example, the extended command processing unit 670 sequentially writes all the keys to be inserted, which are read out and have the top of the ranking of the keys belonging to the following node to the current node, before the key to be inserted, which is written in the data cache 630, and sequentially writes the keys to be inserted, which are read out and have the top of the ranking of the keys belonging to the following node, to the last of the ranking of the keys belonging to the following node, which is written in the data cache 630, after the key to be inserted. In this way, the read-out keywords belonging to the rear nodes and the keywords to be inserted are sequenced together.
And since the splitting of the node has occurred, the extended command processing unit 670 takes the common parent node of the front node and the rear node after the splitting as the current node (669), takes, for example, the top-ranked key of the rear node as the key to be inserted, and returns to step 652.
Those skilled in the art will appreciate that in inserting a key into the B + tree, the value of the leaf node associated with the key or a pointer to a lower level node is also inserted.
Fig. 7A shows a block diagram of a B + tree operation apparatus according to still another embodiment of the present application.
The B + tree operation device according to the embodiment of the present application includes a command interface 710, one or more search units (720 … … 72n), a data cache 730, a DMA unit 740, an extended command processing unit 770, a bus 780, and a memory 790.
Memory 790 stores one or more B + trees (B + tree 0 … … B + tree n). For example, node 792 is the root node of the B + tree and nodes (794, 796, and 798) are children of node 792.
The search unit (720 … … 72n) processes the search command. The extended command processing unit 770 processes a delete command and/or an insert command.
Extended command processing unit 770 obtains, for example, a delete command from command interface 710 (see also FIG. 3, e.g., through extended command queue 316). Based on the obtained delete command, extended command processing unit 770 maintains one or more keys for the updated node in data cache 730 and instructs DMA unit 740 to move the one or more keys in data cache 730 to memory 790 to update the node in memory 790 and/or to move the one or more keys for the node from memory 790 to data cache 730 via DMA unit 740. The extended command processing unit 770 provides the command processing result to the command interface 710 in response to the deletion command being processed, so that the external unit obtains the processing result of the deletion command through the command interface 710.
FIG. 7B illustrates a flow diagram for processing a delete command according to the embodiment of FIG. 7A.
Referring also to fig. 3A and 3B, the delete command is processed in two stages. A first stage of performing a search by a search unit (720 … … 72n) according to a delete command to find a leaf node that hits a key to be deleted; in the second stage, the key is deleted from the hit leaf node and one or more upper nodes are possibly updated by the extended command processing unit 770.
Referring to FIG. 7B, the flow shown begins with obtaining the current node and the key to be deleted indicated in the search results for the search unit (750). It is to be understood that the delete operation of the extended command processing unit 770 on the B + tree starts with the hit leaf node.
The extended command processing unit 770 identifies whether the keyword to be deleted is the top-ranked keyword in the current node (752). If the key to be deleted is the top-ranked key of the current node, deletion of the key causes an update to the parent node of the current node (the node immediately above the current node), modifying the key of the parent node that indexes the current node, so that the key of the parent node is updated to the next key of the current node key that is ranked after the key to be deleted (758). And also identifies whether the updated key in the parent node is the top-ranked key (759). If the updated key in the parent node is also the top-ranked key of the parent node, go back to the step 758 to update the key in the previous node of the parent node that indexes the parent node.
If the key to be deleted is identified as not the top-ranked key in the current node in step 752 or the updated key in the parent node is identified as not the top-ranked key of the parent node in step 759, go to step 760. Extended command processing unit 770 identifies all keys following the key to be deleted for the current node (760), moves all identified keys from memory 790 to data cache 730(762) via DMA unit 740, and updates the current node in memory 790 with all keys following the key to be deleted in data cache 730 (764) to complete the deletion of the key to be deleted. For example, all keys of the current node in memory 790 beginning with the node to be deleted and ending with the last are replaced with all keys following the key to be deleted in data cache 730.
Alternatively, deletion of a key to a B + tree node may cause a merge of nodes. For example, after step 764, if the updated number of keys for the current node is less than the threshold, a merge of the nodes will result. For example, the current node is merged with the siblings of the current node, and the key of the parent node of the current node, which indexes the nodes participating in the merging, is modified to index the merged node.
Those skilled in the art will appreciate that in deleting a key from the B + tree, the value of a pointer to a lower level node or leaf node associated with the key is also deleted.
While the preferred embodiments of the present application have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all alterations and modifications as fall within the scope of the application. It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.
Claims (10)
1. A B + tree manipulation apparatus, comprising: a command interface, a memory, and a plurality of search units; the memory stores a plurality of B + trees; the command interface adds the command to be processed to a command queue associated with a search unit corresponding to the B + tree to be accessed according to the B + tree to be accessed by the command to be processed;
the plurality of search units search the plurality of B + trees stored in the memory in parallel according to the keywords indicated by the commands to be processed in the command queue associated with each search unit, and provide the search results to the command interface.
2. The B + tree manipulation apparatus of claim 1, wherein the search unit has an identification derived from a B + tree accessed by a command it is processing, and if the pending command has an identification identical to the identification of the search unit, the pending command is added to a command queue corresponding to the search unit.
3. The B + tree manipulation device of claim 2, wherein the command queue has an identification of the B + tree accessed from the command it contains, and wherein the pending command is added to the command queue if the pending command has an identification that is the same as the identification of the command queue.
4. The B + tree operation device of any one of claims 1-3, wherein if the pending command has an identifier different from the identifier of the search unit or the identifier of the command queue, the search unit is allocated to the pending command, and the pending command is added to the command queue corresponding to the search unit allocated thereto.
5. The B + tree operation device of claim 4, allocating a free search unit of a currently unprocessed command to a command to be processed; or allocating search units with low workload or available search units for the commands to be processed.
6. The B + tree operating apparatus according to claim 4 or 5, wherein if there is no idle search unit currently, the idle search unit is allocated to the command to be processed after the search unit becomes idle after the command is processed.
7. The B + tree manipulation apparatus of any one of claims 4 to 6, wherein the load of the search unit is determined according to the number of commands to be processed included in the command queue corresponding to the search unit.
8. The B + tree manipulation device of any one of claims 1-7, further comprising: and the searching unit searches the nodes stored in the data cache according to the key words indicated by the command to be processed so as to access the B + tree.
9. The B + tree manipulation device of claim 8, further comprising: and the DMA unit loads the node of the B + tree to be accessed from the memory into the data cache if the node of the B + tree to be accessed by the searching unit is not included in the data cache.
10. The B + tree handling apparatus according to any of claims 1-9, wherein each search unit reads one or more keywords of a current node of the B + tree to be accessed and compares the one or more keywords with the keyword indicated by the search command to access the B + tree to be accessed, thereby obtaining the search result.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110551387.XA CN113094375A (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910198029.8A CN111581204B (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
CN202110551387.XA CN113094375A (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910198029.8A Division CN111581204B (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113094375A true CN113094375A (en) | 2021-07-09 |
Family
ID=72125995
Family Applications (2)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110551387.XA Pending CN113094375A (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
CN201910198029.8A Active CN111581204B (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
Family Applications After (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910198029.8A Active CN111581204B (en) | 2019-03-15 | 2019-03-15 | Multi-B + tree operation device and method thereof |
Country Status (1)
Country | Link |
---|---|
CN (2) | CN113094375A (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2751667A4 (en) * | 2011-08-29 | 2015-07-15 | Intel Corp | Parallel operation on b+ trees |
CN102402602A (en) * | 2011-11-18 | 2012-04-04 | 航天科工深圳(集团)有限公司 | B+ tree indexing method and device of real-time database |
CN104408128B (en) * | 2014-11-26 | 2017-11-03 | 上海爱数信息技术股份有限公司 | A kind of reading optimization method indexed based on B+ trees asynchronous refresh |
US10719494B2 (en) * | 2015-08-06 | 2020-07-21 | International Business Machines Corporation | Accelerating operations in B+-tree |
CN106708665A (en) * | 2016-12-20 | 2017-05-24 | 华为技术有限公司 | Metadata restoration method and device |
-
2019
- 2019-03-15 CN CN202110551387.XA patent/CN113094375A/en active Pending
- 2019-03-15 CN CN201910198029.8A patent/CN111581204B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111581204A (en) | 2020-08-25 |
CN111581204B (en) | 2021-06-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
TWI719281B (en) | A system, machine readable medium, and machine-implemented method for stream selection | |
US10642515B2 (en) | Data storage method, electronic device, and computer non-volatile storage medium | |
TWI702506B (en) | System, machine readable medium, and machine-implemenated method for merge tree garbage metrics | |
CN108228799B (en) | Object index information storage method and device | |
CN109101603B (en) | Data comparison method, device, equipment and storage medium | |
US20140324875A1 (en) | Index for fast batch updates of large data tables | |
US8515976B2 (en) | Bit string data sorting apparatus, sorting method, and program | |
US9213759B2 (en) | System, apparatus, and method for executing a query including boolean and conditional expressions | |
CN115840731A (en) | File processing method, computing device and computer storage medium | |
CN111046106A (en) | Cache data synchronization method, device, equipment and medium | |
CN111581440B (en) | Hardware acceleration B + tree operation device and method thereof | |
US7197498B2 (en) | Apparatus, system and method for updating a sorted list | |
CN111581204B (en) | Multi-B + tree operation device and method thereof | |
CN112817530A (en) | Method for safely and efficiently reading and writing ordered data in multithreading manner | |
US8285691B2 (en) | Binary method for locating data rows in a compressed data block | |
US7441093B2 (en) | Segmentation management using a rolling window technique | |
US7302377B1 (en) | Accelerated event queue for logic simulation | |
US8341153B2 (en) | Apparatus and method for heap sorting with collapsed values and selective value expansion | |
CN111581206B (en) | B + tree operation device and method | |
CN111465929A (en) | Method and system for content-agnostic file indexing | |
CN112328630A (en) | Data query method, device, equipment and storage medium | |
US10997144B2 (en) | Reducing write amplification in buffer trees | |
CN108984780B (en) | Method and device for managing disk data based on data structure supporting repeated key value tree | |
CN111581205B (en) | B + tree operation device with node index and method thereof | |
CN111723266A (en) | Mass data processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |