Storage management method, device, program product and medium of distributed storage system

By aggregating small logical keys into large physical keys in a distributed storage system and using Bloom filters to detect key indexes, the problem of low efficiency of key value query is solved and resource saving and performance improvement are achieved.

CN118394762BActive Publication Date: 2024-08-23JINAN INSPUR DATA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410853504.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2024-08-23
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

In distributed storage systems, key-value query efficiency is low, resulting in a waste of memory and storage device hardware resources, and query operations smaller than the block size lead to frequent read amplification and garbage collection, affecting performance.

Method used

Using the point query and range query methods of the preset key value database, by aggregating small logical keys into large physical keys, using Bloom filters to detect key indexes, reducing the physical key index process, improving query efficiency, and directly from The device looks for the user value.

Benefits of technology

It improves the performance of distributed storage systems, saves memory and storage device resources, reduces the number of physical keys and index query overhead, and improves key value query efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394762B
    Figure CN118394762B
Patent Text Reader

Abstract

The present invention discloses a storage management method, device, program product and medium of a distributed storage system, and relates to the field of distributed storage technology. The method comprises: obtaining a point query request of a preset key-value database; detecting whether there is an aggregate record of a logical key corresponding to a target user key in a key index of the preset key-value database; if so, determining the physical key corresponding to the target user key according to the aggregate record; retrieving the logical key corresponding to the target user key from a storage device according to the physical key corresponding to the target user key, and retrieving the user value corresponding to the target user key from the storage device using the logical key corresponding to the target user key; the present invention aggregates multiple smaller logical keys into a larger physical key, which can save memory and hardware resources of the storage device; and can conveniently confirm whether the logical key is stored in the aggregated physical key or directly stored, thereby improving the performance of the distributed storage system and the key-value query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of distributed storage technology, and in particular to a storage management method, device, program product and medium of a distributed storage system. Background Art

[0002] With the rise of big data and cloud computing technologies, distributed storage system technology has developed rapidly. The design concept of distributed storage system is based on scalability and fault tolerance. It adopts a distributed architecture, slices data and stores it in the form of objects on multiple nodes, and ensures that the capacity of each node is balanced. It uses network connections to access and manage data, and provides a unified storage interface.

[0003] The object storage engine is an indispensable backend storage module of the distributed storage system. It is the backend object library of the object storage daemon (OSD). It manages raw devices through the allocator and directly saves object data to the physical storage media devices of the distributed storage nodes, including disks and solid-state drives. At the same time, the key-value (KV) database is used to save object metadata. The key-value database manages the mapping from object name to block location on the disk. Since the database needs to rely on the file system and cannot interact directly with the raw device, the object storage engine encapsulates a file system at the bottom layer to connect the database with the raw devices of the underlying storage nodes.

[0004] In a distributed storage system, for a block interface facing a raw device, regardless of the size of the requested Key and Value, the minimum device I / O (input / output) is bound to a specified raw device block size, such as 4K; so that requests for byte-level query operations that are smaller than the raw device block size will generate a large amount of read amplification; even if the Key-Value storage in the related technology can reduce read-write amplification by only compressing the Key and storing the Value separately, the cost is that more garbage collection operations will be generated when the Key is frequently updated or deleted, affecting performance. And if the key-value pair is too small, the number of key-value pairs that need to be stored and queried will increase, increasing memory consumption and disk I / O pressure, and reducing query performance. Therefore, how to improve the performance of distributed storage systems, improve the efficiency of key-value queries, and save memory and storage device hardware resources is an urgent problem to be solved today. Summary of the invention

[0005] The purpose of the present invention is to provide a storage management method, device, computer program product and computer-readable storage medium for a distributed storage system to improve the performance of the distributed storage system, improve the efficiency of key-value query, and save memory and storage device hardware resources.

[0006] In order to solve the above technical problems, the present invention provides a storage management method for a distributed storage system, comprising:

[0007] Obtaining a point query request of a preset key-value database; wherein the point query request includes a target user key;

[0008] Detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database; wherein the aggregate record stores the correspondence between the logical key with a specification smaller than the preset specification and the corresponding physical key, and the specification of the physical key is greater than or equal to the preset specification;

[0009] If not, using the logical key corresponding to the target user key, retrieving the user value corresponding to the target user key from the storage device of the preset key-value database;

[0010] If yes, determining the physical key corresponding to the target user key according to the aggregate record;

[0011] According to the physical key corresponding to the target user key, the logical key corresponding to the target user key is retrieved from the storage device, and the user value corresponding to the target user key is retrieved from the storage device using the logical key corresponding to the target user key.

[0012] On the other hand, the detecting whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes:

[0013] By using a preset Bloom filter, it is detected whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database.

[0014] On the other hand, the using of a preset Bloom filter to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes:

[0015] Using the preset Bloom filter, detecting whether there is logic key information corresponding to the target user key in the key index;

[0016] If there is no logical key information corresponding to the target user key, determining that the point query request is an empty query;

[0017] If there is logic key information corresponding to the target user key, detecting whether there is an aggregate record of the logic key corresponding to the target user key in the key index of the preset key-value database;

[0018] If the aggregate record does not exist, performing the step of using the logical key corresponding to the target user key to retrieve the user value corresponding to the target user key from the storage device of the preset key-value database;

[0019] If the aggregation record exists, the step of determining the physical key corresponding to the target user key according to the aggregation record is performed.

[0020] On the other hand, the using of a preset Bloom filter to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes:

[0021] Inputting the target user key into the preset Bloom filter to obtain an output result of the preset Bloom filter;

[0022] If the output result is 0, executing the step of determining that the point query request is an empty query;

[0023] If the output result is a negative number, the step of using the logical key corresponding to the target user key to retrieve the user value corresponding to the target user key from the storage device of the preset key-value database is performed;

[0024] If the output result is a positive number, the step of determining the physical key corresponding to the target user key according to the aggregate record is performed.

[0025] On the other hand, before obtaining the point query request of the preset key-value database, the method further includes:

[0026] When the preset key-value database is started, the preset Bloom filter is constructed.

[0027] On the other hand, when the preset key-value database is started, constructing the preset Bloom filter includes:

[0028] pass , allocating the memory occupied by each level of the preset Bloom filter; wherein, N is the number of stages of the preset Bloom filter, M is the total memory occupied by the presets in the preset Bloom filter, M i is the first i The memory occupied by the Bloom filter of level 1, i =0,1… N- 1, n =1,2... N .

[0029] In another aspect, the method further comprises:

[0030] Obtaining a range query request of the preset key-value database; wherein the range query request includes range length specifying information;

[0031] According to the range query request, when the iterator is used to retrieve the user value in the key-value pair of the first iteration from the storage device, the user value corresponding to the range length specified information is pre-fetched from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory.

[0032] In another aspect, the range length designation information includes designating a timestamp range, or the range length designation information includes designating a first iteration user key and designating a scan length.

[0033] In another aspect, the method further comprises:

[0034] Obtaining a range query request for the preset key-value database;

[0035] If it is detected that the key index has an aggregate record of the logical key corresponding to the current user key of the range query request, then determine the physical key corresponding to the current user key according to the aggregate record of the logical key corresponding to the current user key; wherein the current user key is the user value in the key-value pair of the current iteration of the iterator of the range query request;

[0036] According to the physical key corresponding to the current user key, the logical key corresponding to the current user key is retrieved from the storage device, and other logical keys in the physical key corresponding to the current user key are cached from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory;

[0037] The user value corresponding to the current user key is retrieved from the storage device using the logical key corresponding to the current user key.

[0038] On the other hand, determining the physical key corresponding to the target user key according to the aggregated record includes:

[0039] According to the target serial number stored in the sorting string table of the preset key-value database, the physical key corresponding to the target user key stored in the storage device is determined; wherein the target serial number is the sorting serial number corresponding to the physical key in the aggregate record of the logical key corresponding to the target user key.

[0040] In another aspect, the method further comprises:

[0041] Obtaining a logical key of a key-value pair to be stored; wherein the logical key includes a user key and a user value in the key-value pair to be stored;

[0042] Identifying aggregatable keys in the logic keys; wherein the specification of each aggregatable key is smaller than the preset specification;

[0043] Aggregating the aggregatable keys to obtain physical keys, and storing aggregation records between each aggregatable key and the corresponding physical key in the key index; wherein the sum of the specifications of all aggregatable keys in each physical key pair is greater than or equal to the preset specification, and each aggregatable key is aggregated into a corresponding physical key;

[0044] The physical key is stored in the storage device.

[0045] On the other hand, the user key in the key-value pair to be stored includes the index node number and file name of the metadata file in the parent directory of the distributed storage system, and the user value in the key-value pair to be stored includes the index node number and file attributes, and the file attributes include at least one of the type, specification, permission bit and owner information.

[0046] The present invention also provides a computer program product, including a computer program / instruction, which implements the steps of the storage management method of the distributed storage system as described above when executed by a processor.

[0047] The present invention also provides a storage management device for a distributed storage system, comprising:

[0048] Memory for storing computer programs;

[0049] A processor is used to implement the steps of the storage management method of the distributed storage system as described above when executing the computer program.

[0050] In addition, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the storage management method of the distributed storage system as described above are implemented.

[0051] A storage management method for a distributed storage system provided by the present invention comprises: obtaining a point query request of a preset key-value database; wherein the point query request comprises a target user key; detecting whether there is an aggregate record of a logical key corresponding to the target user key in the key index of the preset key-value database; wherein the aggregate record stores the correspondence between a logical key having a specification smaller than a preset specification and a corresponding physical key, and the specification of the physical key is greater than or equal to the preset specification; if not, using the logical key corresponding to the target user key to retrieve a user value corresponding to the target user key from a storage device of the preset key-value database; if yes, determining the physical key corresponding to the target user key according to the aggregate record; retrieving the logical key corresponding to the target user key from the storage device according to the physical key corresponding to the target user key, and retrieving the user value corresponding to the target user key from the storage device using the logical key corresponding to the target user key.

[0052] It can be seen that the present invention aggregates multiple smaller logical keys into a larger physical key, realizes the conversion from logical keys to physical keys, can generate higher write throughput and reduce the number of physical keys in the storage device that needs to be managed, thereby saving memory and hardware resources of the storage device; and through the aggregation record of the logical key saved in the key index, it can be conveniently confirmed whether the logical key is stored in the aggregated physical key or directly stored, so that the corresponding physical key can be queried when stored in the physical key, and the corresponding user value can be queried through the physical key to realize the range query of the logical key, and the corresponding user value can be directly searched from the storage device when directly stored, reducing the indexing process of the physical key, reducing the overhead of the key index query, improving the performance of the distributed storage system, and improving the efficiency of the key value query. In addition, the present invention also provides a storage management device, program product and medium for a distributed storage system, which also have the above-mentioned beneficial effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0054] Figure 1 A flow chart of a storage management method for a distributed storage system provided by an embodiment of the present invention;

[0055] Figure 2 A schematic diagram of the overall architecture of a distributed storage system provided by an embodiment of the present invention;

[0056] Figure 3 A schematic diagram of a logical key aggregation process provided by an embodiment of the present invention;

[0057] Figure 4 A schematic diagram of a key index retrieval process provided by an embodiment of the present invention;

[0058] Figure 5 A schematic diagram of an index detection process for bypassing key conversion provided by an embodiment of the present invention;

[0059] Figure 6 A flowchart of another storage management method for a distributed storage system provided by an embodiment of the present invention;

[0060] Figure 7 A simplified structural diagram of a storage management device of a distributed storage system provided by an embodiment of the present invention;

[0061] Figure 8 A schematic diagram of the specific structure of a storage management device of a distributed storage system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0062] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution 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 are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0063] Please refer to Figure 1 , Figure 1 A flow chart of a storage management method for a distributed storage system provided by an embodiment of the present invention. The method may include:

[0064] Step 101: Obtain a point query request of a preset key-value database; wherein the point query request includes a target user key.

[0065] It can be understood that the preset key-value database in this embodiment can be a key-value storage engine database of a pre-set distributed storage system, that is, a Key-Value database in the object metadata storage. The point query request in this step can be a request for point query, and the point query refers to querying the corresponding value (Value, i.e., user value) according to the specified key (Key, i.e., target user key).

[0066] Among them, Figure 2As shown, the architecture of the distributed storage system may include multiple components, such as object gateway service, block device service, file system service, unified, self-controlled, and scalable distributed storage consistency management system, storage pool, controllable, scalable, distributed data balanced placement algorithm, metadata cluster, monitoring service cluster, and storage backend engine.

[0067] Correspondingly, the object gateway service, block device service and file system service can provide a unified storage interface to provide access interface services for the clients of the distributed storage system. The unified, self-controlled and scalable distributed storage consistency management system is the core component of the distributed storage cluster. It provides distributed storage services in the form of objects. In this component, data is stored as objects, and each object has a unique identifier and related data. It is responsible for distributing objects on various storage nodes of the storage cluster and providing data replication, recovery, load balancing and other functions to ensure data reliability and high-performance access. The distributed storage system consists of multiple storage nodes, each of which can contain multiple storage devices (such as hard disks and disks); the storage pool divides storage resources to form different pools to meet different storage requirements. The controllable, scalable and distributed data balancing placement algorithm component can evenly distribute data objects on various nodes of the system to avoid data hot spots and improve system performance. The metadata cluster is responsible for managing the metadata information of the file system, including the attributes and locations of files and directories; the monitoring service cluster is responsible for monitoring the status and configuration information of the cluster. Its technical principles include maintaining the status information, configuration information, health status, etc. of the cluster to ensure the consistency and availability of the cluster.

[0068] Correspondingly, the storage backend engine may be a software module optimized by the present embodiment, which may be a backend object library of the object storage daemon process, and realizes management of the raw device through the allocator, and can save the object data to the storage device of the distributed storage node, such as a disk and a solid state drive, etc.; at the same time, a key-value database is used to save the object metadata, and then the key-value data interface is converted into a file system interface through a conversion interface, and is stored in the underlying storage device after being arranged by the file system; wherein, the Key (i.e., the user key) in the key-value pair saved by the preset key-value database may include the index node number and file name of the metadata file of the distributed storage system in the parent directory, such as the inode number (index node number) and file name of the 64-bit parent directory with a variable length, and the Value (i.e., the user value) may include the inode number of the file and various file attributes of the file (such as type, specification, permission bit and owner information, etc.). The preset key-value database manages the mapping from the object name to the block position on the disk. Since the database needs to rely on the file system and cannot directly interact with the raw device, the underlying layer of the object storage engine encapsulates a file system for connecting the database with the raw device of the underlying storage node.

[0069] It should be noted that the target user key in this embodiment may be a specified user key whose corresponding user value needs to be queried. The specific method for obtaining the point query request of the preset key-value database in this step can be set by the designer according to the practical scenario and user needs, such as being implemented in the same or similar manner as the method for obtaining the point query request of the key-value database in the prior art. For example, in this embodiment, the following application program interface (API) can be defined for the preset key-value database, including: get(k,v), to obtain Value from Key, for point query; put(k,v), to insert a new key-value pair; delete(k), to delete the key-value pair; Iterator(): an iterator for range query; seek(k), to move the iterator to the first key-value pair, where the Key of the range query is greater than or equal to seek(k); next(), to move the iterator to the next key-value pair; valid(), to indicate whether the iterator is valid; key(), to return the key of the current iterator; value(), to return the value of the current iterator; hint.scan_length, to specify a user prompt for the scan length; in this embodiment, after obtaining the point query request, a get operation (i.e., a point query operation) can be triggered to query the user value corresponding to the target user key.

[0070] Step 102: Check whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database; if not, proceed to step 103; if yes, proceed to step 104.

[0071] The aggregation records store the correspondence between logical keys whose specifications are smaller than the preset specifications and corresponding physical keys, and the specifications of the physical keys are greater than or equal to the preset specifications.

[0072] It can be understood that in a Key-Value storage system, a record is a key-value pair data item stored in a key-value database (i.e., a preset key-value database), and is the basic unit of key-value storage and operation; by using a unique key (such as a logical key) to access and update the corresponding value, efficient data storage, retrieval, and query can be achieved. The content of a record can contain various types of data, such as text, numbers, JSON, etc., and has strong flexibility and versatility.

[0073] That is to say, the logical key in this embodiment can be a unique data item corresponding to the key-value pair stored in the preset key-value database, that is, a Key-Value record; each logical key can include a user key and a user value in the corresponding key-value pair; Figure 3As shown, the logical key may include the user key and corresponding specification information (such as Key size, key specification) and the user value and corresponding specification information (such as Value size, value specification) in the corresponding key-value pair to facilitate the retrieval of the user key and user value in the logical key.

[0074] Accordingly, in this embodiment, for the Key-Value records of massive small IO (input and output) requests, that is, some query retrieval byte-level I / Os that are smaller than the preset specifications (such as 4KB), these smaller Key-Value records are aggregated into a single physical record (i.e., physical key) to generate better write throughput and reduce the impact on performance and maintenance management costs when a large number of keys (i.e., logical keys) are generated by small IO requests. In this embodiment, a key index is used to record the mapping of logical keys to physical keys to provide a range query function for logical keys.

[0075] For example, if Figure 3 The conversion process of logical keys and physical keys in the preset key-value database shown in the figure, the size of each logical key (logical keys 1-4) is less than 4KB (i.e., the preset size); in the mapping relationship of the key index record, logical keys 1-4 are aggregated into physical key 1, and the aggregated physical key 1 is greater than or equal to 4KB; physical key 1 can include the user key (user key) corresponding to each logical key and the corresponding key size and the user value and the corresponding value size, which are combined into the actual key-value request pair of the application. Accordingly, in this embodiment, for logical keys smaller than the preset size, the logical key and the user key are used to convert into the application's Key (i.e., the physical key), and the physical key is defined as the actual Key written to the storage device using the KV interface.

[0076] It should be noted that in this embodiment, the key index is used to record the aggregate record of the conversion from the logical key to the physical key to identify whether the logical key is stored in the aggregated physical key or directly stored, and the mapping relationship between the logical key and the corresponding physical key. Figure 4As shown, the key index of the preset key-value database may include a memtable (memory table) and multiple sstables (Sorted Strings Table) sorted based on logical keys and lists. The memtable is a memory table used for fast write operations. sstable is an immutable, sorted, and persistent Key-Value Map, where Key and Value are both strings of arbitrary bytes. sstable provides operations for finding the Value corresponding to a specific Key value, as well as operations for finding all Key-Values ​​within a given range, such as finding user values ​​to logical keys and logical keys to physical keys. sstable is a persistent file format used to obtain memory data stored in memtable, sort it for fast access, and store it in a set of persistent, ordered, and immutable files on disk. For sstable storage, this embodiment can use a separate storage device to store each data block and index block. The key of the data block is the sstable number (such as the sorting sequence number on the sstable) plus an offset, such as the logical key and physical key in the storage device. Each index block has a separate device KV pair, using the sstable number as the key, and its value contains the key range information and offset of each data block to index to the corresponding logical key and physical key.

[0077] Among them, in this embodiment, by detecting whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database, it can be detected and determined whether the logical key corresponding to the target user key is an aggregated physical key or directly stored, thereby bypassing the conversion process from logical key to physical key when directly storing, reducing the overhead of key index query.

[0078] Correspondingly, the specific method for detecting whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database in this step can be set by the designer, such as directly querying the aggregate record of the logical key corresponding to the target user key in the key index. In order to further reduce the overhead of key index query and reduce the occupation of CPU (central processing unit) and memory resources, the bloom filter can be used in this embodiment to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index, avoiding direct query of the key index; the bloom filter is a data structure, a relatively clever probabilistic data structure, characterized by efficient insertion and query, which can be used to retrieve whether an element is in a set, with high retrieval efficiency and less space occupation. That is to say, in this step, the preset bloom filter can be used to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database; if not, then enter step 103; if so, then enter step 104. This embodiment does not impose any restrictions on this.

[0079] For example, if Figure 5 As shown, when processing the get operation corresponding to the point query request, it first passes through the Bloom filter (i.e., the preset Bloom filter), such as inputting the target user key or the corresponding logical key information into the preset Bloom filter; if the filter returns a negative number, the queried logical key does not need to be converted to the corresponding physical key, and the corresponding user value can be directly retrieved from the storage device; if the return is a positive number, the key index can be queried to find the corresponding physical key; accordingly, when processing the Iterator operation corresponding to the range query request, the Bloom filter can also be used to query whether there is an aggregate record of the corresponding logical key.

[0080] It should be noted that the preset Bloom filter can map data to the bit array using the bit array and hash function, and determine whether the data exists by checking the value of the corresponding position in the bit array, so as to quickly and efficiently confirm whether the logical key is in the aggregated physical key or directly stored. Furthermore, in this embodiment, the preset Bloom filter can also be used to detect the empty point query and range query, such as detecting whether the logical key 1 exists and detecting whether the logical keys 14-16 exist; thereby realizing the detection of empty queries, so as to avoid the waste of resources, log pollution, security vulnerabilities and difficulty in error diagnosis caused by empty queries.

[0081] For example, in this step, a preset Bloom filter may be used to detect whether there is logic key information corresponding to the target user key in the key index; if there is no logic key information corresponding to the target user key, it is determined that the point query request is an empty query, and the point query request may be terminated or discarded; if there is logic key information corresponding to the target user key, it is detected whether there is an aggregate record of the logic key corresponding to the target user key in the key index of the preset key value database; if there is no aggregate record, step 103 is entered; if there is an aggregate record, step 104 is entered. For example, in this step, the target user key may be input into the preset Bloom filter to obtain the output result of the preset Bloom filter; if the output result is 0, it is determined that the point query request is an empty query; if the output result is a negative number, step 103 is entered; if the output result is a positive number, step 104 is entered.

[0082] Among them, the preset Bloom filter in this embodiment can adopt a compressed structure, which occupies very little space and can be stored in memory, which does not occupy resources and has high performance. In order to avoid the problem of low efficiency of Bloom filters in processing range queries in related technologies, the preset Bloom filter in the embodiment of the present invention can adopt a lightweight optimized and improved Bloom filter to accelerate the empty query detection of point queries and range queries. Accordingly, unlike the stored filter for each sorting operation, the filter data of the preset Bloom filter in this embodiment may not be stored in the storage device, but the preset Bloom filter is dynamically constructed each time the preset key-value database is started, so that the preset key-value database can separate the sorted key index from the value storage, and the dynamically constructed filter can adapt to rapidly changing workloads more flexibly. That is to say, before step 101 in this embodiment, it can also include a process of constructing a preset Bloom filter when the preset key-value database is started.

[0083] Furthermore, due to the shorter prefix length, high-level filters may contain fewer different keys and may require less filter memory. In this embodiment, the following strategy may be used to allocate the memory usage of the preset Bloom filter:

[0084] , i =0,1… N- 1;

[0085] in, N is the preset number of Bloom filter levels, M is the total memory occupied by the presets in the preset Bloom filter. M i The first i The memory occupied by the Bloom filter.

[0086] That is to say, in the process of constructing the preset Bloom filter, , allocate the memory occupied by each level of the preset Bloom filter; among them, N is the preset number of Bloom filter levels, M is the total memory occupied by the presets in the preset Bloom filter. M i The first i The memory occupied by the Bloom filter of level 1, i =0,1… N- 1, n =1,2... N .

[0087] Step 103: using the logical key corresponding to the target user key, retrieve the user value corresponding to the target user key from the storage device of the preset key-value database.

[0088] Among them, in this step, when there is no aggregate record of the logical key corresponding to the target user key in the key index, that is, when the logical key corresponding to the target user key is not stored in the form of a physical key, the logical key corresponding to the target user key can be used to directly retrieve the user value corresponding to the target user key from the storage device of the preset key-value database. For example, it can be implemented in the same or similar manner as the conventional value retrieval method in the related art, so as to directly retrieve the corresponding user value from the storage device through the logical key, that is, use the value in the key-value pair stored in the preset key-value database; for example, in this step, the corresponding logical key information can be obtained according to the target user key; according to the logical key information, the user value in the corresponding logical key is retrieved from the storage device.

[0089] Step 104: Determine the physical key corresponding to the target user key according to the aggregated record.

[0090] It can be understood that in this step, when there is no aggregate record of the logical key corresponding to the target user key in the key index, that is, when the logical key corresponding to the target user key is stored in the form of an aggregated physical key, the physical key corresponding to the logical key stored in the storage device can be determined based on the aggregate record of the logical key, so as to retrieve the logical key corresponding to the target user key from the physical key; that is, the aggregate record of the logical key can also include a mapping relationship between the logical key and the corresponding physical key.

[0091] Correspondingly, the specific method of determining the physical key corresponding to the target user key according to the aggregated record in this step can be set by the designer, such as Figure 4As shown, when the key index is stored in a persistent sorting string table, in this step, the physical key corresponding to the target user key stored in the storage device can be determined according to the target serial number stored in the sorting string table of the preset key value database; wherein the target serial number is the sorting serial number corresponding to the physical key in the aggregate record of the logical key corresponding to the target user key, and the key index can also include a mapping relationship between the target user key and the corresponding logical key to determine the logical key corresponding to the target user key.

[0092] Step 105: According to the physical key corresponding to the target user key, the logical key corresponding to the target user key is retrieved from the storage device, and the user value corresponding to the target user key is retrieved from the storage device using the logical key corresponding to the target user key.

[0093] It can be understood that in this step, based on the physical key corresponding to the determined target user key, that is, the physical key that stores the logical key corresponding to the target user key, the logical key corresponding to the target user key in the physical key can be retrieved from the storage device, thereby retrieving the user value corresponding to the target user key in the logical key.

[0094] like Figure 4 As shown in the figure, in the key index, logical keys such as logical key 1, logical key 7, and logical key 12 do not have corresponding aggregate records. The corresponding user values ​​can be directly retrieved from the underlying storage device (underlying storage device) through the logical keys, such as logical key 1 can retrieve user value 31, and logical key 7 can retrieve user value 7; logical key 3 and logical key 21 have aggregate records, and the corresponding physical keys are physical key 12 and physical key 3 respectively. The corresponding values ​​can be retrieved through key conversion; key conversion can be located by adding the sstable number (that is, the sorting sequence number of the sorted string table) to the offset, such as Figure 4 The sorting number (sstable number) of the sstable table corresponding to the logical keys 1 to 21, another sorting number of the same sstable table corresponding to the logical keys 31 to 74, the value (Value) converted from the physical key 12 can be the logical key 3 and the logical key 52, and the value converted from the physical key 3 can be the logical key 21 and the logical key 47, so as to realize the conversion between the physical key and the corresponding logical key. That is to say, in this step, the physical key corresponding to the target user key can be converted to obtain the logical key corresponding to the target user key in the storage device, so that the user value corresponding to the target user key in the logical key can be retrieved from the storage device.

[0095] It should be noted that this embodiment is demonstrated by taking the processing of a point query request of a preset key-value database in a distributed storage system as an example. The processing of other requests of the preset key-value database (such as range query requests and key-value pair addition and deletion requests) can be implemented in the same or similar manner as the method provided in this embodiment, and this embodiment does not impose any restrictions on this. Figure 4 As shown in the figure, similar to the get operation of the point query request, the Iterator operation (iterator operation) of the range query request can also pass through the Bloom filter (that is, the preset Bloom filter); and the put operation (insert operation) of the new request and the delete operation of the delete request (delete operation) can pass through the memory table (memtable) to complete the addition and deletion of key-value pairs.

[0096] Furthermore, since range queries (such as data retrieval analysis and traversal queries, etc.) need to first query the index to determine the target key (such as the logical key) in the query range, then, if the user also requests to obtain the user value, it is necessary to retrieve the value related to the target key separately, which requires additional I / O to satisfy the range query; secondly, since the smaller logical keys will undergo the Key conversion from logical keys to physical keys, for some point queries, the corresponding user values ​​cannot be directly retrieved using logical keys; in this case, the point query performance will be affected by the additional I / O used for index lookup. In this embodiment, the retrieval delay can be reduced by pre-fetching the user value (Value);

[0097] For example, the method provided in this embodiment may also include obtaining a range query request of a preset key-value database; wherein the range query request includes range length specification information; according to the range query request, when using an iterator to retrieve the user value in the key-value pair of the first iteration from the storage device, the user value corresponding to the range length specification information is pre-fetched from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory. That is to say, in this embodiment, a range length option can be designed for the range query to pre-fetch the user value (Value) of the specified range length in advance, which is convenient for subsequent queries. Among them, the range length specification information may include a specified timestamp range, such as querying the event between two timestamps, and the Value between the two timestamps can be extracted in advance; the range length specification information may also specify the first iteration user key (such as the above-mentioned seek(k)) and the specified scan length (such as the above-mentioned hint.scan_length). For example, in a table scan query, the number of entries in the table to be queried by the user can be understood according to the specified scan length, so as to extract the Value of the specified scan length in advance.

[0098] Accordingly, in this embodiment, a pre-fetch throttle mechanism may be designed for range query to prevent pre-fetching of too many values ​​and avoid waste of resources, such as limiting the number of requests or space occupied by pre-fetched values. This embodiment does not impose any restrictions on this.

[0099] Correspondingly, in this embodiment, the temporal locality of logical key aggregation can also be utilized to write adjacent aggregated records (in the defined key order) together, and can be aggregated into a single physical record. When performing a range query, after traversing the key index to find the physical key mapped to the target user key, other records aggregated in the same physical record can be cached. When next() and value() are called for the next iteration, the cache can be hit and the Value can be directly returned without issuing an I / O request to the device. For example, the method provided by this embodiment may also include obtaining a range query request from a preset key-value database; if the detected key index contains an aggregate record of the logical key corresponding to the current user key of the range query request, then determining the physical key corresponding to the current user key based on the aggregate record of the logical key corresponding to the current user key; wherein the current user key is the user value in the key-value pair of the current iteration of the iterator of the range query request; according to the physical key corresponding to the current user key, retrieving the logical key corresponding to the current user key from the storage device, and caching other logical keys in the physical key corresponding to the current user key from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory; using the logical key corresponding to the current user key, retrieving the user value corresponding to the current user key from the storage device.

[0100] Furthermore, the method provided in this embodiment may also include update and delete operations on aggregate records of logical keys in the key index. For example, a local update mechanism is first used, which requires a read-modify-write operation on the aggregate record; then, a new physical key is assigned to the updated aggregate record to maintain efficient write throughput and implement the update of the physical key. A background garbage collection mechanism may be applied to clean up outdated aggregate records.

[0101] In this embodiment, the embodiment of the present invention realizes the conversion of logical keys to physical keys by aggregating multiple smaller logical keys into larger physical keys, which can produce higher write throughput and reduce the number of physical keys in the storage device that needs to be managed, thereby saving memory and hardware resources of the storage device; and through the aggregation record of the logical keys saved in the key index, it can be conveniently confirmed whether the logical key is stored in the aggregated physical key or directly stored, so that the corresponding physical key can be queried when stored in the physical key, and the corresponding user value can be queried through the physical key to realize range query of the logical key, and the corresponding user value can be directly searched from the storage device when directly stored, thereby reducing the indexing process of the physical key, reducing the overhead of the key index query, improving the performance of the distributed storage system, and improving the efficiency of key value query.

[0102] Based on the above embodiment, the present invention also provides another storage management method of a distributed storage system to implement the storage of key-value pairs. Figure 6 , the method may include:

[0103] Step 201: Obtain a logical key of a key-value pair to be stored; wherein the logical key includes a user key and a user value in the key-value pair to be stored.

[0104] Among them, the key value to be stored in this embodiment can be a key-value pair that needs to be stored in a preset key-value database, and the user key in the key-value pair to be stored includes the index node number and file name of the metadata file in the parent directory of the distributed storage system, such as the inode number (index node number) and file name of the metadata file in the variable-length 64-bit parent directory; the user value in the key-value pair to be stored includes the index node number and file attributes, and the file attributes include at least one of the type, specification, permission bit and owner information.

[0105] It can be understood that the logical key in this embodiment can be a key-value pair data item to be stored in a preset key-value database. The specific method for obtaining the logical key of the key-value pair to be stored in this embodiment can be set by the designer, such as using the same or similar method as the method for obtaining the key corresponding to the key-value pair stored in the key-value database in the related art, and this embodiment does not impose any restrictions on this.

[0106] Step 202: Identify aggregatable keys in the logic keys; wherein the size of each aggregatable key is smaller than a preset size.

[0107] The aggregatable key in this embodiment may be a logical key having a size smaller than a preset size (eg, 4 KB).

[0108] Step 203: Aggregate the aggregatable keys to obtain physical keys, and store the aggregation records between each aggregatable key and the corresponding physical key in the key index; wherein the sum of the specifications of all aggregatable keys in each physical key pair is greater than or equal to the preset specification, and each aggregatable key is aggregated into a corresponding physical key.

[0109] It can be understood that in this step, logical keys with specifications smaller than the preset specifications can be aggregated into physical keys greater than or equal to the preset specifications, thereby realizing the aggregation of smaller logical keys into physical keys, and through the aggregation records of logical keys stored in the key index, the key management overhead in the underlying storage device can be reduced.

[0110] Accordingly, in this step, the aggregatable keys can be aggregated in the memory to obtain corresponding physical keys, thereby avoiding the impact on the underlying storage device.

[0111] Step 204: Store the physical key in a storage device.

[0112] In this step, the physical keys obtained after the logical keys are aggregated can be stored in the underlying storage device of the preset key-value database to complete the storage of the key values ​​to be stored.

[0113] Accordingly, the storage of key-value pairs corresponding to logical keys with specifications greater than or equal to the preset specifications in this embodiment, that is, the storage of key-value pairs corresponding to logical keys other than the aggregation key, can be set by the designer according to the usage scenario and user needs, such as being implemented in the same or similar manner as the conventional key-value pair storage in the related art, such as directly storing these logical keys in a storage device, and recording the corresponding relationship between the key-value pairs to be stored and the corresponding logical keys. This embodiment does not impose any restrictions on this.

[0114] Corresponding to the above method embodiment, an embodiment of the present invention further provides a storage management device for a distributed storage system. The storage management device for a distributed storage system described below and the storage management method for a distributed storage system described above can refer to each other.

[0115] Please refer to Figure 7 , Figure 7 A simplified structural diagram of a storage management device of a distributed storage system provided by an embodiment of the present invention. The storage management device may include:

[0116] A memory D1, for storing computer programs;

[0117] The processor D2 is used to implement the steps of the storage management method of the distributed storage system provided by the above method embodiment when executing the computer program.

[0118] Accordingly, please refer to Figure 8 , Figure 8 A specific structural diagram of a storage management device of a distributed storage system provided in an embodiment of the present invention. The storage management device 310 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 322 (for example, one or more processors) and memory 332, and one or more storage media 330 (for example, one or more mass storage devices) storing application programs 342 or data 344. Among them, the memory 332 and the storage medium 330 can be short-term storage or permanent storage. The program stored in the storage medium 330 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations on the host. Furthermore, the central processor 322 can be configured to communicate with the storage medium 330 and execute a series of instruction operations in the storage medium 330 on the storage management device 310.

[0119] The storage management device 310 may further include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input and output interfaces 358, and / or one or more operating systems 341, such as Linux system.

[0120] The storage management device 310 in this embodiment may specifically be a device corresponding to a preset key-value database in a distributed storage system, such as a server or storage device running a preset key-value database.

[0121] The steps in the storage management method of the distributed storage system described above can be implemented by the structure of the storage management device of the distributed storage system.

[0122] Corresponding to the above method embodiment, the embodiment of the present invention further provides a computer program product. The computer program product described below and the storage management method of a distributed storage system described above can be referred to each other.

[0123] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of the storage management method for a distributed storage system provided by the above method embodiment.

[0124] Corresponding to the above method embodiment, an embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium described below and the storage management method of a distributed storage system described above can be referred to each other.

[0125] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the storage management method of the distributed storage system of the above method embodiment.

Claims

1. A storage management method for a distributed storage system, It is characterized in that include: Obtaining a point query request of a preset key-value database; wherein the point query request includes a target user key; Detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database; wherein the aggregate record stores the correspondence between the logical key with a specification smaller than the preset specification and the corresponding physical key, and the specification of the physical key is greater than or equal to the preset specification; If not, using the logical key corresponding to the target user key, retrieving the user value corresponding to the target user key from the storage device of the preset key-value database; If yes, determining the physical key corresponding to the target user key according to the aggregate record; According to the physical key corresponding to the target user key, the logical key corresponding to the target user key is retrieved from the storage device, and the user value corresponding to the target user key is retrieved from the storage device using the logical key corresponding to the target user key.

2. The storage management method of the distributed storage system according to claim 1, It is characterized in that The detecting whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes: By using a preset Bloom filter, it is detected whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database.

3. The storage management method of the distributed storage system according to claim 2, It is characterized in that The using a preset Bloom filter to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes: Using the preset Bloom filter, detecting whether there is logic key information corresponding to the target user key in the key index; If there is no logical key information corresponding to the target user key, determining that the point query request is an empty query; If there is logic key information corresponding to the target user key, detecting whether there is an aggregate record of the logic key corresponding to the target user key in the key index of the preset key-value database; If the aggregate record does not exist, performing the step of using the logical key corresponding to the target user key to retrieve the user value corresponding to the target user key from the storage device of the preset key-value database; If the aggregation record exists, the step of determining the physical key corresponding to the target user key according to the aggregation record is performed.

4. The storage management method of the distributed storage system according to claim 3, It is characterized in that The using a preset Bloom filter to detect whether there is an aggregate record of the logical key corresponding to the target user key in the key index of the preset key-value database includes: Inputting the target user key into the preset Bloom filter to obtain an output result of the preset Bloom filter; If the output result is 0, executing the step of determining that the point query request is an empty query; If the output result is a negative number, the step of using the logical key corresponding to the target user key to retrieve the user value corresponding to the target user key from the storage device of the preset key-value database is performed; If the output result is a positive number, the step of determining the physical key corresponding to the target user key according to the aggregate record is performed.

5. The storage management method of the distributed storage system according to claim 2, It is characterized in that Before obtaining the point query request of the preset key-value database, the method further includes: When the preset key-value database is started, the preset Bloom filter is constructed.

6. The storage management method of the distributed storage system according to claim 5, It is characterized in that When the preset key-value database is started, constructing the preset Bloom filter includes: pass , allocating the memory occupied by each level of the preset Bloom filter; wherein, N is the number of stages of the preset Bloom filter, M is the total memory occupied by the presets in the preset Bloom filter, M i is the first i The memory occupied by the Bloom filter of level 1, i =0,1… N- 1, n =1,2… N .

7. The storage management method of a distributed storage system according to claim 1, It is characterized in that Also includes: Obtaining a range query request of the preset key-value database; wherein the range query request includes range length specifying information; According to the range query request, when the iterator is used to retrieve the user value in the key-value pair of the first iteration from the storage device, the user value corresponding to the range length specified information is pre-fetched from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory.

8. The storage management method of the distributed storage system according to claim 7, It is characterized in that The range length designation information includes designating a timestamp range, or the range length designation information includes designating a first iteration user key and designating a scan length.

9. The storage management method of a distributed storage system according to claim 1, It is characterized in that Also includes: Obtaining a range query request for the preset key-value database; If it is detected that the key index has an aggregate record of the logical key corresponding to the current user key of the range query request, then determine the physical key corresponding to the current user key according to the aggregate record of the logical key corresponding to the current user key; wherein the current user key is the user value in the key-value pair of the current iteration of the iterator of the range query request; According to the physical key corresponding to the current user key, the logical key corresponding to the current user key is retrieved from the storage device, and other logical keys in the physical key corresponding to the current user key are cached from the storage device to the memory, so that the iterator obtains the user value in the key-value pair of the next iteration from the memory; The user value corresponding to the current user key is retrieved from the storage device using the logical key corresponding to the current user key.

10. The storage management method of a distributed storage system according to claim 1, It is characterized in that The determining, according to the aggregated record, a physical key corresponding to the target user key includes: According to the target serial number stored in the sorting string table of the preset key-value database, the physical key corresponding to the target user key stored in the storage device is determined; wherein the target serial number is the sorting serial number corresponding to the physical key in the aggregate record of the logical key corresponding to the target user key.

11. The storage management method of a distributed storage system according to any one of claims 1 to 10, It is characterized in that Also includes: Obtaining a logical key of a key-value pair to be stored; wherein the logical key includes a user key and a user value in the key-value pair to be stored; Identifying aggregatable keys in the logic keys; wherein the specification of each aggregatable key is smaller than the preset specification; Aggregating the aggregatable keys to obtain physical keys, and storing aggregation records between each aggregatable key and the corresponding physical key in the key index; wherein the sum of the specifications of all aggregatable keys in each physical key pair is greater than or equal to the preset specification, and each aggregatable key is aggregated into a corresponding physical key; The physical key is stored in the storage device.

12. The storage management method of the distributed storage system according to claim 11, It is characterized in that The user key in the key-value pair to be stored includes the index node number and file name of the metadata file in the parent directory of the distributed storage system, and the user value in the key-value pair to be stored includes the index node number and file attributes, and the file attributes include at least one of the type, specification, permission bit and owner information.

13. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instruction is executed by a processor, the steps of the storage management method of the distributed storage system as described in any one of claims 1 to 12 are implemented.

14. A storage management device for a distributed storage system, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the storage management method for a distributed storage system as claimed in any one of claims 1 to 12 when executing the computer program.

15. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the storage management method of the distributed storage system according to any one of claims 1 to 12 are implemented.