CN111309258A - B + tree access method and device and computer readable storage medium - Google Patents

B + tree access method and device and computer readable storage medium Download PDF

Info

Publication number
CN111309258A
CN111309258A CN202010093601.7A CN202010093601A CN111309258A CN 111309258 A CN111309258 A CN 111309258A CN 202010093601 A CN202010093601 A CN 202010093601A CN 111309258 A CN111309258 A CN 111309258A
Authority
CN
China
Prior art keywords
data
tree
node
file
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010093601.7A
Other languages
Chinese (zh)
Inventor
来炜国
刘志勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Langchao Intelligent Technology Co Ltd
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Langchao Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Langchao Intelligent Technology Co Ltd filed Critical Suzhou Langchao Intelligent Technology Co Ltd
Priority to CN202010093601.7A priority Critical patent/CN111309258A/en
Publication of CN111309258A publication Critical patent/CN111309258A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from or digital output to record carriers, e.g. RAID, emulated record carriers, networked record carriers
    • G06F3/0601Dedicated interfaces to storage systems
    • G06F3/0602Dedicated interfaces to storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from or digital output to record carriers, e.g. RAID, emulated record carriers, networked record carriers
    • G06F3/0601Dedicated interfaces to storage systems
    • G06F3/0628Dedicated interfaces to storage systems making use of a particular technique
    • G06F3/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from or digital output to record carriers, e.g. RAID, emulated record carriers, networked record carriers
    • G06F3/0601Dedicated interfaces to storage systems
    • G06F3/0668Dedicated interfaces to storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Abstract

The embodiment of the invention discloses a method, a device and a medium for accessing a B + tree, which are used for judging whether an idle bottom tree file mapped to a DRAM memory exists or not when a B + tree creating instruction is obtained; and if so, storing the bottom layer data of the B + tree into a bottom layer tree file. If not, a target bottom tree file is newly built, and the target bottom tree file is mapped to a DRAM (dynamic random access memory) so as to store the bottom data of the B + tree into the target bottom tree file. And when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area. Based on the data structure of the B + tree, data reading at each time needs to be accessed from bottom layer data, and the access efficiency of the bottom layer data is effectively improved by storing the bottom layer file in the idle bottom layer tree file mapped to the DRAM memory. Other data are stored in storage space except the DRAM, so that the utilization rate of DRAM memory resources is improved.

Description

B + tree access method and device and computer readable storage medium
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a method and an apparatus for accessing a B + tree, and a computer-readable storage medium.
Background
In a full flash array memory system, due to the particularity of its structure, a B + tree structure is largely adopted. For example, the full flash memory array generally adopts a thin provisioning method (RAID), and the logical address of the volume and the physical address of the volume on the disk array (RAID) are not linear corresponding relationships any longer, but are changed into a relationship of approximately random mapping. To manage this mapping relationship, a B + tree is employed to maintain the mapping from volume logical addresses to physical addresses, and a B + tree is employed to maintain the inverse mapping of physical addresses to logical addresses. The deduplication functionality of a full flash array employs a B + tree to preserve the mapping of data block HASH values to physical addresses.
Dynamic Random Access Memory (DRAM) is a common type of system Memory. Since DRAM memory is a relatively expensive component, a relatively small amount of DRAM memory is typically provided in a memory system to reduce cost. In the prior art, data of a B + tree is usually stored in a Solid State Drive (SSD). Data in the SSD disk must be read into the memory for read-write access, and the IO path for SSD read-write is relatively long and slow. The frequent reading in and swapping out of the memory of the B + tree structure can bring about a large CPU overhead.
Therefore, how to improve the read-write efficiency of the B + tree is a problem that needs to be solved by those skilled in the art.
Disclosure of Invention
Embodiments of the present invention provide a method and an apparatus for accessing a B + tree, and a computer-readable storage medium, which can improve the read-write efficiency of the B + tree.
To solve the foregoing technical problem, an embodiment of the present invention provides a method for accessing a B + tree, including:
when a B + tree creating instruction is acquired, judging whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists or not;
if yes, storing the bottom layer data of the B + tree to the bottom layer tree file;
if not, a target bottom tree file is newly built, and the target bottom tree file is mapped to a DRAM (dynamic random access memory) so as to store the bottom data of the B + tree into the target bottom tree file;
and when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area.
Optionally, the B + tree corresponds to a first level, a second level, and a third level; wherein, the data of the first level is used as the bottom data;
correspondingly, when the number of layers of the B + tree is greater than or equal to a preset threshold, storing the data greater than or equal to the preset threshold in the B + tree into a preset storage area includes:
storing data of a second level of the B + tree into a DCPMM memory;
and storing the data of the third level of the B + tree into a preset hard disk.
Optionally, when the B + tree creation instruction is obtained, before determining whether there is an underlying tree file mapped to the memory, the method further includes:
and taking the minimum read-write granularity of the DCPMM memory as the node capacity of the B + tree.
Optionally, the storing the bottom-level data of the B + tree into the bottom-level tree file includes:
storing the bottom data of the B + tree into the bottom tree file according to the node capacity; and the offset address of the next-level node is stored in the key value pair of each node data.
Optionally, the method further comprises:
when a data query instruction is obtained, determining a root node according to a logic address carried in the data query instruction;
determining leaf nodes according to the offset addresses contained in the root nodes; and reading data corresponding to the leaf nodes.
Optionally, the method further comprises:
when a data modification instruction is acquired, judging whether node data matched with a node identifier carried in the data modification instruction exists in the DRAM;
if so, modifying the node data according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data;
if not, judging whether node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory;
when node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory, modifying the node data according to the data to be replaced carried in the data modification instruction;
when the DCPMM memory does not have node data matched with the node identifier carried in the data modification instruction, reading the node data matched with the node identifier carried in the data modification instruction in the hard disk into the DRAM memory; and finishing the modification of the node data in the DRAM according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data.
Optionally, after storing the bottom-level data of the B + tree into the bottom-level tree file, the method further includes:
and migrating the data which is mapped to the DRAM and provided with the dirty marks into the DCPMM memory according to a preset cycle time.
The embodiment of the invention also provides an access device of the B + tree, which comprises a first judging unit, a first storage unit, a creating unit and a second storage unit;
the first judging unit is used for judging whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists or not when a B + tree creating instruction is acquired; if yes, triggering the first storage unit; if not, triggering the creating unit;
the first storage unit is used for storing the bottom data of the B + tree to the bottom tree file;
the creating unit is used for newly creating a target bottom tree file and mapping the target bottom tree file to a DRAM (dynamic random access memory) so as to store bottom data of the B + tree into the target bottom tree file;
the second storage unit is configured to, when the number of layers of the B + tree is greater than or equal to a preset threshold, store data in the B + tree, where the number of layers is greater than or equal to the preset threshold, in a preset storage area.
Optionally, the B + tree corresponds to a first level, a second level, and a third level; wherein, the data of the first level is used as the bottom data;
correspondingly, the second storage unit is specifically configured to store the data of the second level of the B + tree into the DCPMM memory; and storing the data of the third level of the B + tree into a preset hard disk.
Optionally, as a unit;
the serving unit is configured to use the minimum read-write granularity of the DCPMM memory as the node capacity of the B + tree.
Optionally, the first storage unit is specifically configured to store the bottom-layer data of the B + tree into the bottom-layer tree file according to the node capacity; and the offset address of the next-level node is stored in the key value pair of each node data.
Optionally, the device further comprises a query unit, a determination unit and a reading unit;
the query unit is used for determining a root node according to a logic address carried in a data query instruction when the data query instruction is acquired;
the determining unit is configured to determine a leaf node according to an offset address included in the root node;
and the reading unit is used for reading the data corresponding to the leaf node.
Optionally, the device further comprises a second judging unit, a modifying unit, a setting unit, a third judging unit and a reading unit;
the second judging unit is configured to, when a data modification instruction is obtained, judge whether node data matching a node identifier carried in the data modification instruction exists in the DRAM memory; if yes, triggering the modification unit; if not, triggering the third judgment unit;
the modification unit is used for modifying the node data according to the data to be replaced carried in the data modification instruction,
the setting unit is used for setting a dirty mark for the modified node data;
the third judging unit judges whether node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory;
the modification unit is further configured to modify the node data according to the data to be replaced carried in the data modification instruction when the node data matching the node identifier carried in the data modification instruction exists in the DCPMM memory;
the reading unit is configured to read, when node data matching the node identifier carried in the data modification instruction does not exist in the DCPMM memory, the node data matching the node identifier carried in the data modification instruction in the hard disk into the DRAM memory;
the modification unit is further configured to complete modification of the node data in the DRAM memory according to the data to be replaced carried in the data modification instruction, and trigger the setting unit to set a dirty flag for the modified node data.
Optionally, a migration unit is further included;
the migration unit is configured to transfer the data mapped to the DRAM memory and provided with the dirty flag to the DCPMM memory according to a preset cycle time.
The embodiment of the present invention further provides an access device for a B + tree, including:
a memory for storing a computer program;
a processor for executing said computer program to implement the steps of the method for accessing a B + tree as defined in any of the above.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for accessing a B + tree are implemented as any one of the above.
According to the technical scheme, when the B + tree creating instruction is obtained, whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists is judged; when there is a free bottom tree file mapped to the DRAM memory, the bottom data of the B + tree can be directly stored to the bottom tree file. When there is no free bottom tree file mapped to the DRAM memory, a new target bottom tree file needs to be created, and the target bottom tree file is mapped to the DRAM memory, so as to store the bottom data of the B + tree in the target bottom tree file. And when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area. Based on the data structure of the B + tree, data reading at each time needs to be accessed from bottom layer data, so that the number of times of accessing the bottom layer data is large, and the bottom layer file is stored in an idle bottom layer tree file mapped to a DRAM memory, so that the access efficiency of the bottom layer data is effectively improved. And the number of times of accessing other data except the bottom data in the B + tree is relatively less, and in order to reduce the occupation of the DRAM memory, other data can be stored in a storage space except the DRAM memory, so that the utilization rate of DRAM memory resources is improved, and the read-write efficiency of the B + tree can be ensured.
Drawings
In order to illustrate the embodiments of the present invention more clearly, the drawings that are needed in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is a flowchart illustrating a method for accessing a B + tree according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for modifying data of a B + tree according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an access device of a B + tree according to an embodiment of the present invention;
fig. 4 is a schematic diagram of a hardware structure of a B + tree access device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without any creative work belong to the protection scope of the present invention.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments.
Next, a detailed description is given of the method for accessing a B + tree according to an embodiment of the present invention. Fig. 1 is a flowchart of a method for accessing a B + tree according to an embodiment of the present invention, where the method includes:
s101: and when a B + tree creating instruction is acquired, judging whether an idle bottom tree file mapped to the DRAM exists or not.
When there is a free bottom tree file mapped to the DRAM memory, it indicates that there is a file in the DRAM memory that can be used to store the B + tree, and then S102 may be performed.
When there is no free bottom tree file mapped to the DRAM memory, it indicates that there is no file for storing the B + tree in the current DRAM memory, and then S103 may be executed.
S102: and storing the bottom data of the B + tree to a bottom tree file.
S103: and newly building a target bottom tree file, and mapping the target bottom tree file to a DRAM (dynamic random access memory) so as to store the bottom data of the B + tree into the target bottom tree file.
Based on the data structure of the B + tree, data reading at each time needs to be accessed from bottom layer data, so that the bottom layer data are accessed frequently, and the bottom layer file is stored in an idle bottom layer tree file mapped to a DRAM memory, so that the access efficiency of the bottom layer data is effectively improved.
For convenience of distinction, in the embodiment of the present invention, the newly created target base tree file is referred to as a target base tree file, and for the storage system, the newly created target base tree file and the base tree file are both files for storing base data, and there is no substantial difference between the two files.
S104: and when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area.
The B + tree comprises a plurality of layers of data, in the embodiment of the invention, the data of the B + tree can be divided into different levels, and the frequency and the times of accessing the data of the different levels are different, so that the data of the different levels can be stored in different positions.
In a particular implementation, the B + tree may be divided into a first level, a second level, and a third level; wherein the data of the first hierarchy is used as the bottom data.
At the beginning of the creation of the B + tree, the frequency of accessing the underlying data is high, and therefore, in the embodiment of the present invention, the underlying data is stored in the free underlying tree file mapped to the DRAM memory.
Considering that a DCPMM (DC Persistent Memory Module) can directly access data in a Device DAX mode without depending on a DRAM Memory, the DCPMM Device in the Device DAX mode can be regarded as a DCPMM Memory. In the embodiment of the present invention, the data of the second level of the B + tree may be stored in the DCPMM memory.
In order to accurately control the use of the DCPMM and avoid the waste of DCPMM resources, the data of the third level of the B + tree may be stored in a predetermined hard disk.
In practical application, the first-level file to the third-level file of the B + tree may be used as a first hierarchy, the fourth-level file and the fifth-level file may be used as a second hierarchy, and data larger than the fifth-level file may be used as a third hierarchy.
According to the technical scheme, when the B + tree creating instruction is obtained, whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists is judged; when there is a free bottom tree file mapped to the DRAM memory, the bottom data of the B + tree can be directly stored to the bottom tree file. When there is no free bottom tree file mapped to the DRAM memory, a new target bottom tree file needs to be created, and the target bottom tree file is mapped to the DRAM memory, so as to store the bottom data of the B + tree in the target bottom tree file. And when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area. Based on the data structure of the B + tree, data reading at each time needs to be accessed from bottom layer data, so that the number of times of accessing the bottom layer data is large, and the bottom layer file is stored in an idle bottom layer tree file mapped to a DRAM memory, so that the access efficiency of the bottom layer data is effectively improved. And the number of times of accessing other data except the bottom data in the B + tree is relatively less, and in order to reduce the occupation of the DRAM memory, other data can be stored in a storage space except the DRAM memory, so that the utilization rate of DRAM memory resources is improved, and the read-write efficiency of the B + tree can be ensured.
In the initial stage of creating the B + tree, the number of times of accessing the bottom layer data is relatively frequent, so the bottom layer data can be stored in the DRAM memory, and as the storage time increases, the frequency of accessing the bottom layer data of the B + tree decreases, and in order to improve the utilization rate of the DRAM memory, in a specific implementation, a dirty flag may be set for the bottom layer data stored in the DRAM memory, so that the bottom layer data stored in the DRAM memory may be periodically migrated to the DCPMM memory.
In order to improve the data reading efficiency, in a specific implementation, the minimum read-write granularity of the DCPMM memory may be used as the node capacity of the B + tree. The internal minimum read-write granularity of the DCPMM memory is 256 bytes, so that the capacity of one B + tree node can be set to 256 bytes, i.e. a group of check protection data is generated every 256 bytes of data.
In the embodiment of the invention, the bottom data of the B + tree can be stored into the bottom tree file according to the node capacity; and the offset address of the next-level node is stored in the key value pair of each node data.
In practical applications, each node may contain a 16-byte node header and up to 15 key-value pairs. The node header contains information such as the node type. Wherein the node types include leaf nodes and non-leaf nodes. For a leaf node, the value in the key value pair is an RAID physical address, and specific data corresponding to the leaf node can be read according to the RAID physical address; for non-leaf nodes, the key value pair may store the offset address of the next level node.
When a data query instruction is obtained, a root node can be determined according to a logic address carried in the data query instruction; determining leaf nodes according to the offset addresses contained in the root nodes; and reads the data corresponding to the leaf node.
For example, when the data of the B + tree needs to be queried, the logical address of the data volume may be carried in the data query instruction. According to the logical address, metadata of the data volume can be found, if the memory address of the root node is protected in the metadata, the bottom layer tree file of the tree is in the memory, leaf nodes can be searched according to the offset address stored in the corresponding node in the bottom layer tree file, if the node which walks to the 3 rd layer is still not a leaf node, the offset address of the corresponding node in the 3 rd layer file is read from the metadata, and therefore the storage address of the 4 th layer file is obtained. If the node is still a non-leaf node, access continues to the level 5 node. If the 5-layer node is not the leaf node, reading the file of the third layer into the memory, continuing searching until the leaf node is reached, and reading the specific data corresponding to the leaf node according to the RAID physical address stored by the key value pair of the leaf node.
The data of the B + tree is stored in different positions according to the divided hierarchy, and when the data of the B + tree needs to be modified, the storage position where the data needed to be modified is located may be queried according to the storage position to modify the data in the B + tree, as shown in fig. 2, which is a flowchart of a data modification method of the B + tree provided by the embodiment of the present invention, includes:
s201: and when the data modification instruction is acquired, judging whether node data matched with the node identification carried in the data modification instruction exists in the DRAM.
When the node data matching the node identifier carried in the data modification instruction exists in the DRAM memory, S202 is executed.
When the node data matching the node identifier carried in the data modification instruction does not exist in the DRAM memory, the location of the node data to be modified needs to be further determined, and then S203 may be executed.
S202: and modifying the node data according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data.
The node data is stored in the DRAM, the DRAM resources are occupied, in order to improve the utilization rate of the DRAM resources, dirty marks can be set for the modified node data, and therefore the data mapped to the DRAM and provided with the dirty marks can be transferred to the DCPMM memory according to the preset cycle time.
S203: and judging whether node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory.
When the node data matched with the node identifier carried in the data modification instruction exists in the DCPMM memory, S204 is executed.
In the embodiment of the present invention, the data of the B + tree may be stored in the DRAM memory, the DCPMM memory, and the preset hard disk according to different levels, and when there is no node data in the DRAM memory that matches the node identifier carried in the data modification instruction, and there is no node data in the DCPMM memory that matches the node identifier carried in the data modification instruction, it indicates that the node data to be modified is stored in the preset hard disk, and at this time, S205 may be executed.
S204: and modifying the node data according to the data to be replaced carried in the data modification instruction.
S205: and reading the node data matched with the node identification carried in the data modification instruction in the hard disk into a DRAM memory.
Because the data in the hard disk cannot be directly modified, when the node data to be modified is stored in the preset hard disk, the node data in the hard disk, which is matched with the node identifier carried in the data modification instruction, needs to be read into the DRAM memory.
S206: and finishing the modification of the node data in the DRAM according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data.
When the node data to be modified is stored in the DRAM memory or the hard disk, the modified node data is stored in the DRAM memory, and because the DRAM memory resources are limited, in order to avoid that the modified node data occupies the DRAM memory resources for a long time, in the embodiment of the present invention, the modified node data stored in the DRAM memory may be provided with a dirty flag, so that the data mapped to the DRAM memory and provided with the dirty flag may be subsequently migrated to the DCPMM memory according to the preset cycle time.
By periodically migrating the data stored in the DRAM, the data of the B + tree is prevented from occupying the resources of the DRAM for a long time, and the processing performance of the storage system is effectively improved.
Fig. 3 is a schematic structural diagram of an access apparatus of a B + tree according to an embodiment of the present invention, including a first determining unit 31, a first storing unit 32, a creating unit 33, and a second storing unit 34;
a first determining unit 31, configured to determine whether there is an idle bottom tree file mapped to a DRAM memory when a B + tree creation instruction is obtained; if yes, the first storage unit 32 is triggered; if not, the creating unit 33 is triggered;
a first storage unit 32, configured to store bottom-level data of the B + tree into a bottom-level tree file;
the creating unit 33 is configured to create a target bottom tree file and map the target bottom tree file to a DRAM memory, so as to store bottom data of the B + tree in the target bottom tree file;
the second storage unit 34 is configured to, when the number of layers of the B + tree is greater than or equal to a preset threshold, store data in the B + tree, where the number of layers is greater than or equal to the preset threshold, in a preset storage area.
Optionally, the B + tree corresponds to a first level, a second level, and a third level; wherein, the data of the first level is used as the bottom data;
correspondingly, the second storage unit is specifically configured to store the data of the second level of the B + tree into the DCPMM memory; and storing the data of the third level of the B + tree into a preset hard disk.
Optionally, as a unit;
and the unit is used for taking the minimum read-write granularity of the DCPMM memory as the node capacity of the B + tree.
Optionally, the first storage unit is specifically configured to store the bottom-level data of the B + tree into the bottom-level tree file according to the node capacity; and the offset address of the next-level node is stored in the key value pair of each node data.
Optionally, the device further comprises a query unit, a determination unit and a reading unit;
the query unit is used for determining a root node according to a logic address carried in the data query instruction when the data query instruction is acquired;
a determining unit, configured to determine a leaf node according to an offset address included in the root node;
and the reading unit is used for reading the data corresponding to the leaf node.
Optionally, the device further comprises a second judging unit, a modifying unit, a setting unit, a third judging unit and a reading unit;
the second judging unit is used for judging whether node data matched with the node identification carried in the data modification instruction exists in the DRAM when the data modification instruction is obtained; if yes, triggering a modification unit; if not, triggering a third judgment unit;
a modification unit for modifying the node data according to the data to be replaced carried in the data modification instruction,
a setting unit, configured to set a dirty flag for the modified node data;
a third judging unit judges whether node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory;
the modification unit is also used for modifying the node data according to the data to be replaced carried in the data modification instruction when the node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory;
the reading unit is used for reading the node data matched with the node identifier carried in the data modification instruction in the hard disk into the DRAM when the node data matched with the node identifier carried in the data modification instruction does not exist in the DCPMM memory;
the modification unit is also used for finishing the modification of the node data in the DRAM according to the data to be replaced carried in the data modification instruction, and triggering the setting unit to set a dirty mark for the modified node data.
Optionally, a migration unit is further included;
and the migration unit is used for transferring the data which is mapped to the DRAM and provided with the dirty mark into the DCPMM memory according to the preset cycle time.
For the description of the features in the embodiment corresponding to fig. 3, reference may be made to the related description of the embodiments corresponding to fig. 1 and fig. 2, which is not repeated here.
According to the technical scheme, when the B + tree creating instruction is obtained, whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists is judged; when there is a free bottom tree file mapped to the DRAM memory, the bottom data of the B + tree can be directly stored to the bottom tree file. When there is no free bottom tree file mapped to the DRAM memory, a new target bottom tree file needs to be created, and the target bottom tree file is mapped to the DRAM memory, so as to store the bottom data of the B + tree in the target bottom tree file. And when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area. Based on the data structure of the B + tree, data reading at each time needs to be accessed from bottom layer data, so that the number of times of accessing the bottom layer data is large, and the bottom layer file is stored in an idle bottom layer tree file mapped to a DRAM memory, so that the access efficiency of the bottom layer data is effectively improved. And the number of times of accessing other data except the bottom data in the B + tree is relatively less, and in order to reduce the occupation of the DRAM memory, other data can be stored in a storage space except the DRAM memory, so that the utilization rate of DRAM memory resources is improved, and the read-write efficiency of the B + tree can be ensured.
Fig. 4 is a schematic diagram of a hardware structure of an access device 40 of a B + tree according to an embodiment of the present invention, including:
a memory 41 for storing a computer program;
a processor 42 for executing said computer program for implementing the steps of the method for accessing a B + tree as described in any of the embodiments above.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for accessing a B + tree according to any of the above embodiments are implemented.
The method, the apparatus and the computer-readable storage medium for accessing a B + tree according to the embodiments of the present invention are described in detail above. The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

Claims (10)

1. A method for accessing a B + tree, comprising:
when a B + tree creating instruction is acquired, judging whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists or not;
if yes, storing the bottom layer data of the B + tree to the bottom layer tree file;
if not, a target bottom tree file is newly built, and the target bottom tree file is mapped to a DRAM (dynamic random access memory) so as to store the bottom data of the B + tree into the target bottom tree file;
and when the layer number of the B + tree is greater than or equal to a preset threshold value, storing the data of which the layer number is greater than or equal to the preset threshold value in the B + tree into a preset storage area.
2. The method of claim 1, wherein the B + tree corresponds to a first level, a second level, and a third level; wherein, the data of the first level is used as the bottom data;
correspondingly, when the number of layers of the B + tree is greater than or equal to a preset threshold, storing the data greater than or equal to the preset threshold in the B + tree into a preset storage area includes:
storing data of a second level of the B + tree into a DCPMM memory;
and storing the data of the third level of the B + tree into a preset hard disk.
3. The method according to claim 2, wherein when the B + tree creation instruction is obtained, before determining whether there is an underlying tree file mapped to the memory, further comprising:
and taking the minimum read-write granularity of the DCPMM memory as the node capacity of the B + tree.
4. The method of claim 3, wherein storing the underlying data of the B + tree to the underlying tree file comprises:
storing the bottom data of the B + tree into the bottom tree file according to the node capacity; and the offset address of the next-level node is stored in the key value pair of each node data.
5. The method of claim 4, further comprising:
when a data query instruction is obtained, determining a root node according to a logic address carried in the data query instruction;
determining leaf nodes according to the offset addresses contained in the root nodes; and reading data corresponding to the leaf nodes.
6. The method of claim 2, further comprising:
when a data modification instruction is acquired, judging whether node data matched with a node identifier carried in the data modification instruction exists in the DRAM;
if so, modifying the node data according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data;
if not, judging whether node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory;
when node data matched with the node identification carried in the data modification instruction exists in the DCPMM memory, modifying the node data according to the data to be replaced carried in the data modification instruction;
when the DCPMM memory does not have node data matched with the node identifier carried in the data modification instruction, reading the node data matched with the node identifier carried in the data modification instruction in the hard disk into the DRAM memory; and finishing the modification of the node data in the DRAM according to the data to be replaced carried in the data modification instruction, and setting a dirty mark for the modified node data.
7. The method of claim 6, further comprising, after said storing the underlying data of the B + tree to the underlying tree file:
and migrating the data which is mapped to the DRAM and provided with the dirty marks into the DCPMM memory according to a preset cycle time.
8. The access device of the B + tree is characterized by comprising a first judging unit, a first storage unit, a creating unit and a second storage unit;
the first judging unit is used for judging whether an idle bottom tree file mapped to a DRAM (dynamic random access memory) exists or not when a B + tree creating instruction is acquired; if yes, triggering the first storage unit; if not, triggering the creating unit;
the first storage unit is used for storing the bottom data of the B + tree to the bottom tree file;
the creating unit is used for newly creating a target bottom tree file and mapping the target bottom tree file to a DRAM (dynamic random access memory) so as to store bottom data of the B + tree into the target bottom tree file;
the second storage unit is configured to, when the number of layers of the B + tree is greater than or equal to a preset threshold, store data in the B + tree, where the number of layers is greater than or equal to the preset threshold, in a preset storage area.
9. An apparatus for accessing a B + tree, comprising:
a memory for storing a computer program;
a processor for executing said computer program for implementing the steps of the method for accessing a B + tree according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, carries out the steps of the method for accessing a B + tree according to any one of claims 1 to 7.
CN202010093601.7A 2020-02-14 2020-02-14 B + tree access method and device and computer readable storage medium Pending CN111309258A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010093601.7A CN111309258A (en) 2020-02-14 2020-02-14 B + tree access method and device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010093601.7A CN111309258A (en) 2020-02-14 2020-02-14 B + tree access method and device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN111309258A true CN111309258A (en) 2020-06-19

Family

ID=71158329

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010093601.7A Pending CN111309258A (en) 2020-02-14 2020-02-14 B + tree access method and device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111309258A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105930280A (en) * 2016-05-27 2016-09-07 诸葛晴凤 Efficient page organization and management method facing NVM (Non-Volatile Memory)
US20170046352A1 (en) * 2013-03-06 2017-02-16 Quantum Corporation Heuristic journal reservations
CN107852378A (en) * 2016-01-27 2018-03-27 甲骨文国际公司 System and method for supporting the telescopic P_Key tables based on bitmap in high-performance computing environment
CN109284299A (en) * 2015-06-08 2019-01-29 南京航空航天大学 Reconstruct the method with the hybrid index of storage perception
CN109407978A (en) * 2018-09-27 2019-03-01 清华大学 The design and implementation methods of high concurrent index B+ linked list data structure
CN110597805A (en) * 2019-07-24 2019-12-20 浙江大学 Efficient novel memory index structure processing method
CN110688345A (en) * 2019-09-26 2020-01-14 重庆大学 Multi-granularity structured space management mechanism of memory file system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170046352A1 (en) * 2013-03-06 2017-02-16 Quantum Corporation Heuristic journal reservations
CN109284299A (en) * 2015-06-08 2019-01-29 南京航空航天大学 Reconstruct the method with the hybrid index of storage perception
CN109376156A (en) * 2015-06-08 2019-02-22 南京航空航天大学 Read the method with the hybrid index of storage perception
CN107852378A (en) * 2016-01-27 2018-03-27 甲骨文国际公司 System and method for supporting the telescopic P_Key tables based on bitmap in high-performance computing environment
CN105930280A (en) * 2016-05-27 2016-09-07 诸葛晴凤 Efficient page organization and management method facing NVM (Non-Volatile Memory)
CN109407978A (en) * 2018-09-27 2019-03-01 清华大学 The design and implementation methods of high concurrent index B+ linked list data structure
CN110597805A (en) * 2019-07-24 2019-12-20 浙江大学 Efficient novel memory index structure processing method
CN110688345A (en) * 2019-09-26 2020-01-14 重庆大学 Multi-granularity structured space management mechanism of memory file system

Similar Documents

Publication Publication Date Title
US10657101B2 (en) Techniques for implementing hybrid flash/HDD-based virtual disk files
US10013317B1 (en) Restoring a volume in a storage system
US9965483B2 (en) File system
US20180143780A1 (en) Storage system performing data deduplication, method of operating storage system, and method of operating data processing system
US10671290B2 (en) Control of storage of data in a hybrid storage system
US9684462B2 (en) Method and apparatus utilizing non-uniform hash functions for placing records in non-uniform access memory
US9575976B2 (en) Methods and apparatuses to optimize updates in a file system based on birth time
US9355028B2 (en) Data-storage device and flash memory control method
US9449005B2 (en) Metadata storage system and management method for cluster file system
US10152501B2 (en) Rollover strategies in a n-bit dictionary compressed column store
KR101966693B1 (en) Lba bitmap usage
US9851917B2 (en) Method for de-duplicating data and apparatus therefor
JP2017027387A (en) Memory system
RU2666241C2 (en) Memory segment remapping to address fragmentation
US10176113B2 (en) Scalable indexing
KR101397353B1 (en) Memory system including key-value store
US8751763B1 (en) Low-overhead deduplication within a block-based data storage
US7890550B2 (en) Flash memory system and garbage collection method thereof
US7664927B2 (en) Hash tables
US9471500B2 (en) Bucketized multi-index low-memory data structures
JP5943095B2 (en) Data migration for composite non-volatile storage
US9626224B2 (en) Optimizing available computing resources within a virtual environment
US8407265B1 (en) Hierarchical mapping of free blocks of cylinder groups of file systems built on slices of storage and linking of the free blocks
Debnath et al. BloomFlash: Bloom filter on flash-based storage
US8812816B2 (en) Garbage collection schemes for index block

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