[go: up one dir, main page]

CN117573676A - Address processing method and device based on storage system, storage system and medium - Google Patents

Address processing method and device based on storage system, storage system and medium Download PDF

Info

Publication number
CN117573676A
CN117573676A CN202311611112.6A CN202311611112A CN117573676A CN 117573676 A CN117573676 A CN 117573676A CN 202311611112 A CN202311611112 A CN 202311611112A CN 117573676 A CN117573676 A CN 117573676A
Authority
CN
China
Prior art keywords
key
tree
value pair
address
logical
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
CN202311611112.6A
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.)
Zhengzhou Yunhai Information Technology Co Ltd
Original Assignee
Zhengzhou Yunhai Information 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 Zhengzhou Yunhai Information Technology Co Ltd filed Critical Zhengzhou Yunhai Information Technology Co Ltd
Priority to CN202311611112.6A priority Critical patent/CN117573676A/en
Publication of CN117573676A publication Critical patent/CN117573676A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/10Address translation

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides an address processing method and device based on a storage system, the storage system and a medium, and relates to the field of storage, wherein the method comprises the following steps: acquiring all logical addresses contained in a logical address space in a storage system; generating a B+ tree by using all the logical addresses; all leaf nodes of the B+ tree sequentially store key value pairs corresponding to all logical addresses according to the logical addresses, each leaf node stores the same number of key value pairs, and the key value pairs take the logical addresses as keys; when a key value pair update request is received, replacing a new key value pair containing a mapping relation between a logical address and a physical address with a key value pair with the same key in the B+ tree; the B+ tree can be generated based on all the logical addresses, so that the key value pairs for storing the mapping relation between each logical address and the physical address can be stored in the B+ tree according to the logical address sequence, and the complexity of managing the address mapping relation by using the tree structure can be reduced by replacing the key value pairs when updating the mapping relation.

Description

基于存储系统的地址处理方法、装置、存储系统及介质Storage system-based address processing method, device, storage system and medium

技术领域Technical field

本发明涉及存储领域,特别涉及一种基于存储系统的地址处理方法、装置、存储系统及介质。The present invention relates to the field of storage, and in particular to an address processing method, device, storage system and medium based on a storage system.

背景技术Background technique

存储系统中通常存在逻辑地址和物理地址,其中逻辑地址为数据在应用层或逻辑卷中的地址,而物理地址为数据经过逻辑层后实际写入存储设备的地址,逻辑地址与物理地址间通常设置有映射关系。There are usually logical addresses and physical addresses in storage systems. The logical address is the address of the data in the application layer or logical volume, and the physical address is the address where the data is actually written to the storage device after passing through the logical layer. There is usually a relationship between the logical address and the physical address. There is a mapping relationship between settings.

相关技术中,通常可引入树结构管理逻辑地址与物理地址间的映射关系。然而,由于逻辑地址与物理地址间的映射关系总在发生动态变化,导致现有的树结构容易频繁发生结构变化,进而不仅增加了树结构的更新、查询复杂度,同时也为处理器带来了较多负担。In related technologies, a tree structure can usually be introduced to manage the mapping relationship between logical addresses and physical addresses. However, since the mapping relationship between logical addresses and physical addresses is always changing dynamically, the existing tree structure is prone to frequent structural changes, which not only increases the complexity of tree structure updates and queries, but also brings problems to the processor. more burden.

发明内容Contents of the invention

本发明的目的是提供基于存储系统的地址处理方法、装置、存储系统及介质,可降低利用树结构管理地址映射关系的复杂度。The purpose of the present invention is to provide an address processing method, device, storage system and medium based on a storage system, which can reduce the complexity of managing address mapping relationships using a tree structure.

为解决上述技术问题,本发明提供一种基于存储系统的地址处理方法,包括:In order to solve the above technical problems, the present invention provides an address processing method based on a storage system, including:

获取存储系统中的逻辑地址空间包含的所有逻辑地址;Obtain all logical addresses contained in the logical address space in the storage system;

利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;A B+ tree is generated using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number of key-value pairs, so The key-value pair uses the logical address as the key;

当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。When a key-value pair update request is received, a new key-value pair containing the mapping relationship between the logical address and the physical address is replaced with the key-value pair having the same key in the B+ tree.

可选地,所述利用所有所述逻辑地址生成B+树,包括:Optionally, using all the logical addresses to generate a B+ tree includes:

为各所述逻辑地址创建初始的键值对;所述初始的键值对以所述逻辑地址为键且以空值为值;Create an initial key-value pair for each logical address; the initial key-value pair uses the logical address as the key and a null value as the value;

利用所有所述逻辑地址的初始的键值对生成所述B+树。The B+ tree is generated using the initial key-value pairs of all logical addresses.

可选地,还包括:Optionally, also includes:

当接收到键值对删除请求时,将所述B+树中与所述键值对删除请求对应的待删除键值对的值清空。When a key-value pair deletion request is received, the value of the key-value pair to be deleted corresponding to the key-value pair deletion request in the B+ tree is cleared.

可选地,在获取存储系统中的逻辑地址空间包含的所有逻辑地址之前,还包括:Optionally, before obtaining all logical addresses contained in the logical address space in the storage system, it also includes:

对所述存储系统中的逻辑地址空间进行划分,并基于划分得到的各逻辑地址空间进入所述获取存储系统中的逻辑地址空间包含的所有逻辑地址的步骤。The logical address space in the storage system is divided, and based on each divided logical address space, the step of obtaining all logical addresses contained in the logical address space in the storage system is entered.

可选地,在利用所有所述逻辑地址生成B+树之后,还包括:Optionally, after using all the logical addresses to generate a B+ tree, it also includes:

将所述B+树从所述存储系统的存储设备加载至所述存储系统的内存设备中;Load the B+ tree from the storage device of the storage system into the memory device of the storage system;

依照各树节点在所述B+树中的位置对各所述树节点进行排序,并根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址;Sort each tree node according to its position in the B+ tree, and record the memory address corresponding to each tree node in sequence according to the arrangement order of each tree node;

所述将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换,包括:Replacing the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree includes:

根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址;Search the memory address of the leaf node to be updated to which the new key-value pair belongs according to the key of the new key-value pair, the logical address range recorded by each leaf node and the arrangement order of each leaf node;

根据所述待更新叶子节点的内存地址,在所述待更新叶子节点中将所述新键值对与具有相同键的键值对进行替换。According to the memory address of the leaf node to be updated, the new key-value pair is replaced with a key-value pair having the same key in the leaf node to be updated.

可选地,所述根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址,包括:Optionally, recording the memory addresses corresponding to each tree node in sequence according to the arrangement order of each tree node includes:

为所述B+树的各层生成对应的数组,并根据各所述树节点的排列顺序将各层的所述树节点对应的内存地址依次记录至各层对应的数组中;Generate corresponding arrays for each layer of the B+ tree, and record the memory addresses corresponding to the tree nodes of each layer into the arrays corresponding to each layer in turn according to the arrangement order of the tree nodes;

所述根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址,包括:Searching for the memory address of the leaf node to be updated to which the new key-value pair belongs based on the key of the new key-value pair, the logical address range recorded by each leaf node and the arrangement order of each leaf node includes: :

根据所述新键值对的键和各所述叶子节点所记录的逻辑地址范围,确定所述新键值对所属的待更新叶子节点在所述数组中的序号;Determine the sequence number of the leaf node to be updated to which the new key-value pair belongs in the array according to the key of the new key-value pair and the logical address range recorded by each leaf node;

根据所述序号从所述数组中获取所述待更新叶子节点的内存地址。Obtain the memory address of the leaf node to be updated from the array according to the sequence number.

可选地,还包括:Optionally, also includes:

当接收到键值对查询请求时,根据待查询键值对的逻辑地址和各所述叶子节点所记录的逻辑地址范围,确定所述待查询键值对所属的待查询叶子节点在所述数组中的序号;When a key-value pair query request is received, based on the logical address of the key-value pair to be queried and the logical address range recorded by each leaf node, it is determined that the leaf node to be queried to which the key-value pair to be queried belongs is in the array. the serial number in;

根据所述序号从所述数组中获取所述待查询叶子节点的内存地址,并根据所述内存地址在所述待查询叶子节点中获取所述待查询键值对。Obtain the memory address of the leaf node to be queried from the array according to the sequence number, and obtain the key-value pair to be queried in the leaf node to be queried according to the memory address.

本发明还提供一种基于存储系统的地址处理装置,包括:The present invention also provides an address processing device based on a storage system, including:

获取模块,用于获取存储系统中的逻辑地址空间包含的所有逻辑地址;The acquisition module is used to obtain all logical addresses contained in the logical address space in the storage system;

生成模块,用于利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;A generation module, configured to generate a B+ tree using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number of A key-value pair with the logical address as the key;

更新模块,用于当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。An update module, configured to, when receiving a key-value pair update request, replace the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree.

本发明还提供一种存储系统,包括:The invention also provides a storage system, including:

第一存储器,用于存储用户数据;The first memory is used to store user data;

第二存储器,用于存储计算机程序;a second memory for storing computer programs;

处理器,用于执行所述计算机程序时实现如上所述的基于存储系统的地址处理方法。A processor, configured to implement the above-mentioned storage system-based address processing method when executing the computer program.

本发明还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现如上所述的基于存储系统的地址处理方法。The present invention also provides a computer-readable storage medium. Computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are loaded and executed by a processor, the storage system-based storage system as described above is implemented. Address handling methods.

本发明提供一种地址处理方法,包括:获取存储系统中的逻辑地址空间包含的所有逻辑地址;利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。The present invention provides an address processing method, which includes: obtaining all logical addresses contained in the logical address space in the storage system; using all the logical addresses to generate a B+ tree; and storing all leaf nodes of the B+ tree in sequence according to the logical addresses. Key-value pairs corresponding to each logical address, each leaf node stores the same number of key-value pairs, and the key-value pairs use the logical address as a key; when a key-value pair update request is received, it will contain The new key-value pair of the mapping relationship between the logical address and the physical address is replaced with the key-value pair with the same key in the B+ tree.

可见,本发明首先可获取存储系统中的逻辑地址空间中的所有逻辑地址,并利用所有逻辑地址生成一棵B+树,其中B+树的所有叶子节点依照逻辑地址依次保存各逻辑地址对应的键值对,各叶子节点保存相同数量的键值对,键值对以逻辑地址为键。显然,本发明中的B+树能够覆盖逻辑地址空间中的所有逻辑地址,且各逻辑地址的键值对在B+树中规律地保存。这样,本发明在接收到键值对更新请求时,仅需根据新键值的键,将这一包含有逻辑地址与物理地址间映射关系的新键值对与B+树中具有相同键的键值对进行替换即可,不需要对B+树的结构进行变更,从而能够避免因逻辑地址与物理地址间映射关系的动态变化所导致的树结构变化频繁的问题,进而能够有效降低利用树结构管理逻辑地址与物理地址间映射关系的复杂度。本发明还提供一种基于存储系统的地址处理装置、存储系统及计算机可读存储介质,具有上述有益效果。It can be seen that the present invention can first obtain all logical addresses in the logical address space in the storage system, and use all logical addresses to generate a B+ tree, in which all leaf nodes of the B+ tree save the key values corresponding to each logical address in sequence according to the logical address. Yes, each leaf node stores the same number of key-value pairs, and the key-value pairs use logical addresses as keys. Obviously, the B+ tree in the present invention can cover all logical addresses in the logical address space, and the key-value pairs of each logical address are regularly saved in the B+ tree. In this way, when the present invention receives a key-value pair update request, it only needs to compare the new key-value pair containing the mapping relationship between the logical address and the physical address with the key with the same key in the B+ tree based on the key of the new key value. The value pairs can be replaced without changing the structure of the B+ tree. This can avoid the problem of frequent tree structure changes caused by dynamic changes in the mapping relationship between logical addresses and physical addresses, thereby effectively reducing the use of tree structure management. The complexity of the mapping relationship between logical addresses and physical addresses. The present invention also provides an address processing device, a storage system and a computer-readable storage medium based on a storage system, which have the above beneficial effects.

附图说明Description of the drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only These are embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without exerting creative efforts.

图1为本发明实施例所提供的一种基于存储系统的地址处理方法的流程图;Figure 1 is a flow chart of an address processing method based on a storage system provided by an embodiment of the present invention;

图2为本发明实施例所提供的一种B+树的结构示意图;Figure 2 is a schematic structural diagram of a B+ tree provided by an embodiment of the present invention;

图3为本发明实施例所提供的一种利用数组记录B+树的示意图;Figure 3 is a schematic diagram of using an array to record a B+ tree provided by an embodiment of the present invention;

图4为本发明实施例所提供的一种基于存储系统的地址处理装置的结构框图;Figure 4 is a structural block diagram of an address processing device based on a storage system provided by an embodiment of the present invention;

图5为本发明实施例所提供的一种存储系统的结构框图。Figure 5 is a structural block diagram of a storage system provided by an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments These are some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of protection of the present invention.

存储系统中通常存在逻辑地址和物理地址,其中逻辑地址为数据在应用层或逻辑卷中的地址,而物理地址为数据经过逻辑层后实际写入存储设备的地址,逻辑地址与物理地址间通常设置有映射关系。相关技术中,通常可引入树结构管理逻辑地址与物理地址间的映射关系。然而,由于逻辑地址与物理地址间的映射关系总在发生动态变化,导致现有的树结构容易频繁发生结构变化,进而不仅增大了树结构的更新、查询复杂度,同时也为处理器带来了较多负担。有鉴于此,本发明可提供一种基于存储系统的地址处理方法,可基于逻辑地址空间中的所有逻辑地址生成B+树,使得用于保存各逻辑地址与物理地址间映射关系的键值对可依照逻辑地址顺序保存于B+树,进而在更新上述映射关系时仅需替换键值对即可,无需对树进行结构调整,可降低利用树结构管理地址映射关系的复杂度。There are usually logical addresses and physical addresses in storage systems. The logical address is the address of the data in the application layer or logical volume, and the physical address is the address where the data is actually written to the storage device after passing through the logical layer. There is usually a relationship between the logical address and the physical address. There is a mapping relationship between settings. In related technologies, a tree structure can usually be introduced to manage the mapping relationship between logical addresses and physical addresses. However, since the mapping relationship between logical addresses and physical addresses is always changing dynamically, the existing tree structure is prone to frequent structural changes, which not only increases the complexity of updating and querying the tree structure, but also brings problems to the processor. Comes more burdens. In view of this, the present invention can provide an address processing method based on a storage system, which can generate a B+ tree based on all logical addresses in the logical address space, so that the key-value pairs used to save the mapping relationship between each logical address and the physical address can be It is stored in the B+ tree according to the logical address sequence, and then when updating the above mapping relationship, only the key-value pairs need to be replaced. There is no need to adjust the structure of the tree, which can reduce the complexity of using the tree structure to manage the address mapping relationship.

需要说明的是,本发明实施例并不限定具体的存储系统,可根据实际应用需求进行选择,例如可以为SAN(Storage Area Network,存储区域网络)存储系统。可以理解的是,存储系统中通常包含有多个存储设备,这些存储设备通常能够以阵列的形式对外提供存储服务。本发明实施例并不限定存储系统中存储设备的类型(如固态硬盘、机械硬盘)、数量及存储设备所形成阵列的形式(如RAID1、RAID5、RAID6,RAID,Redundant Arrays ofIndependent Disks,磁盘阵列),均可根据实际应用需求进行设置。It should be noted that the embodiment of the present invention is not limited to a specific storage system, which can be selected according to actual application requirements. For example, it can be a SAN (Storage Area Network, storage area network) storage system. It can be understood that a storage system usually contains multiple storage devices, and these storage devices can usually provide external storage services in the form of arrays. The embodiments of the present invention are not limited to the type (such as solid state drive, mechanical hard disk), quantity, and array form of the storage devices in the storage system (such as RAID1, RAID5, RAID6, RAID, Redundant Arrays of Independent Disks, disk array). , can be set according to actual application requirements.

请参考图1,图1为本发明实施例所提供的一种基于存储系统的地址处理方法的流程图,该方法可以包括:Please refer to Figure 1, which is a flow chart of a storage system-based address processing method provided by an embodiment of the present invention. The method may include:

S101、获取存储系统中的逻辑地址空间包含的所有逻辑地址。S101. Obtain all logical addresses contained in the logical address space in the storage system.

需要说明的是,在存储系统中逻辑地址(LBA,Logical Block Address,逻辑块地址)设置于逻辑地址空间,而物理地址(PBA,Physical Block Address,物理块地址)设置于物理地址空间,以上两种地址空间通过逻辑地址与物理地址间的映射关系进行对应。在实际存储过程中,对于用户而言,数据可存放于逻辑地址空间中,并可通过逻辑地址进行访问;而对于存储设备而言,数据经过逻辑层后将被存放于物理地址空间中,并通过物理地址进行访问。由于逻辑地址与物理地址间具有映射关系,因此在用户利用逻辑地址访问逻辑地址空间时,可进一步根据该映射关系确定对应的物理地址,并根据该物理地址在存储设备中获取对应的用户数据。显然,逻辑地址和物理地址间的映射关系属于支撑逻辑地址空间所需的元数据。通常情况下,可基于键值对形式(KV对,Key-Value)存放上述映射关系(逻辑地址为键,物理地址为值),并利用树结构保存键值对;此外,为了方便键值对的查找,在向树结构中插入键值对时,可根据键调整各键值对在树结构中的存储位置。然而,相关技术中仅在确定逻辑地址与物理地址之间设置有映射关系时,才将对应的键值对插入树结构中;且,由于该映射关系的变化较为频繁,这将导致树结构随时有可能需要调整各键值对在树结构中的存储位置,进而可能为树结构带来较大的结构调整,为元数据管理引入较多的查询、写入操作,不利于元数据的高效管理。因此,本发明首先可获取存储系统中的逻辑地址空间包含的所有逻辑地址,并将在使用逻辑地址空间之前,基于所有的逻辑地址生成树结构,以使该树结构依照逻辑地址依次保存各逻辑地址对应的键值对。这样不仅能确保该树结构可完整地覆盖逻辑地址空间中的所有逻辑地址,且可方便在树结构中查找各逻辑地址对应的键值对,后续在创建逻辑地址与物理地址间的映射关系时,仅需对本实施例所提供的树结构中的键值对进行更新替换即可,无需对树结构的树枝结构进行调整。It should be noted that in the storage system, the logical address (LBA, Logical Block Address, logical block address) is set in the logical address space, and the physical address (PBA, Physical Block Address, physical block address) is set in the physical address space. The above two The address spaces correspond to each other through the mapping relationship between logical addresses and physical addresses. In the actual storage process, for the user, the data can be stored in the logical address space and can be accessed through the logical address; while for the storage device, the data will be stored in the physical address space after passing through the logical layer, and Access via physical address. Since there is a mapping relationship between the logical address and the physical address, when the user uses the logical address to access the logical address space, the corresponding physical address can be further determined based on the mapping relationship, and the corresponding user data can be obtained from the storage device based on the physical address. Obviously, the mapping relationship between logical addresses and physical addresses belongs to the metadata required to support the logical address space. Normally, the above mapping relationship (logical address is the key, physical address is the value) can be stored based on the form of key-value pair (KV pair, Key-Value), and the tree structure is used to save the key-value pair; in addition, in order to facilitate the key-value pair Search, when inserting key-value pairs into the tree structure, the storage location of each key-value pair in the tree structure can be adjusted according to the key. However, in the related art, the corresponding key-value pair is inserted into the tree structure only when it is determined that there is a mapping relationship between the logical address and the physical address; and because the mapping relationship changes frequently, this will cause the tree structure to change at any time. It may be necessary to adjust the storage location of each key-value pair in the tree structure, which may bring about major structural adjustments to the tree structure and introduce more query and write operations to metadata management, which is not conducive to efficient metadata management. . Therefore, the present invention can first obtain all logical addresses contained in the logical address space in the storage system, and generate a tree structure based on all logical addresses before using the logical address space, so that the tree structure stores each logical address in sequence according to the logical address. The key-value pair corresponding to the address. This not only ensures that the tree structure can completely cover all logical addresses in the logical address space, but also makes it easy to find the key-value pairs corresponding to each logical address in the tree structure, and subsequently creates a mapping relationship between logical addresses and physical addresses. , it is only necessary to update and replace the key-value pairs in the tree structure provided in this embodiment, and there is no need to adjust the branch structure of the tree structure.

需要说明的是,本发明实施例并不限定具体的树结构,可根据实际应用需求进行设定,例如可以为二叉树、多叉树(如B+树)等。本发明实施例也不限定逻辑地址空间的具体大小,可根据实际应用需求进行设定。此处应当指出的是,树结构的尺寸(如深度)有可能随着逻辑地址空间大小的增大而增大,而较大尺寸的树结构不利于键值对的快速查找。为了有效控制树结构尺寸,本发明实施例还可对较大尺寸的逻辑地址空间进行划分,并为划分后的每一片逻辑地址空间创建对应的、较小尺寸的树结构。It should be noted that the embodiment of the present invention is not limited to a specific tree structure, which can be set according to actual application requirements. For example, it can be a binary tree, a multi-tree (such as a B+ tree), etc. The embodiment of the present invention does not limit the specific size of the logical address space, which can be set according to actual application requirements. It should be noted here that the size of the tree structure (such as depth) may increase as the size of the logical address space increases, and a larger size tree structure is not conducive to fast search of key-value pairs. In order to effectively control the size of the tree structure, embodiments of the present invention can also divide a larger-sized logical address space, and create a corresponding smaller-sized tree structure for each divided logical address space.

基于此,在获取存储系统中的逻辑地址空间包含的所有逻辑地址之前,还可以包括:Based on this, before obtaining all logical addresses contained in the logical address space in the storage system, you can also include:

步骤11:对所述存储系统中的逻辑地址空间进行划分,并基于划分得到的各逻辑地址空间进入所述获取存储系统中的逻辑地址空间包含的所有逻辑地址的步骤。Step 11: Divide the logical address space in the storage system, and proceed to the step of obtaining all logical addresses contained in the logical address space in the storage system based on each divided logical address space.

S102、利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键。S102. Generate a B+ tree using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number of key-value pairs. , the key-value pair uses the logical address as a key.

具体的,本发明实施例将基于B+树结构来存储键值对,其中B+树是一种自平衡的搜索树,它广泛应用于数据库和文件系统中。B+树的特点是在每个内部节点上存储一定数量的关键字,并将节点分为多个子树。每个关键字在树中只出现一次,且所有叶子节点都位于同一层。B+树的这些特性使得它能够在插入、删除和搜索操作中保持高效的性能。相关技术中,假基于B+树形式以现有方式(即仅在确定逻辑地址与物理地址之间设置有映射关系时,才将对应的键值对插入树结构中)来管理逻辑地址与物理地址间的映射关系,则同一棵B+树的结构总会随着键值对插入的顺序和数量而不断变化。这容易导致:1、每个节点利用率不高,节点中存在空闲空间浪费的情况,例如在插入键值对时,若一个节点超过最大容量,则该节点会分裂为两个节点,此时每个节点大约只有一半的空间有效,而另外一半空间空闲造成了浪费;2、增加了缓存修改更新的频率,这是由于B+树结构在不断的动态变化中,导致缓存结构也需要随盘上结构变化不断调整,以保持缓存和盘上数据的一致性。Specifically, this embodiment of the present invention will store key-value pairs based on the B+ tree structure, where the B+ tree is a self-balancing search tree that is widely used in databases and file systems. B+ trees are characterized by storing a certain number of keywords on each internal node and dividing the nodes into multiple subtrees. Each keyword appears only once in the tree, and all leaf nodes are at the same level. These properties of the B+ tree enable it to maintain efficient performance during insertion, deletion, and search operations. In the related technology, the logical address and the physical address are managed in the existing way based on the B+ tree form (that is, only when it is determined that there is a mapping relationship between the logical address and the physical address, the corresponding key-value pair is inserted into the tree structure) If there is a mapping relationship between them, the structure of the same B+ tree will always change with the order and number of key-value pairs inserted. This can easily lead to: 1. The utilization rate of each node is not high, and there is a waste of free space in the node. For example, when inserting key-value pairs, if a node exceeds the maximum capacity, the node will be split into two nodes. At this time Only about half of the space of each node is valid, and the other half of the space is free, causing waste; 2. Increase the frequency of cache modification and update. This is because the B+ tree structure is constantly changing dynamically, causing the cache structure to also need to be updated on the disk. Structural changes are constantly adjusted to maintain the consistency of cache and on-disk data.

也正因如此,本发明实施例在使用逻辑地址空间之前,将基于该空间中的所有逻辑地址生成B+树,以确保该B+树的所有叶子节点依照逻辑地址依次保存各逻辑地址对应的键值对,以及确保各叶子节点保存相同数量的键值对。显然,本发明实施例可确保B+树从最开始便完整覆盖逻辑地址空间中的所有逻辑地址,这样在后续创建逻辑地址与物理地址间的映射关系时,仅需对B+树中对应的键值对进行更新替换即可,不需要对B+树的树枝结构进行调整。且,本发明实施例可确保各叶子节点保存相同数量的键值对,进而能够预先根据键值对的数量分配各个叶子节点的大小,以确保每个叶子节点均能够被写满,进而也能够达到提升节点利用率、降低存储资源浪费的效果。For this reason, before using the logical address space, the embodiment of the present invention will generate a B+ tree based on all logical addresses in the space to ensure that all leaf nodes of the B+ tree save the key values corresponding to each logical address in sequence according to the logical address. pairs, and ensure that each leaf node stores the same number of key-value pairs. Obviously, the embodiment of the present invention can ensure that the B+ tree completely covers all logical addresses in the logical address space from the beginning. In this way, when subsequently creating a mapping relationship between logical addresses and physical addresses, only the corresponding key values in the B+ tree need to be Just update and replace them, and there is no need to adjust the branch structure of the B+ tree. Moreover, the embodiment of the present invention can ensure that each leaf node stores the same number of key-value pairs, and can allocate the size of each leaf node in advance according to the number of key-value pairs, so as to ensure that each leaf node can be filled up, and thus can also This achieves the effect of improving node utilization and reducing storage resource waste.

应当指出的是,在创建B+树之时,由于并未对各逻辑地址分配对应的物理地址,因此B+树中的所有键值对所包含的值(Value)均为初始值。本发明实施例并不限定具体的初始值,可根据实际应用需求进行设定,只要能够确保存储系统可基于该初始值判定未给对应的逻辑地址分配物理地址即可。在一种可能的情况中,该初始值可以为空值(null)。It should be noted that when the B+ tree is created, since no corresponding physical address is assigned to each logical address, the values contained in all key-value pairs in the B+ tree are initial values. The embodiment of the present invention does not limit the specific initial value, which can be set according to actual application requirements, as long as it can ensure that the storage system can determine that the corresponding logical address has not been assigned a physical address based on the initial value. In one possible case, the initial value can be null.

基于此,所述利用所有所述逻辑地址生成B+树,可以包括:Based on this, generating a B+ tree using all the logical addresses may include:

步骤21:为各所述逻辑地址创建初始的键值对;所述初始的键值对以所述逻辑地址为键且以空值为值;Step 21: Create an initial key-value pair for each logical address; the initial key-value pair uses the logical address as the key and a null value as the value;

步骤22:利用所有所述逻辑地址的初始的键值对生成所述B+树。Step 22: Generate the B+ tree using the initial key-value pairs of all logical addresses.

进一步,由于逻辑地址空间大小将直接影响B+树的尺寸,为避免B+树尺寸过大,本发明实施例还可依照B+树的规定尺寸对逻辑地址空间进行划分,具体的,可根据B+树的预设最大深度、B+树中的叶子节点可保存的预设最大键值对数目确定B+树可覆盖的逻辑地址范围,进而基于该逻辑地址范围对所述存储系统中的逻辑地址空间进行划分,以确保划分后的逻辑地址空间大小与规定的B+树尺寸相适宜。Furthermore, since the size of the logical address space will directly affect the size of the B+ tree, in order to avoid the size of the B+ tree being too large, embodiments of the present invention can also divide the logical address space according to the specified size of the B+ tree. Specifically, the logical address space can be divided according to the size of the B+ tree. The preset maximum depth and the preset maximum number of key-value pairs that can be saved by leaf nodes in the B+ tree determine the logical address range that the B+ tree can cover, and then the logical address space in the storage system is divided based on the logical address range. To ensure that the size of the divided logical address space is suitable for the specified B+ tree size.

基于此,所述对所述存储系统中的逻辑地址空间进行划分,可以包括:Based on this, dividing the logical address space in the storage system may include:

步骤31:根据所述B+树的预设最大深度、所述B+树中的叶子节点可保存的预设最大键值对数目确定所述B+树可覆盖的逻辑地址范围;Step 31: Determine the logical address range that the B+ tree can cover based on the preset maximum depth of the B+ tree and the preset maximum number of key-value pairs that can be saved by the leaf nodes in the B+ tree;

步骤32:根据所述逻辑地址范围对所述存储系统中的逻辑地址空间进行划分。Step 32: Divide the logical address space in the storage system according to the logical address range.

为便于理解,请参考图2,图2为本发明实施例所提供的一种B+树的结构示意图。在构建树结构时,本发明实施例可采取了一定均衡策略,以保证每棵树所包含的键数量都相同,且每棵树的键值(key)都分布在某一固定范围。进而如图2所示,每个叶子节点都包含固定范围类的所有键值,且每个叶子节点记录键值均为固定范围内的连续整数。此时,由于键值对的数量已知、键值对的分布已知,因此可根据B+树参数配置,提前预先设定B+树的结构,例如按照键从小到大的顺序,从左到右顺序依次向各个叶子节点填充最大数量的键值对。在叶子节点确定后,从下往上,依次可以确定各层树节点的键值对分布,直至根节点。此处要指出的是,除叶子节点外,其他树节点中的键值对均用于记录其下层节点的指针。在完成B+树构建后,本发明实施例可将该B+树作为基树,而在更新键值对,可直接按照该基树结构进行键值对替换操作。无论键值对的数量及其更新的先后顺序如何变化,盘上树的结构始终保持不变,键值对间的相对位置关系也保持不变。这是这种结构不变性,相对位置关系的不变性,为设计高效的缓存结构提供了可能。For ease of understanding, please refer to Figure 2, which is a schematic structural diagram of a B+ tree provided by an embodiment of the present invention. When building a tree structure, embodiments of the present invention may adopt a certain balancing strategy to ensure that each tree contains the same number of keys and that the keys of each tree are distributed within a certain fixed range. As shown in Figure 2, each leaf node contains all key values of the fixed range class, and the key values recorded in each leaf node are consecutive integers within a fixed range. At this time, since the number of key-value pairs and the distribution of key-value pairs are known, the structure of the B+ tree can be preset in advance according to the B+ tree parameter configuration, for example, in the order of keys from small to large, from left to right. Populate each leaf node with the maximum number of key-value pairs in sequence. After the leaf nodes are determined, the key-value pair distribution of each layer of tree nodes can be determined from bottom to top, up to the root node. What should be pointed out here is that, except for leaf nodes, the key-value pairs in other tree nodes are used to record the pointers of their lower nodes. After completing the construction of the B+ tree, the embodiment of the present invention can use the B+ tree as a base tree, and when updating the key-value pairs, the key-value pair replacement operation can be directly performed according to the base tree structure. No matter how the number of key-value pairs and the order of their updates change, the structure of the tree on the disk always remains unchanged, and the relative positional relationship between key-value pairs also remains unchanged. It is this structural invariance and the invariance of relative position relationships that makes it possible to design an efficient cache structure.

S103、当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。S103. When receiving a key-value pair update request, replace the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree.

如上所述,当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与B+树中具有相同键的键值对进行简单替换即可。同理,当接收到表征清除逻辑地址与物理地址间映射关系的键值对删除请求时,为保持键值对间相对位置关系的不变性,本发明实施例可将所述B+树中与所述键值对删除请求对应的待删除键值对的值清空,以将待删除键值对恢复为初始状态,而并不移除该待删除键值对。As mentioned above, when a key-value pair update request is received, the new key-value pair containing the mapping relationship between the logical address and the physical address can be simply replaced with the key-value pair with the same key in the B+ tree. Similarly, when receiving a key-value pair deletion request that represents the clearing of the mapping relationship between the logical address and the physical address, in order to maintain the invariance of the relative position relationship between the key-value pairs, the embodiment of the present invention can combine the B+ tree with all the key-value pairs. The value of the key-value pair to be deleted corresponding to the key-value pair deletion request is cleared to restore the key-value pair to be deleted to its initial state without removing the key-value pair to be deleted.

基于此,本方法还可以包括:Based on this, this method may also include:

步骤41:当接收到键值对删除请求时,将所述B+树中与所述键值对删除请求对应的待删除键值对的值清空。Step 41: When receiving a key-value pair deletion request, clear the value of the key-value pair to be deleted corresponding to the key-value pair deletion request in the B+ tree.

基于上述实施例,本发明首先可获取存储系统中的逻辑地址空间中的所有逻辑地址,并利用所有逻辑地址生成一棵B+树,其中B+树的所有叶子节点依照逻辑地址依次保存各逻辑地址对应的键值对,各叶子节点保存相同数量的键值对,键值对以逻辑地址为键。显然,本发明中的B+树能够覆盖逻辑地址空间中的所有逻辑地址,且各逻辑地址的键值对在B+树中规律地保存。这样,本发明在接收到键值对更新请求时,仅需根据新键值的键,将这一包含有逻辑地址与物理地址间映射关系的新键值对与B+树中具有相同键的键值对进行替换即可,不需要对B+树的结构进行变更,从而能够避免因逻辑地址与物理地址间映射关系的动态变化所导致的树结构变化频繁的问题,进而能够有效降低利用树结构管理逻辑地址与物理地址间映射关系的复杂度。Based on the above embodiments, the present invention can first obtain all logical addresses in the logical address space in the storage system, and use all logical addresses to generate a B+ tree, in which all leaf nodes of the B+ tree save the corresponding logical addresses in sequence according to the logical addresses. Each leaf node stores the same number of key-value pairs, and the key-value pairs use logical addresses as keys. Obviously, the B+ tree in the present invention can cover all logical addresses in the logical address space, and the key-value pairs of each logical address are regularly saved in the B+ tree. In this way, when the present invention receives a key-value pair update request, it only needs to compare the new key-value pair containing the mapping relationship between the logical address and the physical address with the key with the same key in the B+ tree based on the key of the new key value. The value pairs can be replaced without changing the structure of the B+ tree. This can avoid the problem of frequent tree structure changes caused by dynamic changes in the mapping relationship between logical addresses and physical addresses, thereby effectively reducing the use of tree structure management. The complexity of the mapping relationship between logical addresses and physical addresses.

基于上述实施例,由于本发明实施例特别设置了B+树,并可确保键值对在B+树叶子节点中的分布情况是已知且规律的,因此本发明实施例可基于该特性进一步提升查找键值对的效率。基于此,在利用所有所述逻辑地址生成B+树之后,还可以包括:Based on the above embodiments, since the embodiment of the present invention specially sets up a B+ tree and can ensure that the distribution of key-value pairs in the leaf nodes of the B+ tree is known and regular, the embodiment of the present invention can further improve the search based on this feature. Efficiency of key-value pairs. Based on this, after using all the logical addresses to generate the B+ tree, it may also include:

S201、将所述B+树从所述存储系统的存储设备加载至所述存储系统的内存设备中。S201. Load the B+ tree from the storage device of the storage system into the memory device of the storage system.

S202、依照各树节点在所述B+树中的位置对各所述树节点进行排序,并根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址。S202: Sort each tree node according to its position in the B+ tree, and record the memory address corresponding to each tree node in sequence according to the arrangement order of each tree node.

应当指出的是,为方便用户获取数据,在使用逻辑地址空间时,通常可将树结构从存储系统的存储设备加载至存储系统的内存设备中,以直接在内存设备中确定用户数据在存储设备中的位置。然而在相关技术中,树结构通常采用哈希表进行存储,且在查询过程中,需从树结构顶部开始逐层向下查询。以B+树结构为例,在现有方式中,由于键值对在B+树中分布情况不固定,因此需从B+树顶部逐层确定键值对所在的叶子节点。进而,受B+树的结构影响,在现有方式中,每次查询键值对都必须执行与B+树的深度同等数目的查找操作,这降低了键值对的查询效率。而在本发明实施例中,由于键值对在本实施例提供的B+树中有序排布,且各键值对在B+树中的位置始终不会发生变化,因此本发明实施例仅需根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址,便可在进行键值对查询时根据待查询键值对的键、各叶子节点的顺序及各叶子节点所记录的逻辑地址范围,执行一次查询即确定待查询键值所在的叶子节点,并可快速查询到待查询键值对,从而可显著提升键值对的查询效率。It should be noted that in order to facilitate users to obtain data, when using logical address space, the tree structure can usually be loaded from the storage device of the storage system to the memory device of the storage system to directly determine in the memory device where the user data is located on the storage device. location in. However, in related technologies, the tree structure is usually stored using a hash table, and during the query process, it is necessary to query downwards layer by layer starting from the top of the tree structure. Taking the B+ tree structure as an example, in the existing method, since the distribution of key-value pairs in the B+ tree is not fixed, the leaf nodes where the key-value pairs are located need to be determined layer by layer from the top of the B+ tree. Furthermore, due to the structure of the B+ tree, in the existing method, every time a key-value pair is queried, the same number of search operations as the depth of the B+ tree must be performed, which reduces the query efficiency of the key-value pair. In the embodiment of the present invention, since the key-value pairs are arranged in an orderly manner in the B+ tree provided in this embodiment, and the position of each key-value pair in the B+ tree never changes, the embodiment of the present invention only requires According to the arrangement order of each tree node, the memory address corresponding to each tree node is recorded sequentially, so that when performing a key-value pair query, the key of the key-value pair to be queried, the order of each leaf node, and the records of each leaf node can be used. Within the logical address range, executing one query can determine the leaf node where the key value to be queried is located, and the key value pair to be queried can be quickly queried, which can significantly improve the query efficiency of the key value pair.

相应的,所述将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换,包括:Correspondingly, replacing the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree includes:

S203、根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址。S203. Search the memory address of the leaf node to be updated to which the new key-value pair belongs according to the key of the new key-value pair, the logical address range recorded by each leaf node, and the arrangement order of each leaf node.

需要说明的是,待更新叶子节点为新键值对所述的叶子节点。还需要说明的是,本发明实施例并不限定采用何种形式记录各树节点的内存地址,例如可采用列表形式记录,也可采用数组形式进行记录。为方便索引查找,本发明实施例可采用数组形式记录各树节点的内存地址。具体的,可为B+树的各层生成对应的数组,并可根据各树节点的排列顺序将各层的树节点对应的内存地址依次记录至各层对应的数组中。这样,在后续查询时,仅需根据新键值对的键和各叶子节点所记录的逻辑地址范围,确定新键值对所属的待更新叶子节点在数组中的序号,并根据序号从数组中获取待更新叶子节点的内存地址即可。It should be noted that the leaf node to be updated is the leaf node described in the new key-value pair. It should also be noted that the embodiment of the present invention does not limit the form used to record the memory address of each tree node. For example, it can be recorded in list form or in array form. In order to facilitate index search, embodiments of the present invention may use an array form to record the memory address of each tree node. Specifically, corresponding arrays can be generated for each layer of the B+ tree, and the memory addresses corresponding to the tree nodes of each layer can be sequentially recorded into the arrays corresponding to each layer according to the arrangement order of the tree nodes. In this way, during subsequent queries, you only need to determine the sequence number of the leaf node to be updated to which the new key-value pair belongs in the array based on the key of the new key-value pair and the logical address range recorded by each leaf node, and retrieve the sequence number from the array based on the sequence number. Just get the memory address of the leaf node to be updated.

基于此,所述根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址,可以包括:Based on this, recording the memory addresses corresponding to each tree node in sequence according to the arrangement order of each tree node may include:

步骤51:为所述B+树的各层生成对应的数组,并根据各所述树节点的排列顺序将各层的所述树节点对应的内存地址依次记录至各层对应的数组中;Step 51: Generate corresponding arrays for each layer of the B+ tree, and record the memory addresses corresponding to the tree nodes of each layer into the arrays corresponding to each layer in sequence according to the arrangement order of the tree nodes;

所述根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址,可以包括:Searching for the memory address of the leaf node to be updated to which the new key-value pair belongs according to the key of the new key-value pair, the logical address range recorded by each leaf node and the arrangement order of each leaf node may be include:

步骤52:根据所述新键值对的键和各所述叶子节点所记录的逻辑地址范围,确定所述新键值对所属的待更新叶子节点在所述数组中的序号;Step 52: Determine the sequence number of the leaf node to be updated to which the new key-value pair belongs in the array according to the key of the new key-value pair and the logical address range recorded by each leaf node;

步骤53:根据所述序号从所述数组中获取所述待更新叶子节点的内存地址。Step 53: Obtain the memory address of the leaf node to be updated from the array according to the sequence number.

为方便理解,请参考图3,图3为本发明实施例所提供的一种利用数组记录B+树的示意图。可见,由于本发明实施例基于B+树结构生成了基树,且键值对数据将按照基树结构进行存储,且各键值对在基树中的分布非常有规律,因此基于该规律,给定任何键,本发明实施例都可以计算出该键所对应的值落在叶子层的第几个节点以及在节点中的位置。同时本发明实施例也很容易计算出该叶子节点对应的父亲节点,祖先节点在各层的位置和节点内位置。这样缓存时,可通过构建缓存数组,来映射此基树结构,将盘上基树的B+树节点,按规律映射到该缓存数组中,而从实现基于数组索引的快速查找定位。如图3所示,首先对应盘上基树的每一层,缓存数组中都有一个对应的数组,用于存放该层中的树节点在内存中指针。其次每层数组大小等于基树中该层所包含的节点数量。这样根据待查询的键值对及键值对的存储规律,可知道这一键值对所在的叶子节点落在叶子层的哪一个节点,在节点内的存储位置,从而快速查询、插入或者删除所需要值。这样相较于原来的需要从根节点逐级向下查找,每一层还需要进行二分查找和哈希表查找而言,操作数量大大减小,查询效率明显提升。For ease of understanding, please refer to FIG. 3 , which is a schematic diagram of using an array to record a B+ tree according to an embodiment of the present invention. It can be seen that since the embodiment of the present invention generates a base tree based on the B+ tree structure, and the key-value pair data will be stored according to the base tree structure, and the distribution of each key-value pair in the base tree is very regular, therefore based on this rule, By specifying any key, the embodiment of the present invention can calculate which node in the leaf layer the value corresponding to the key falls on and the position in the node. At the same time, the embodiment of the present invention can also easily calculate the parent node corresponding to the leaf node, the position of the ancestor node in each layer and the position within the node. When caching in this way, the base tree structure can be mapped by constructing a cache array, and the B+ tree nodes of the base tree on the disk are mapped to the cache array according to rules, thereby achieving fast search and positioning based on the array index. As shown in Figure 3, first, corresponding to each layer of the base tree on the disk, there is a corresponding array in the cache array, which is used to store the pointers of the tree nodes in this layer in memory. Secondly, the size of the array at each level is equal to the number of nodes contained in that level in the base tree. In this way, according to the key-value pair to be queried and the storage rules of the key-value pair, we can know which node in the leaf layer the leaf node where the key-value pair is located falls on, and the storage location within the node, so that we can quickly query, insert or delete it. required value. In this way, compared with the original need to search step by step downwards from the root node, and each layer also needs to perform binary search and hash table search, the number of operations is greatly reduced, and the query efficiency is significantly improved.

S204、根据所述待更新叶子节点的内存地址,在所述待更新叶子节点中将所述新键值对与具有相同键的键值对进行替换。S204. According to the memory address of the leaf node to be updated, replace the new key-value pair with a key-value pair having the same key in the leaf node to be updated.

可以理解的是,在查询到待更新叶子节点的内存地址之后,可在内存中进行键值对替换。而在完成对待更新叶子节点的键值对更新替换后,可将其更新至存储设备中,以持久化更新结果。It can be understood that after querying the memory address of the leaf node to be updated, the key-value pair can be replaced in the memory. After completing the update and replacement of the key-value pairs of the leaf nodes to be updated, they can be updated to the storage device to persist the update results.

进一步,对于简单的键值对查询请求,本发明实施例可采用相同的方式快速查询到所需的键值对。具体的,当接收到键值对查询请求时,可根据待查询键值对的逻辑地址和各叶子节点所记录的逻辑地址范围,确定待查询键值对所属的待查询叶子节点在数组中的序号,并根据序号从数组中获取待查询叶子节点的内存地址,从而根据内存地址在待查询叶子节点中获取待查询键值对。Furthermore, for a simple key-value pair query request, the embodiment of the present invention can use the same method to quickly query the required key-value pair. Specifically, when a key-value pair query request is received, the location of the leaf node to be queried in the array to which the key-value pair belongs can be determined based on the logical address of the key-value pair to be queried and the logical address range recorded by each leaf node. Serial number, and obtain the memory address of the leaf node to be queried from the array according to the sequence number, thereby obtaining the key-value pair to be queried in the leaf node to be queried based on the memory address.

基于此,本方法还可以包括:Based on this, this method may also include:

步骤61:当接收到键值对查询请求时,根据待查询键值对的逻辑地址和各所述叶子节点所记录的逻辑地址范围,确定所述待查询键值对所属的待查询叶子节点在所述数组中的序号;Step 61: When receiving a key-value pair query request, determine the location of the leaf node to be queried to which the key-value pair to be queried is based on the logical address of the key-value pair to be queried and the logical address range recorded by each leaf node. The serial number in the array;

步骤62:根据所述序号从所述数组中获取所述待查询叶子节点的内存地址,并根据所述内存地址在所述待查询叶子节点中获取所述待查询键值对。Step 62: Obtain the memory address of the leaf node to be queried from the array according to the sequence number, and obtain the key-value pair to be queried in the leaf node to be queried according to the memory address.

综合上述实施例,可将本方法简单总结为两个步骤,即:Based on the above embodiments, this method can be simply summarized into two steps, namely:

1、首先在元数据更新存盘阶段,摒弃传统的基于B+树动态构建刷盘树的方法,而是直接按照基树结构,对键值对进行插入与删除,然后存盘,这样可以保证落盘的键值对对是严格按照预设的基树结构进行存储的。1. First, in the metadata update and save stage, abandon the traditional method of dynamically constructing a disk brush tree based on B+ tree. Instead, directly insert and delete key-value pairs according to the base tree structure, and then save to disk. This can ensure the success of the disk save. Key-value pairs are stored strictly according to the preset base tree structure.

2、在元数据读缓存中,对每棵基树,构建对应的缓存数组,缓存数组中存放基树中的节点。查缓存时,通过查询键,按照一定规律,计算出其所在节点的位置,命中则直接读取值;若不命中,则依次查找父亲、祖先节点的物理地址,然后触发读盘操作。2. In the metadata read cache, for each base tree, a corresponding cache array is constructed, and the nodes in the base tree are stored in the cache array. When checking the cache, the location of the node is calculated according to certain rules through the query key. If it hits, the value is read directly; if it does not hit, the physical addresses of the parent and ancestor nodes are searched in sequence, and then the disk read operation is triggered.

下面对本发明实施例提供的基于存储系统的地址处理装置、存储系统及计算机可读存储介质进行介绍,下文描述的基于存储系统的地址处理装置、存储系统及计算机可读存储介质与上文描述的基于存储系统的地址处理方法可相互对应参照。The storage system-based address processing device, storage system and computer-readable storage medium provided by the embodiments of the present invention are introduced below. The storage system-based address processing device, storage system and computer-readable storage medium described below are the same as those described above. The address processing methods based on the storage system can correspond to each other.

请参考图4,图4为本发明实施例所提供的一种基于存储系统的地址处理装置的结构框图,该装置可以包括:Please refer to Figure 4, which is a structural block diagram of an address processing device based on a storage system provided by an embodiment of the present invention. The device may include:

获取模块401,用于获取存储系统中的逻辑地址空间包含的所有逻辑地址;The acquisition module 401 is used to acquire all logical addresses contained in the logical address space in the storage system;

生成模块402,用于利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;The generation module 402 is used to generate a B+ tree using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number. A key-value pair, the key-value pair uses the logical address as the key;

更新模块403,用于当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。The update module 403 is configured to, when receiving a key-value pair update request, replace the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree.

可选地,所述生成模块402,可以包括:Optionally, the generation module 402 may include:

键值对初始化子模块,用于为各所述逻辑地址创建初始的键值对;所述初始的键值对以所述逻辑地址为键且以空值为值;The key-value pair initialization submodule is used to create an initial key-value pair for each of the logical addresses; the initial key-value pair uses the logical address as the key and a null value as the value;

B+树创建子模块,用于利用所有所述逻辑地址的初始的键值对生成所述B+树。The B+ tree creation submodule is used to generate the B+ tree using the initial key-value pairs of all logical addresses.

可选地,所述装置还可以包括:Optionally, the device may also include:

删除模块,用于当接收到键值对删除请求时,将所述B+树中与所述键值对删除请求对应的待删除键值对的值清空。A deletion module, configured to clear the value of the key-value pair to be deleted corresponding to the key-value pair deletion request in the B+ tree when receiving a key-value pair deletion request.

可选地,该装置还可以包括:Optionally, the device may also include:

划分模块,用于对所述存储系统中的逻辑地址空间进行划分,并基于划分得到的各逻辑地址空间进入所述获取存储系统中的逻辑地址空间包含的所有逻辑地址的步骤。A dividing module is used to divide the logical address space in the storage system, and enter the step of obtaining all logical addresses contained in the logical address space in the storage system based on each divided logical address space.

可选地,所述划分模块,可以包括:Optionally, the dividing module may include:

可覆盖逻辑地址范围确定子模块,用于根据所述B+树的预设最大深度、所述B+树中的叶子节点可保存的预设最大键值对数目确定所述B+树可覆盖的逻辑地址范围;The coverageable logical address range determination submodule is used to determine the logical address that the B+ tree can cover based on the preset maximum depth of the B+ tree and the preset maximum number of key-value pairs that can be saved by leaf nodes in the B+ tree. scope;

划分子模块,用于根据所述逻辑地址范围对所述存储系统中的逻辑地址空间进行划分。A dividing sub-module is used to divide the logical address space in the storage system according to the logical address range.

可选地,所述装置还可以包括:Optionally, the device may also include:

加载模块,用于将所述B+树从所述存储系统的存储设备加载至所述存储系统的内存设备中;A loading module, configured to load the B+ tree from the storage device of the storage system into the memory device of the storage system;

记录模块,用于依照各树节点在所述B+树中的位置对各所述树节点进行排序,并根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址;A recording module, configured to sort each tree node according to its position in the B+ tree, and record the memory address corresponding to each tree node in sequence according to the arrangement order of each tree node;

所述更新模块403,可以包括:The update module 403 may include:

查询子模块,用于根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址;Query submodule, used to search for the leaf node to be updated to which the new key-value pair belongs based on the key of the new key-value pair, the logical address range recorded by each leaf node, and the arrangement order of each leaf node. memory address;

替换子模块,用于根据所述待更新叶子节点的内存地址,在所述待更新叶子节点中将所述新键值对与具有相同键的键值对进行替换。A replacement submodule, configured to replace the new key-value pair with a key-value pair having the same key in the leaf node to be updated according to the memory address of the leaf node to be updated.

可选地,所述记录模块,具体用于:Optionally, the recording module is specifically used for:

为所述B+树的各层生成对应的数组,并根据各所述树节点的排列顺序将各层的所述树节点对应的内存地址依次记录至各层对应的数组中;Generate corresponding arrays for each layer of the B+ tree, and record the memory addresses corresponding to the tree nodes of each layer into the arrays corresponding to each layer in turn according to the arrangement order of the tree nodes;

所述查询子模块,可以包括:The query sub-module may include:

查询单元,用于根据所述新键值对的键和各所述叶子节点所记录的逻辑地址范围,确定所述新键值对所属的待更新叶子节点在所述数组中的序号;A query unit configured to determine the sequence number in the array of the leaf node to be updated to which the new key-value pair belongs based on the key of the new key-value pair and the logical address range recorded by each leaf node;

获取单元,用于根据所述序号从所述数组中获取所述待更新叶子节点的内存地址。An obtaining unit, configured to obtain the memory address of the leaf node to be updated from the array according to the sequence number.

可选地,所述装置还可以包括:Optionally, the device may also include:

查询请求响应模块,用于当接收到键值对查询请求时,根据待查询键值对的逻辑地址和各所述叶子节点所记录的逻辑地址范围,确定所述待查询键值对所属的待查询叶子节点在所述数组中的序号;A query request response module, configured to, when receiving a key-value pair query request, determine the key-value pair to be queried according to the logical address of the key-value pair to be queried and the logical address range recorded by each leaf node. Query the serial number of the leaf node in the array;

查询模块,用于根据所述序号从所述数组中获取所述待查询叶子节点的内存地址,并根据所述内存地址在所述待查询叶子节点中获取所述待查询键值对。A query module, configured to obtain the memory address of the leaf node to be queried from the array according to the sequence number, and to obtain the key-value pair to be queried in the leaf node to be queried according to the memory address.

请参考图5,图5为本发明实施例所提供的一种存储系统的结构框图,本发明实施例提供了一种存储系统50,包括处理器51、第一存储器52、第二存储器53;其中,所述第一存储器52,用于存储用户数据;所述第二存储器53,用于保存计算机程序;所述处理器51,用于在执行所述计算机程序时执行前述实施例提供的基于存储系统的地址处理方法。Please refer to Figure 5. Figure 5 is a structural block diagram of a storage system provided by an embodiment of the present invention. An embodiment of the present invention provides a storage system 50, including a processor 51, a first memory 52, and a second memory 53; Among them, the first memory 52 is used to store user data; the second memory 53 is used to save a computer program; and the processor 51 is used to execute the method based on the previous embodiment when executing the computer program. Address processing method of storage system.

关于上述基于存储系统的地址处理方法的具体过程可以参考前述实施例中提供的相应内容,在此不再进行赘述。Regarding the specific process of the above storage system-based address processing method, reference may be made to the corresponding content provided in the foregoing embodiments, and will not be described again here.

并且,所述第一存储器52、所述第二存储器53作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,存储方式可以是短暂存储或者永久存储。Moreover, the first memory 52 and the second memory 53, as carriers for resource storage, can be read-only memory, random access memory, magnetic disks or optical disks, etc., and the storage method can be short-term storage or permanent storage.

另外,所述存储系统50还包括电源54、通信接口55、输入输出接口56和通信总线57;其中,所述电源54用于为所述存储系统50上的各硬件设备提供工作电压,可由外部供电;所述通信接口55能够为所述存储系统50创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本发明技术方案的任意通信协议,在此不对其进行具体限定;所述输入输出接口56,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In addition, the storage system 50 also includes a power supply 54, a communication interface 55, an input and output interface 56 and a communication bus 57; wherein the power supply 54 is used to provide operating voltage for each hardware device on the storage system 50, which can be provided by an external Power supply; the communication interface 55 can create a data transmission channel between the storage system 50 and external devices, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present invention, which will not be detailed here. Limitation: The input and output interface 56 is used to obtain external input data or output data to the external world. Its specific interface type can be selected according to specific application needs, and is not specifically limited here.

进一步,所述存储系统中的第一存储器52可包含多个,并可由多个第一存储器52所组成的存储空间构建逻辑地址空间;此外,所述存储系统还可包含内存设备。Furthermore, the storage system may include multiple first memories 52 , and a logical address space may be constructed from the storage space composed of multiple first memories 52 ; in addition, the storage system may also include a memory device.

本发明实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述任意实施例的基于存储系统的地址处理方法的步骤。Embodiments of the present invention also provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the steps of the address processing method based on the storage system of any of the above embodiments are implemented.

由于计算机可读存储介质部分的实施例与基于存储系统的地址处理方法部分的实施例相互对应,因此计算机可读存储介质部分的实施例请参见基于存储系统的地址处理方法部分的实施例的描述,这里不再赘述。Since the embodiments of the computer-readable storage medium portion correspond to the embodiments of the storage system-based address processing method portion, for the embodiments of the computer-readable storage medium portion, please refer to the description of the embodiments of the storage system-based address processing method portion. , we won’t go into details here.

说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。Each embodiment in the specification is described in a progressive manner. Each embodiment focuses on its differences from other embodiments. The same and similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple. For relevant details, please refer to the description in the method section.

专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art may further realize that the units and algorithm steps of each example described in connection with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. In order to clearly illustrate the possible functions of hardware and software, Interchangeability, in the above description, the composition and steps of each example have been generally described according to functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each specific application, but such implementations should not be considered to be beyond the scope of the present invention.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly in hardware, in software modules executed by a processor, or in a combination of both. Software modules may be located in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or anywhere in the field of technology. any other known form of storage media.

以上对本发明所提供的基于存储系统的地址处理方法、装置、存储系统及介质进行了详细介绍。本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The address processing method, device, storage system and medium based on the storage system provided by the present invention have been introduced in detail above. This article uses specific examples to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and the core idea of the present invention. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the present invention, and these improvements and modifications also fall within the scope of the claims of the present invention.

Claims (10)

1.一种基于存储系统的地址处理方法,其特征在于,包括:1. An address processing method based on a storage system, characterized by including: 获取存储系统中的逻辑地址空间包含的所有逻辑地址;Obtain all logical addresses contained in the logical address space in the storage system; 利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;A B+ tree is generated using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number of key-value pairs, so The key-value pair uses the logical address as the key; 当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。When a key-value pair update request is received, a new key-value pair containing the mapping relationship between the logical address and the physical address is replaced with the key-value pair having the same key in the B+ tree. 2.根据权利要求1所述的地址处理方法,其特征在于,所述利用所有所述逻辑地址生成B+树,包括:2. The address processing method according to claim 1, characterized in that generating a B+ tree using all the logical addresses includes: 为各所述逻辑地址创建初始的键值对;所述初始的键值对以所述逻辑地址为键且以空值为值;Create an initial key-value pair for each logical address; the initial key-value pair uses the logical address as the key and a null value as the value; 利用所有所述逻辑地址的初始的键值对生成所述B+树。The B+ tree is generated using the initial key-value pairs of all logical addresses. 3.根据权利要求2所述的地址处理方法,其特征在于,还包括:3. The address processing method according to claim 2, further comprising: 当接收到键值对删除请求时,将所述B+树中与所述键值对删除请求对应的待删除键值对的值清空。When a key-value pair deletion request is received, the value of the key-value pair to be deleted corresponding to the key-value pair deletion request in the B+ tree is cleared. 4.根据权利要求1所述的地址处理方法,其特征在于,在获取存储系统中的逻辑地址空间包含的所有逻辑地址之前,还包括:4. The address processing method according to claim 1, characterized in that, before obtaining all logical addresses contained in the logical address space in the storage system, it further includes: 对所述存储系统中的逻辑地址空间进行划分,并基于划分得到的各逻辑地址空间进入所述获取存储系统中的逻辑地址空间包含的所有逻辑地址的步骤。The logical address space in the storage system is divided, and based on each divided logical address space, the step of obtaining all logical addresses contained in the logical address space in the storage system is entered. 5.根据权利要求1至4任一项所述的地址处理方法,其特征在于,在利用所有所述逻辑地址生成B+树之后,还包括:5. The address processing method according to any one of claims 1 to 4, characterized in that, after using all the logical addresses to generate a B+ tree, it further includes: 将所述B+树从所述存储系统的存储设备加载至所述存储系统的内存设备中;Load the B+ tree from the storage device of the storage system into the memory device of the storage system; 依照各树节点在所述B+树中的位置对各所述树节点进行排序,并根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址;Sort each tree node according to its position in the B+ tree, and record the memory address corresponding to each tree node in sequence according to the arrangement order of each tree node; 所述将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换,包括:Replacing the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree includes: 根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址;Search the memory address of the leaf node to be updated to which the new key-value pair belongs according to the key of the new key-value pair, the logical address range recorded by each leaf node and the arrangement order of each leaf node; 根据所述待更新叶子节点的内存地址,在所述待更新叶子节点中将所述新键值对与具有相同键的键值对进行替换。According to the memory address of the leaf node to be updated, the new key-value pair is replaced with a key-value pair having the same key in the leaf node to be updated. 6.根据权利要求5所述的地址处理方法,其特征在于,所述根据各所述树节点的排列顺序依次记录各所述树节点对应的内存地址,包括:6. The address processing method according to claim 5, characterized in that recording the memory address corresponding to each tree node in sequence according to the arrangement order of each tree node includes: 为所述B+树的各层生成对应的数组,并根据各所述树节点的排列顺序将各层的所述树节点对应的内存地址依次记录至各层对应的数组中;Generate corresponding arrays for each layer of the B+ tree, and record the memory addresses corresponding to the tree nodes of each layer into the arrays corresponding to each layer in turn according to the arrangement order of the tree nodes; 所述根据所述新键值对的键、各所述叶子节点所记录的逻辑地址范围和各所述叶子节点的排列顺序查找所述新键值对所属的待更新叶子节点的内存地址,包括:Searching for the memory address of the leaf node to be updated to which the new key-value pair belongs based on the key of the new key-value pair, the logical address range recorded by each leaf node and the arrangement order of each leaf node includes: : 根据所述新键值对的键和各所述叶子节点所记录的逻辑地址范围,确定所述新键值对所属的待更新叶子节点在所述数组中的序号;Determine the sequence number of the leaf node to be updated to which the new key-value pair belongs in the array according to the key of the new key-value pair and the logical address range recorded by each leaf node; 根据所述序号从所述数组中获取所述待更新叶子节点的内存地址。Obtain the memory address of the leaf node to be updated from the array according to the sequence number. 7.根据权利要求6所述的地址处理方法,其特征在于,还包括:7. The address processing method according to claim 6, further comprising: 当接收到键值对查询请求时,根据待查询键值对的逻辑地址和各所述叶子节点所记录的逻辑地址范围,确定所述待查询键值对所属的待查询叶子节点在所述数组中的序号;When a key-value pair query request is received, based on the logical address of the key-value pair to be queried and the logical address range recorded by each leaf node, it is determined that the leaf node to be queried to which the key-value pair to be queried belongs is in the array. The serial number in; 根据所述序号从所述数组中获取所述待查询叶子节点的内存地址,并根据所述内存地址在所述待查询叶子节点中获取所述待查询键值对。Obtain the memory address of the leaf node to be queried from the array according to the sequence number, and obtain the key-value pair to be queried in the leaf node to be queried according to the memory address. 8.一种基于存储系统的地址处理装置,其特征在于,包括:8. An address processing device based on a storage system, characterized in that it includes: 获取模块,用于获取存储系统中的逻辑地址空间包含的所有逻辑地址;The acquisition module is used to obtain all logical addresses contained in the logical address space in the storage system; 生成模块,用于利用所有所述逻辑地址生成B+树;所述B+树的所有叶子节点依照所述逻辑地址依次保存各所述逻辑地址对应的键值对,各所述叶子节点保存相同数量的键值对,所述键值对以所述逻辑地址为键;A generation module, configured to generate a B+ tree using all the logical addresses; all leaf nodes of the B+ tree sequentially store key-value pairs corresponding to each logical address according to the logical address, and each leaf node stores the same number of A key-value pair with the logical address as the key; 更新模块,用于当接收到键值对更新请求时,将包含有所述逻辑地址与物理地址间映射关系的新键值对与所述B+树中具有相同键的键值对进行替换。An update module, configured to, when receiving a key-value pair update request, replace the new key-value pair containing the mapping relationship between the logical address and the physical address with the key-value pair having the same key in the B+ tree. 9.一种存储系统,其特征在于,包括:9. A storage system, characterized by including: 第一存储器,用于存储用户数据;The first memory is used to store user data; 第二存储器,用于存储计算机程序;a second memory for storing computer programs; 处理器,用于执行所述计算机程序时实现如权利要求1至7任一项所述的基于存储系统的地址处理方法。A processor, configured to implement the storage system-based address processing method according to any one of claims 1 to 7 when executing the computer program. 10.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机可执行指令,所述计算机可执行指令被处理器加载并执行时,实现如权利要求1至7任一项所述的基于存储系统的地址处理方法。10. A computer-readable storage medium, characterized in that computer-executable instructions are stored in the computer-readable storage medium. When the computer-executable instructions are loaded and executed by a processor, claims 1 to 7 are implemented. The storage system-based address processing method described in any one of the above.
CN202311611112.6A 2023-11-28 2023-11-28 Address processing method and device based on storage system, storage system and medium Pending CN117573676A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311611112.6A CN117573676A (en) 2023-11-28 2023-11-28 Address processing method and device based on storage system, storage system and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311611112.6A CN117573676A (en) 2023-11-28 2023-11-28 Address processing method and device based on storage system, storage system and medium

Publications (1)

Publication Number Publication Date
CN117573676A true CN117573676A (en) 2024-02-20

Family

ID=89886051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311611112.6A Pending CN117573676A (en) 2023-11-28 2023-11-28 Address processing method and device based on storage system, storage system and medium

Country Status (1)

Country Link
CN (1) CN117573676A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117952082A (en) * 2024-03-25 2024-04-30 冠骋信息技术(苏州)有限公司 PLC address resolution method and system
CN120067111A (en) * 2025-04-27 2025-05-30 苏州元脑智能科技有限公司 Data storage method, electronic device, storage medium and product

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117952082A (en) * 2024-03-25 2024-04-30 冠骋信息技术(苏州)有限公司 PLC address resolution method and system
CN120067111A (en) * 2025-04-27 2025-05-30 苏州元脑智能科技有限公司 Data storage method, electronic device, storage medium and product
CN120067111B (en) * 2025-04-27 2025-07-04 苏州元脑智能科技有限公司 Data storage method, electronic device, storage medium and product

Similar Documents

Publication Publication Date Title
US4611272A (en) Key-accessed file organization
EP2633413B1 (en) Low ram space, high-throughput persistent key-value store using secondary memory
US8051050B2 (en) Block-level data de-duplication using thinly provisioned data storage volumes
US8793290B1 (en) Metadata management for pools of storage disks
US11580162B2 (en) Key value append
CN117573676A (en) Address processing method and device based on storage system, storage system and medium
US20110258374A1 (en) Method for optimizing the memory usage and performance of data deduplication storage systems
JP2015512604A (en) Cryptographic hash database
CN111324305B (en) Data writing/reading method in distributed storage system
CN113535670B (en) Virtual resource mirror image storage system and implementation method thereof
WO2024021488A1 (en) Metadata storage method and apparatus based on distributed key-value database
US10824610B2 (en) Balancing write amplification and space amplification in buffer trees
CN118467548A (en) Database management method, system and storage medium based on tree structure
WO2024119797A1 (en) Data processing method and system, device, and storage medium
CN111881064A (en) Method, device and equipment for processing access request in full flash memory storage system
US8156126B2 (en) Method for the allocation of data on physical media by a file system that eliminates duplicate data
Lee et al. An efficient index buffer management scheme for implementing a B-tree on NAND flash memory
CN111274259A (en) Data updating method for storage nodes in distributed storage system
CN115576868B (en) Multi-level mapping framework, data operation request processing method and system
CN114647388B (en) Distributed block storage system and management method
CN116501760A (en) An Efficient Distributed Metadata Management Method Combining Memory and Prefix Tree
CN116610670A (en) A blockchain-based state data storage method and device
CN111309261A (en) Physical data position mapping method on single node in distributed storage system
EP0117906B1 (en) Key-accessed file organization
US12147692B2 (en) Managing data storage consolidation

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