Metadata retrieval method, system, terminal and storage medium

By creating in-memory data structures and third-party databases in the distributed file system, and using asynchronous threads for metadata retrieval, it solves the difficulty of metadata classification retrieval and the problem of large MDS lock occupation, and achieves fast and low-overhead metadata retrieval.

CN114490527BActive Publication Date: 2024-09-17INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111342936.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-12
Publication Date
2024-09-17
Estimated Expiration
2041-11-12

AI Technical Summary

Technical Problem

In a distributed file system, metadata classification retrieval cannot be performed directly based on the metadata information of files or directories (information other than file names), and global retrieval of files requires a large MDS lock, resulting in tens of billions of files. The retrieval cost is unacceptable.

Method used

By creating an in-memory data structure and binding a third-party database, asynchronously synchronizes metadata information, and uses asynchronous threads to retrieve target metadata from the in-memory data structure and cache, avoiding the need to occupy large MDS locks and achieving fast retrieval of metadata.

Benefits of technology

It achieves fast metadata retrieval under tens of billions of files, and rich classification condition search, significantly reducing the overhead of distributed file system resources for file classification retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490527B
    Figure CN114490527B
Patent Text Reader

Abstract

The present invention relates to the field of distributed storage technology, and specifically provides a metadata retrieval method, system, terminal and storage medium, including: obtaining metadata information of all metadata, and saving all metadata information to a pre-created memory data structure; in response to a metadata retrieval request, a metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread; and searches for target metadata from the cache data of a metadata service management process or a metadata service process according to the target metadata information. The present invention can quickly search for metadata that meets conditions in a distributed storage system that meets the requirements of tens of billions of files; realizes richer classification condition searches; and significantly reduces the overhead of file classification retrieval on the entire distributed file system resources.
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 metadata retrieval method, system, terminal and storage medium. Background Art

[0002] In the current distributed file system, if you don't know more file information, but want to get the specific location and other information of a file based on the name of a file or directory, you need to retrieve the file from the system globally; if you want to perform metadata classification retrieval based on other metadata information besides the file name, such as the file or directory size, you cannot directly retrieve it under the current circumstances. In addition, file retrieval from distributed files currently requires the use of the MDS lock. During the file retrieval process, all other requests of the MDS must wait in line for the lock to be released before they can continue to be processed. If the current distributed file system has a file volume of tens of billions, then the cost of retrieving a file from the global level is unacceptable. Summary of the invention

[0003] In view of the above-mentioned deficiencies in the prior art, the present invention provides a metadata retrieval method, system, terminal and storage medium to solve the above-mentioned technical problems.

[0004] In a first aspect, the present invention provides a metadata retrieval method, comprising:

[0005] Get metadata information of all metadata and save all metadata information to a pre-created memory data structure;

[0006] In response to the metadata retrieval request, the metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread;

[0007] The target metadata is searched from the cache data of the metadata service management process or the metadata service process according to the target metadata information.

[0008] Furthermore, metadata information of all metadata is obtained and saved to a pre-created memory data structure, including:

[0009] Creating a memory data structure and binding the memory data structure to a third-party database;

[0010] Create a metadata monitoring process, update the metadata information if metadata update is detected, and synchronize the updated metadata information to the memory data structure, wherein the metadata information is used to record the node, file path, file size, and modification time of the metadata;

[0011] The memory data structure synchronously backs up the updated metadata information to a third-party database.

[0012] Further, in response to the metadata retrieval request, the metadata service management process is used to retrieve the target metadata information from the memory data structure, including:

[0013] Forwarding metadata retrieval requests received by each metadata service process to the metadata service management process;

[0014] The metadata service management process creates an asynchronous thread, which extracts search keywords from the metadata search request and queries the third-party database for matching target metadata information according to the search keywords.

[0015] Further, searching the target metadata from the cache data of the metadata service management process or the metadata service process according to the target metadata information includes:

[0016] Searching for associated metadata from cache data of the metadata service management process according to the target metadata information;

[0017] Determine whether the target metadata information completely corresponds to the management metadata:

[0018] If not, the cache data of each metadata service process is traversed until the metadata found completely corresponds to the target metadata information, and all the found metadata are summarized and returned to the upper layer application.

[0019] In a second aspect, the present invention provides a metadata retrieval system, comprising:

[0020] An information storage unit, used to obtain metadata information of all metadata and save all metadata information to a pre-created memory data structure;

[0021] An information retrieval unit, configured to respond to a metadata retrieval request, and the metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread;

[0022] The data retrieval unit is used to search for target metadata from the cache data of the metadata service management process or the metadata service process according to the target metadata information.

[0023] Furthermore, the information storage unit includes:

[0024] A storage building module, used to create a memory data structure and bind the memory data structure to a third-party database;

[0025] A data update module is used to create a metadata monitoring process. If a metadata update is detected, the metadata information will be updated and synchronized to the memory data structure. The metadata information is used to record the node, file path, file size, and modification time of the metadata.

[0026] The synchronous backup module is used for the memory data structure to synchronously back up the updated metadata information to a third-party database.

[0027] Furthermore, the information retrieval unit includes:

[0028] A request forwarding module, used to forward metadata retrieval requests received by each metadata service process to the metadata service management process;

[0029] The asynchronous retrieval module is used for the metadata service management process to create an asynchronous thread, the asynchronous thread extracts retrieval keywords from the metadata retrieval request, and searches for matching target metadata information from the third-party database according to the retrieval keywords.

[0030] Further, the data retrieval unit includes:

[0031] A first retrieval module, configured to search for associated metadata from cache data of a metadata service management process according to the target metadata information;

[0032] A search and judgment module is used to judge whether the target metadata information completely corresponds to the management metadata;

[0033] The second search module is used to traverse the cache data of each metadata service process until the found metadata completely corresponds to the target metadata information if the target metadata information does not completely correspond to the management metadata, and summarize all the found metadata and return them to the upper layer application.

[0034] In a third aspect, a terminal is provided, including:

[0035] processor, memory, wherein:

[0036] The memory is used to store computer programs.

[0037] The processor is used to call and run the computer program from the memory, so that the terminal executes the above-mentioned terminal method.

[0038] According to a fourth aspect, a computer storage medium is provided, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the methods described in the above aspects.

[0039] The beneficial effect of the present invention is that the metadata retrieval method, system, terminal and storage medium provided by the present invention can realize asynchronous and fast metadata based on the metadata service management process by constructing a memory data structure capable of storing all metadata information and using the metadata information as the basis for metadata retrieval. The present invention can quickly search for metadata that meets the conditions in a distributed storage system that meets the requirements of tens of billions of files; realizes richer classification condition search; and significantly reduces the overhead of file classification retrieval on the entire distributed file system resources.

[0040] In addition, the invention has a reliable design principle, a simple structure and a very broad application prospect. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] 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, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0042] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention.

[0043] Figure 2 is another schematic flow chart of a method according to an embodiment of the present invention.

[0044] Figure 3 is a schematic block diagram of a system according to an embodiment of the present invention.

[0045] Figure 4 A schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0046] In order to enable those skilled in the art to better understand the technical solutions in the present invention, 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 are only 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 should fall within the scope of protection of the present invention.

[0047] The key terms appearing in the present invention are explained below.

[0048] MDS.Metadata Server, short for metadata service in distributed file system.

[0049] OSD.Object Storage Device, responsible for responding to client requests and returning specific data. A distributed storage cluster generally has many OSDs.

[0050] Metadata: Data that records the attributes of a file or directory, which is data that describes the data.

[0051] MDS big lock. A data protection mechanism of MDS. When a request occupies the lock, other requests need to wait in line and wait for the request to release the MDS big lock before they can be processed.

[0052] Retrieval data. The data that records the specific file path, file size, modification time, etc. in the file metadata is part of the data in the file metadata that is related to retrieval and is part of the metadata.

[0053] Heat. An evaluation value of how often metadata is accessed. The higher the heat, the more likely it is that the metadata will be accessed within a period of time.

[0054] Figure 1 is a schematic flow chart of a method according to an embodiment of the present invention. Figure 1 The execution subject may be a metadata retrieval system.

[0055] like Figure 1 As shown, the method includes:

[0056] Step 110, obtaining metadata information of all metadata, and saving all metadata information to a pre-created memory data structure;

[0057] Step 120, in response to the metadata retrieval request, the metadata service management process retrieves the target metadata information from the memory data structure by creating an asynchronous thread;

[0058] Step 130: Search for target metadata from cache data of a metadata service management process or a metadata service process according to the target metadata information.

[0059] To facilitate understanding of the present invention, the metadata retrieval method provided by the present invention is further described below based on the principle of the metadata retrieval method of the present invention and in combination with the process of retrieving metadata in the embodiment.

[0060] For details, please refer to Figure 2 , the metadata retrieval method comprises:

[0061] S1. Obtain metadata information of all metadata and save all metadata information to a pre-created memory data structure.

[0062] Create a memory data structure and bind the memory data structure to a third-party database; create a metadata monitoring process, update the metadata information if metadata updates are monitored, and synchronize the updated metadata information to the memory data structure, where the metadata information is used to record the metadata node, file path, file size, and modification time; the memory data structure synchronizes and backs up the updated metadata information to the third-party database.

[0063] Specifically, a new memory data structure search_inode is created to record metadata information such as metadata inode, file path, file size, modification time, etc., so as to reduce space usage while ensuring that the retrieval rate is not affected. When the metadata in MDS changes, it needs to be synchronized to the search_inode management module, and the search_inode management module completes the update of the search_inode data corresponding to the metadata. A third-party database is introduced to record the search_inode data corresponding to all metadata in the entire distributed file system, so as to ensure that other processing threads of MDS are not affected when loading search_inode data from the underlying disk. When the metadata of a file changes, it needs to be synchronized to the search_inode management module. If the file is not hot enough, the search_inode management module will update it to the third-party database; all operations of the search_inode management module are performed asynchronously.

[0064] S2. In response to the metadata retrieval request, the metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread.

[0065] The metadata search request received by each metadata service process is forwarded to the metadata service management process; the metadata service management process creates an asynchronous thread, the asynchronous thread extracts search keywords from the metadata search request, and searches for matching target metadata information from the third-party database according to the search keywords.

[0066] Specifically, search_inode is managed only in the MDS process with a separate management function (there is only one MDS process with management function in a distributed file system, and there are multiple ordinary MDS processes). If other MDSs receive metadata retrieval requests, they are forwarded to the management MDS for processing; an asynchronous thread is created in the MDS process to execute the processing and management of metadata retrieval requests. During the entire process, the MDS big lock is not occupied, and the MDS's processing of other requests is not affected. Since the management of MDS search_inode data is not protected by the MDS big lock, search_inode is not absolutely real-time data; when a metadata retrieval request is received, the search_inode asynchronous processing module in the memory of the metadata service management process (management MDS) must first be used to process the request, and the module will asynchronously search for all eligible search_inode data from the underlying third-party database.

[0067] S3. Searching for target metadata from the cache data of the metadata service management process or the metadata service process according to the target metadata information.

[0068] According to the target metadata information, related metadata is searched from the cache data of the metadata service management process; whether the target metadata information completely corresponds to the management metadata is determined: if not, the cache data of each metadata service process is traversed until the found metadata completely corresponds to the target metadata information, and all the found metadata are summarized and returned to the upper-level application.

[0069] Specifically, there may be multiple retrieved search_inode data (files with the same name, or files that meet the same search condition, such as being larger than a certain file size, etc., that is, multiple metadata that meet the conditions may be retrieved for one metadata search); according to the data in search_inode, all corresponding metadata are searched in the metadata cache of the management MDS in turn. If it is not found, it is encapsulated into a request to search other MDSs (searching for a specific metadata does not require loading global metadata, and the overhead is relatively small); after a successful search, the search_inode management module summarizes the real-time metadata found and returns it to the upper-level application in a unified manner

[0070] like Figure 3 As shown, the system 300 includes:

[0071] The information storage unit 310 is used to obtain metadata information of all metadata and save all metadata information to a pre-created memory data structure;

[0072] The information retrieval unit 320 is used to respond to the metadata retrieval request, and the metadata service management process retrieves the target metadata information from the memory data structure by creating an asynchronous thread;

[0073] The data retrieval unit 330 is used to search for target metadata from the cache data of the metadata service management process or the metadata service process according to the target metadata information.

[0074] Optionally, as an embodiment of the present invention, the information storage unit includes:

[0075] A storage building module, used to create a memory data structure and bind the memory data structure to a third-party database;

[0076] A data update module is used to create a metadata monitoring process. If a metadata update is detected, the metadata information will be updated and synchronized to the memory data structure. The metadata information is used to record the node, file path, file size, and modification time of the metadata.

[0077] The synchronous backup module is used for the memory data structure to synchronously back up the updated metadata information to a third-party database.

[0078] Optionally, as an embodiment of the present invention, the information retrieval unit includes:

[0079] A request forwarding module, used to forward metadata retrieval requests received by each metadata service process to the metadata service management process;

[0080] The asynchronous retrieval module is used for the metadata service management process to create an asynchronous thread, the asynchronous thread extracts retrieval keywords from the metadata retrieval request, and searches for matching target metadata information from the third-party database according to the retrieval keywords.

[0081] Optionally, as an embodiment of the present invention, the data retrieval unit includes:

[0082] A first retrieval module, configured to search for associated metadata from cache data of a metadata service management process according to the target metadata information;

[0083] A search and judgment module is used to judge whether the target metadata information completely corresponds to the management metadata;

[0084] The second search module is used to traverse the cache data of each metadata service process until the found metadata completely corresponds to the target metadata information if the target metadata information does not completely correspond to the management metadata, and summarize all the found metadata and return them to the upper layer application.

[0085] Figure 4 The present invention provides a schematic diagram of the structure of a terminal 400 provided in an embodiment of the present invention. The terminal 400 may be used to execute the metadata retrieval method provided in an embodiment of the present invention.

[0086] The terminal 400 may include: a processor 410, a memory 420 and a communication unit 430. These components communicate via one or more buses. Those skilled in the art will appreciate that the server structure shown in the figure does not limit the present invention, and it may be a bus structure or a star structure, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0087] The memory 420 can be used to store the execution instructions of the processor 410. The memory 420 can be implemented by any type of volatile or non-volatile storage terminal or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. When the execution instructions in the memory 420 are executed by the processor 410, the terminal 400 can perform some or all of the steps in the following method embodiments.

[0088] The processor 410 is the control center of the storage terminal, and uses various interfaces and lines to connect various parts of the entire electronic terminal. It runs or executes software programs and / or modules stored in the memory 420, and calls data stored in the memory to perform various functions of the electronic terminal and / or process data. The processor can be composed of an integrated circuit (IC), for example, it can be composed of a single packaged IC, or it can be composed of a plurality of packaged ICs with the same or different functions. For example, the processor 410 can include only a central processing unit (CPU). In the embodiment of the present invention, the CPU can be a single computing core or multiple computing cores.

[0089] The communication unit 430 is used to establish a communication channel so that the storage terminal can communicate with other terminals, receive user data sent by other terminals or send user data to other terminals.

[0090] The present invention also provides a computer storage medium, wherein the computer storage medium may store a program, and when the program is executed, the program may include some or all of the steps in each embodiment provided by the present invention. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM).

[0091] Therefore, the present invention can realize asynchronous and fast metadata based on the metadata service management process by constructing a memory data structure capable of storing all metadata information and using the metadata information as the basis for metadata retrieval. The present invention can quickly search for metadata that meets the conditions in a distributed storage system with tens of billions of files; realizes more abundant classification condition searches; and significantly reduces the overhead of file classification retrieval on the entire distributed file system resources. The technical effects that can be achieved by this embodiment can be found in the above description and will not be repeated here.

[0092] Those skilled in the art can clearly understand that the technology in the embodiments of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the technical solution in the embodiments of the present invention, in essence or in other words, the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes, including several instructions for enabling a computer terminal (which can be a personal computer, a server, or a second terminal, a network terminal, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention.

[0093] In this specification, the same or similar parts between the various embodiments can be referred to each other. In particular, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description in the method embodiment.

[0094] In the several embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.

[0095] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0096] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0097] Although the present invention has been described in detail by referring to the accompanying drawings and in combination with the preferred embodiments, the present invention is not limited thereto. Without departing from the spirit and essence of the present invention, a person of ordinary skill in the art may make various equivalent modifications or substitutions to the embodiments of the present invention, and these modifications or substitutions shall be within the scope of the present invention. Any person of ordinary skill in the art may easily think of changes or substitutions within the technical scope disclosed by the present invention, and these shall be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.

Claims

1. A metadata retrieval method, characterized in that: include: Get metadata information of all metadata and save all metadata information to a pre-created memory data structure; In response to the metadata retrieval request, the metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread; Searching for target metadata from the metadata service management process or cache data of the metadata service process according to the target metadata information; Get the metadata information of all metadata and save all metadata information to a pre-created memory data structure, including: Creating a memory data structure and binding the memory data structure to a third-party database; Create a metadata monitoring process, update the metadata information if metadata update is detected, and synchronize the updated metadata information to the memory data structure, wherein the metadata information is used to record the node, file path, file size, and modification time of the metadata; The memory data structure synchronously backs up the updated metadata information to a third-party database; There is only one MDS process with management function in a distributed file system, and there are multiple ordinary MDS processes. Search_inode is only managed in the MDS process with management function. If other ordinary MDS processes receive metadata retrieval requests, they are forwarded to the MDS process with management function for processing; an asynchronous thread is created in the MDS process to execute the processing and management of metadata retrieval requests. During the whole process, the MDS big lock is not occupied, and the MDS processing of other requests is not affected; the management of MDS search_inode data is not protected by the MDS big lock, so search_inode is not absolutely real-time data; when a metadata retrieval request is received, the search_inode asynchronous processing module in the memory of the MDS process with management function must first be used to process the request, and the module asynchronously searches for all qualified search_inode data from the underlying third-party database.

2. The method according to claim 1, characterized in that In response to the metadata retrieval request, the metadata service management process is used to retrieve target metadata information from the memory data structure, including: Forwarding metadata retrieval requests received by each metadata service process to the metadata service management process; The metadata service management process creates an asynchronous thread, which extracts search keywords from the metadata search request and queries the third-party database for matching target metadata information according to the search keywords.

3. The method according to claim 1, characterized in that: Searching for target metadata from cache data of a metadata service management process or a metadata service process according to the target metadata information includes: Searching for associated metadata from cache data of the metadata service management process according to the target metadata information; Determine whether the target metadata information completely corresponds to the associated metadata: If not, the cache data of each metadata service process is traversed until the metadata found completely corresponds to the target metadata information, and all the found metadata are summarized and returned to the upper layer application.

4. A metadata retrieval system, characterized in that: include: An information storage unit, used to obtain metadata information of all metadata and save all metadata information to a pre-created memory data structure; An information retrieval unit, configured to respond to a metadata retrieval request, and the metadata service management process retrieves target metadata information from the memory data structure by creating an asynchronous thread; A data retrieval unit, configured to search for target metadata from cache data of a metadata service management process or a metadata service process according to the target metadata information; The information storage unit comprises: A storage building module, used to create a memory data structure and bind the memory data structure to a third-party database; A data update module is used to create a metadata monitoring process. If a metadata update is detected, the metadata information will be updated and synchronized to the memory data structure. The metadata information is used to record the node, file path, file size, and modification time of the metadata. A synchronization backup module, used for the memory data structure to synchronize and backup the updated metadata information to a third-party database; There is only one MDS process with management function in a distributed file system, and there are multiple ordinary MDS processes. Search_inode is only managed in the MDS process with management function. If other ordinary MDS processes receive metadata retrieval requests, they are forwarded to the MDS process with management function for processing; an asynchronous thread is created in the MDS process to execute the processing and management of metadata retrieval requests. During the whole process, the MDS big lock is not occupied, and the MDS processing of other requests is not affected; the management of MDS search_inode data is not protected by the MDS big lock, so search_inode is not absolutely real-time data; when a metadata retrieval request is received, the search_inode asynchronous processing module in the memory of the MDS process with management function must first be used to process the request, and the module asynchronously searches for all qualified search_inode data from the underlying third-party database.

5. The system according to claim 4, characterized in that The information retrieval unit comprises: A request forwarding module, used to forward metadata retrieval requests received by each metadata service process to the metadata service management process; The asynchronous retrieval module is used for the metadata service management process to create an asynchronous thread, the asynchronous thread extracts retrieval keywords from the metadata retrieval request, and searches for matching target metadata information from the third-party database according to the retrieval keywords.

6. The system according to claim 4, characterized in that The data retrieval unit comprises: A first retrieval module, configured to search for associated metadata from cache data of a metadata service management process according to the target metadata information; A search and judgment module is used to judge whether the target metadata information completely corresponds to the associated metadata; The second retrieval module is used to traverse the cache data of each metadata service process until the metadata found completely corresponds to the target metadata information if the target metadata information does not completely correspond to the associated metadata, and summarize all the found metadata and return them to the upper application.

7. A terminal, characterized in that: include: processor; A memory for storing execution instructions of the processor; The processor is configured to execute the method according to any one of claims 1 to 3.

8. A computer-readable storage medium storing a computer program, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.