[go: up one dir, main page]
More Web Proxy on the site http://driver.im/

CN111143293B - Metadata acquisition method, device, equipment and computer readable storage medium - Google Patents

Metadata acquisition method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN111143293B
CN111143293B CN201911332566.3A CN201911332566A CN111143293B CN 111143293 B CN111143293 B CN 111143293B CN 201911332566 A CN201911332566 A CN 201911332566A CN 111143293 B CN111143293 B CN 111143293B
Authority
CN
China
Prior art keywords
metadata
directory
target
target content
under
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911332566.3A
Other languages
Chinese (zh)
Other versions
CN111143293A (en
Inventor
赵培文
孟祥瑞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
IEIT Systems Co Ltd
Original Assignee
Inspur Electronic Information Industry Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Electronic Information Industry Co Ltd filed Critical Inspur Electronic Information Industry Co Ltd
Priority to CN201911332566.3A priority Critical patent/CN111143293B/en
Publication of CN111143293A publication Critical patent/CN111143293A/en
Application granted granted Critical
Publication of CN111143293B publication Critical patent/CN111143293B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata

Landscapes

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

Abstract

本发明公开了一种元数据获取方法、装置、设备及计算机可读存储介质;在本方案中,由于omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据,这种元数据分类存储的方式,使得客户端在获取元数据时,可以仅仅获取目录下的文件的元数据或者子目录的元数据,从而减少了元数据获取请求的处理时间,减小磁盘负载情况,提高元数据获取效率。

Figure 201911332566

The invention discloses a metadata acquisition method, device, equipment and computer-readable storage medium; in this solution, since omap only stores metadata of files in a directory, or metadata of sub-directories in a directory, this The metadata storage method allows the client to only obtain the metadata of the file in the directory or the metadata of the subdirectory when obtaining the metadata, thereby reducing the processing time of the metadata obtaining request and reducing the disk load. Improve metadata acquisition efficiency.

Figure 201911332566

Description

一种元数据获取方法、装置、设备及计算机可读存储介质Metadata acquisition method, apparatus, device, and computer-readable storage medium

技术领域technical field

本发明涉及信息存储技术领域,更具体地说,涉及一种元数据获取方法、装置、设备及计算机可读存储介质。The present invention relates to the technical field of information storage, and more particularly, to a method, apparatus, device and computer-readable storage medium for obtaining metadata.

背景技术Background technique

目前,客户端需要操作某个目录时,如果元数据服务检查目录对应的Cdir(目录分片)的元数据信息不在缓存中,则需要从rados(Reliable,Autonomic Distributed ObjectStore,分布式数据存储系统)中抓取CDir的信息和目录项。但是,由于目录下的所有子目录和文件的元数据信息都存储在同一个omap(object map,存储元数据信息的数据结构)中,当目录信息不在缓存中时,无论是获取该目录下的子目录的元数据信息,还是获取该目录下的文件的元数据信息,都需要从rados中抓取该目录的整个omap数据结构,即需要抓取的omap数据结构包含了该目录下的所有子目录和文件的元数据信息,可以看出,这种获取方式,无形中抓取了一些不需要的元数据信息,当存在大量的抓取操作时,会给osd(ObjectStorage Device,对象存储设备)带来很大的读写负载,导致抓取效率低,客户端请求处理时间超时。At present, when the client needs to operate a certain directory, if the metadata service checks that the metadata information of the Cdir (directory shard) corresponding to the directory is not in the cache, it needs to retrieve the data from rados (Reliable, Autonomic Distributed ObjectStore, distributed data storage system) Crawling CDir information and directory entries. However, since the metadata information of all subdirectories and files in the directory are stored in the same omap (object map, the data structure for storing metadata information), when the directory information is not in the cache, no matter whether the directory information is obtained To obtain the metadata information of the subdirectory, or to obtain the metadata information of the files in the directory, it is necessary to capture the entire omap data structure of the directory from rados, that is, the omap data structure to be captured contains all the subdirectories in the directory. Metadata information of directories and files, it can be seen that this acquisition method captures some unnecessary metadata information invisibly. When there are a large number of grabbing operations, it will give osd (ObjectStorage Device) It brings a large read and write load, resulting in low crawling efficiency and timeout of client request processing time.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于提供一种元数据获取方法、装置、设备及计算机可读存储介质,以提高元数据获取效率。The purpose of the present invention is to provide a method, apparatus, device and computer-readable storage medium for obtaining metadata, so as to improve the efficiency of obtaining metadata.

为实现上述目的,本发明提供一种元数据获取方法,包括:In order to achieve the above object, the present invention provides a method for obtaining metadata, including:

接收客户端发送的元数据获取请求;所述元数据获取请求为获取目录下的文件的获取请求,或者获取目录下的子目录的获取请求;Receive a metadata acquisition request sent by the client; the metadata acquisition request is an acquisition request for acquiring a file under a directory, or an acquisition request for acquiring a subdirectory under the directory;

在磁盘中确定与所述元数据获取请求对应的目标omap;其中,omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据;Determine the target omap corresponding to the metadata acquisition request in the disk; wherein, the omap only stores the metadata of the file under the directory, or the metadata of the subdirectory under the directory;

从所述目标omap获取元数据信息,并发送至所述客户端。Obtain metadata information from the target omap and send it to the client.

其中,所述接收客户端发送的元数据获取请求之前,还包括:Wherein, before receiving the metadata acquisition request sent by the client, the method further includes:

接收存储目标目录的请求;Receive a request to store the target directory;

将所述目标目录下的文件的元数据以及与所述目标目录下的子目录的元数据,存储至磁盘的不同omap中。The metadata of the files under the target directory and the metadata of the subdirectories under the target directory are stored in different omaps of the disk.

其中,所述将所述目标目录下的文件的元数据以及与所述目标目录下的子目录的元数据,存储至磁盘的不同omap中,包括:Wherein, the metadata of the file under the target directory and the metadata of the subdirectory under the target directory are stored in different omaps of the disk, including:

依次遍历所述目标目录下的每个目标内容,根据每个目标内容的目录项确定每个目标内容的索引节点;Traverse each target content under the target directory in turn, and determine the index node of each target content according to the directory entry of each target content;

利用每个目标内容的索引节点确定每个目标内容的类型,所述类型包括文件和子目录;Using the inode of each target content to determine the type of each target content, the type including files and subdirectories;

将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据存储至磁盘的不同omap中。Store the metadata of the target content of type file and the metadata of the target content of type subdirectory to different omaps on disk.

其中,所述将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据存储至磁盘的不同omap中,包括:Wherein, the metadata of the target content whose type is a file and the metadata of the target content whose type is a subdirectory are stored in different omaps of the disk, including:

将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至不同的数据结构中;Cache the metadata of the target content of type file and the metadata of target content of type subdirectory into different data structures;

将不同数据结构中的元数据分别存储至磁盘的不同omap中。Store metadata in different data structures in different omaps on disk.

为实现上述目的,本发明进一步提供一种元数据获取装置,包括:In order to achieve the above object, the present invention further provides a device for obtaining metadata, comprising:

第一接收模块,用于接收客户端发送的元数据获取请求;所述元数据获取请求为获取目录下的文件的获取请求,或者获取目录下的子目录的获取请求;a first receiving module, configured to receive a metadata acquisition request sent by a client; the metadata acquisition request is an acquisition request for acquiring a file in a directory, or an acquisition request for acquiring a subdirectory under the directory;

确定模块,用于在磁盘中确定与所述元数据获取请求对应的目标omap;其中,omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据;A determination module for determining the target omap corresponding to the metadata acquisition request in the disk; wherein, the omap only stores the metadata of the file under the directory, or the metadata of the subdirectory under the directory;

发送模块,用于从所述目标omap获取元数据信息,并发送至所述客户端。A sending module, configured to obtain metadata information from the target omap and send it to the client.

其中,本方案还包括:Among them, this program also includes:

第二接收模块,用于接收存储目标目录的请求;a second receiving module, configured to receive a request for storing the target directory;

存储模块,用于将所述目标目录下的文件的元数据以及与所述目标目录下的子目录的元数据,存储至磁盘的不同omap中。The storage module is configured to store the metadata of the files under the target directory and the metadata of the subdirectories under the target directory in different omaps of the disk.

其中,所述存储模块包括:Wherein, the storage module includes:

第一确定单元,用于依次遍历所述目标目录下的每个目标内容,根据每个目标内容的目录项确定每个目标内容的索引节点;The first determining unit is used to traverse each target content under the target directory in turn, and determine the index node of each target content according to the directory entry of each target content;

第二确定单元,用于利用每个目标内容的索引节点确定每个目标内容的类型,所述类型包括文件和子目录;a second determining unit, configured to determine the type of each target content by using the index node of each target content, and the type includes files and subdirectories;

存储单元,用于将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据存储至磁盘的不同omap中。The storage unit is used to store the metadata of the target content whose type is a file and the metadata of the target content whose type is a subdirectory into different omaps on the disk.

其中,所述存储单元具体用于:将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至不同的数据结构中;将不同数据结构中的元数据分别存储至磁盘的不同omap中。The storage unit is specifically configured to: cache the metadata of the target content whose type is a file and the metadata of the target content whose type is a subdirectory into different data structures; store the metadata in the different data structures respectively to different omaps on disk.

为实现上述目的,本发明进一步提供一种元数据获取设备,包括:To achieve the above purpose, the present invention further provides a device for obtaining metadata, including:

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

处理器,用于执行所述计算机程序时实现上述的元数据获取方法的步骤。The processor is configured to implement the steps of the above metadata acquisition method when executing the computer program.

为实现上述目的,本发明进一步提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述的元数据获取方法的步骤。To achieve the above object, the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above metadata acquisition method are implemented.

通过以上方案可知,本发明实施例提供的一种元数据获取方法,包括:接收客户端发送的元数据获取请求;所述元数据获取请求为获取目录下的文件的获取请求,或者获取目录下的子目录的获取请求;在磁盘中确定与所述元数据获取请求对应的目标omap;其中,omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据;从所述目标omap获取元数据信息,并发送至所述客户端。As can be seen from the above solutions, a method for obtaining metadata provided by an embodiment of the present invention includes: receiving a request for obtaining metadata sent by a client; the request for obtaining metadata is a request for obtaining a file in a directory, or a request for obtaining a file in a directory. The acquisition request of the subdirectory; determine the target omap corresponding to the metadata acquisition request in the disk; wherein, the omap only stores the metadata of the file under the directory, or the metadata of the subdirectory under the directory; from the target omap obtains metadata information and sends it to the client.

可见,由于本申请中的omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据,这种元数据分类存储的方式,使得客户端在获取元数据时,可以仅仅获取文件的元数据或者子目录的元数据,从而减少了元数据获取请求的处理时间,减小磁盘负载情况,提高元数据获取效率;本发明还公开了一种元数据获取装置、设备及计算机可读存储介质,同样能实现上述技术效果。It can be seen that, because the omap in this application only stores the metadata of the files under the directory, or the metadata of the subdirectories under the directory, this way of classifying and storing the metadata enables the client to only obtain the file when obtaining the metadata. metadata or sub-directory metadata, thereby reducing the processing time of the metadata acquisition request, reducing the disk load, and improving the metadata acquisition efficiency; the invention also discloses a metadata acquisition device, equipment and a computer-readable The storage medium can also achieve the above technical effects.

附图说明Description of drawings

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

图1为本发明实施例公开的一种元数据获取方法流程示意图;1 is a schematic flowchart of a method for obtaining metadata disclosed in an embodiment of the present invention;

图2为本发明实施例公开的一种元数据获取装置结构示意图;FIG. 2 is a schematic structural diagram of a device for obtaining metadata disclosed in an embodiment of the present invention;

图3为本发明实施例公开的一种元数据获取设备结构示意图。FIG. 3 is a schematic structural diagram of a device for obtaining metadata according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

本发明实施例公开了一种元数据获取方法、装置、设备及计算机可读存储介质,以提高元数据获取效率。Embodiments of the present invention disclose a method, apparatus, device, and computer-readable storage medium for obtaining metadata, so as to improve the efficiency of obtaining metadata.

参见图1,本发明实施例提供的一种元数据获取方法,包括:Referring to FIG. 1, a method for obtaining metadata provided by an embodiment of the present invention includes:

S101、接收客户端发送的元数据获取请求;所述元数据获取请求为获取目录下的文件的获取请求,或者获取目录下的子目录的获取请求;S101. Receive a metadata acquisition request sent by a client; the metadata acquisition request is an acquisition request for acquiring a file under a directory, or an acquisition request for acquiring a subdirectory under the directory;

需要说明的是,本实施例所述的元数据获取方法,是应用在元数据不在缓存中的情况,如果元数据已经存储在缓存中,这时接收到客户端发送的元数据获取请求,便可直接从缓存中查找对应的元数据并返回,根本不需要从磁盘中查找对应的元数据并返回。而在元数据不在缓存中的情况下,由于无论获取目录下的子目录的元数据信息,还是获取目录下的文件的元数据信息,都需要从磁盘中获取该目录下的所有子目录和文件的元数据信息,这种获取方式,无形中抓取了一些不需要的元数据信息,当存在大量的抓取操作时,会给磁盘带来很大的读写负载,导致抓取效率低,客户端请求处理时间超时。It should be noted that the metadata acquisition method described in this embodiment is applied when the metadata is not in the cache. If the metadata has been stored in the cache, the metadata acquisition request sent by the client is received at this time. You can directly look up the corresponding metadata from the cache and return it, and you don't need to look up the corresponding metadata from the disk and return it. In the case where the metadata is not in the cache, because whether to obtain the metadata information of the subdirectories under the directory or the metadata information of the files under the directory, it is necessary to obtain all the subdirectories and files under the directory from the disk. In this way, some unnecessary metadata information is captured invisibly. When there are a large number of fetching operations, it will bring a large read and write load to the disk, resulting in low fetching efficiency. The client request processing time timed out.

而在本申请中,接收客户端发送的元数据获取请求之前,还包括:接收存储目标目录的请求;将所述目标目录下的文件的元数据以及与所述目标目录下的子目录的元数据,存储至磁盘的不同omap中。In the present application, before receiving the metadata acquisition request sent by the client, the method further includes: receiving a request for storing a target directory; Data, stored in different omaps on disk.

也就是说,在本申请中,客户端在存储目录时,其元数据需要按照文件及子目录的类型的不同,分别存储在磁盘的不同omap中,实现了元数据的分类存储。因此本申请中的客户端在获取元数据时,可以仅仅发送获取目录下的文件的获取请求,也可以仅仅发送获取目录下的子目录的获取请求,当然也可以发送获取目录下的文件及子目录的获取请求,在此并不具体限定。That is to say, in the present application, when a client stores a directory, its metadata needs to be stored in different omaps on the disk according to the types of files and subdirectories, thereby realizing classified storage of metadata. Therefore, when the client in this application obtains metadata, it can only send a request for obtaining files in a directory, or only a request for obtaining sub-directories in a directory, and of course, it can also send a request for obtaining files and sub-directories in a directory. The request for obtaining the directory is not specifically limited here.

S102、在磁盘中确定与所述元数据获取请求对应的目标omap;其中,omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据;S102, determine the target omap corresponding to the metadata acquisition request in the disk; wherein, the omap only stores the metadata of the file under the directory, or the metadata of the subdirectory under the directory;

S103、从所述目标omap获取元数据信息,并发送至所述客户端。S103. Obtain metadata information from the target omap, and send it to the client.

需要说明的是,接收到客户端发送的元数据获取请求后,可以根据该请求获取的元数据类型,确定存储元数据的目标omap;也即:如果该元数据获取请求为获取目录下的文件的获取请求,则需要将存储该目录下的文件的元数据的omap作为目标omap;如果该元数据获取请求为获取目录下的子目录的获取请求,则需要将存储该目录下的子目录的元数据的omap作为目标omap;当然,如果该元数据获取请求为获取目录下的文件及子目录的获取请求,则需要分别查找存储该目录下的文件的元数据的omap,及存储该目录下的子目录的元数据的omap,将这两个omap均作为目标omap。确定存储对应元数据的目标omap后,便可直接从目标omap中获取对应的元数据,并发送至客户端,从而实现对元数据的获取,It should be noted that after receiving the metadata acquisition request sent by the client, the target omap for storing metadata can be determined according to the metadata type obtained by the request; that is, if the metadata acquisition request is to acquire files in the directory , you need to use the omap that stores the metadata of the files in the directory as the target omap; if the metadata acquisition request is an acquisition request to acquire a subdirectory under the directory, you need to store the subdirectory in the directory. The omap of the metadata is used as the target omap; of course, if the metadata acquisition request is a request for acquiring files and subdirectories in a directory, you need to find the omap that stores the metadata of the files in the directory, and store the metadata in the directory. The omap of the metadata of the subdirectory of , uses both omaps as the target omap. After determining the target omap that stores the corresponding metadata, the corresponding metadata can be directly obtained from the target omap and sent to the client, thereby realizing the acquisition of the metadata.

可以看出,本方案将目录下的内容根据文件和目录的不同,对元数据进行分类存储。从而使得客户端在获取元数据时,无论是获取目录下文件的元数据,还是获取目录下子目录的元数据,均可直接获取对应的元数据,而不需要获取该目录的整个元数据,从而减小了元数据获取时间,从而减少了元数据获取请求的处理时间,减小磁盘负载情况,提高元数据获取效率。It can be seen that this scheme classifies and stores the metadata of the content in the directory according to the difference between files and directories. Therefore, when the client obtains the metadata, whether it is to obtain the metadata of the file under the directory or the metadata of the subdirectory under the directory, it can directly obtain the corresponding metadata without the need to obtain the entire metadata of the directory. The metadata acquisition time is reduced, thereby reducing the processing time of the metadata acquisition request, reducing the disk load, and improving the metadata acquisition efficiency.

基于上述实施例,在本实施例中,将所述目标目录下的文件的元数据以及与目标目录下的子目录的元数据,存储至磁盘的不同omap中,包括:Based on the above embodiment, in this embodiment, the metadata of the files under the target directory and the metadata of the subdirectories under the target directory are stored in different omaps of the disk, including:

依次遍历所述目标目录下的每个目标内容,根据每个目标内容的目录项确定每个目标内容的索引节点;Traverse each target content under the target directory in turn, and determine the index node of each target content according to the directory entry of each target content;

利用每个目标内容的索引节点确定每个目标内容的类型,所述类型包括文件和子目录;Using the inode of each target content to determine the type of each target content, the type including files and subdirectories;

将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至不同的数据结构中;Cache the metadata of the target content of type file and the metadata of target content of type subdirectory into different data structures;

将不同数据结构中的元数据分别存储至磁盘的不同omap中。Store metadata in different data structures in different omaps on disk.

需要说明的是,在本申请中,在将目录提交至磁盘时,需要根据遍历目录下的内容,在本方案中,为了方便说明,将正在执行操作的内容称为目标内容,该目标内容可以是文件或者子目录。其中,该目录下的文件或者子目录均有对应的目录项,该目录项为包含文件名和索引节点号的结构,因此通过目标内容的目录项,便可确定与该目标内容的索引节点,由于索引节点中存储了属性等相关信息,因此可以直接根据目标内容的索引节点判断目标内容的类型是文件还是子目录,并将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至磁盘的不同omap中。It should be noted that, in this application, when submitting a directory to a disk, it is necessary to traverse the content in the directory. In this solution, for the convenience of description, the content that is performing the operation is called the target content, and the target content can be is a file or subdirectory. Among them, the files or subdirectories under the directory have corresponding directory entries, and the directory entry is a structure including a file name and an inode number. Therefore, through the directory entry of the target content, the inode of the target content can be determined. Because Attributes and other related information are stored in the index node, so you can directly determine whether the type of the target content is a file or a subdirectory according to the index node of the target content, and convert the metadata of the target content of type file and the target content of type subdirectory. The metadata is cached in different omaps on disk.

需要说明的是,由于本申请需要将元数据进行分类后再存储,因此本申请为了避免元数据分类过程过慢,导致元数据写入磁盘的时长的问题,可以先将文件和子目录对应的元数据信息分别存储在不同的数据结构中,实现对元数据的预先分类及暂存,待元数据均分类完成后,便可创建不同的OSD操作数据结构,分别将数据结构中暂存的元数据信息填充至OSD操作数据结构中,执行元数据的存储操作,从而实现将文件和子目录的元数据信息分别存储在rados不同omap中。这样在抓取目录下的内容的时候,可以根据客户端的需求,只抓取文件或目录的元数据信息。It should be noted that, because the application needs to classify the metadata before storing it, in order to avoid the metadata classification process being too slow and the problem of the duration of metadata writing to the disk, the metadata corresponding to the file and the subdirectory can be stored first. The data information is stored in different data structures to realize the pre-classification and temporary storage of the metadata. After the metadata is classified, different OSD operation data structures can be created, and the metadata temporarily stored in the data structures can be stored separately. The information is filled into the OSD operation data structure, and the metadata storage operation is performed, so as to realize the storage of the metadata information of files and subdirectories in different omaps of rados respectively. In this way, when crawling the content in the directory, only the metadata information of the file or directory can be crawled according to the client's needs.

综上可以看出,本申请提出的元数据信息分类存储的方法,在业务使用场景中,可以减少元数据请求的处理时间和osd的读写负载,提高效率;并且,本实施例提出的这种先将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至不同的数据结构中,然后再将不同数据结构中缓存的元数据分别存储至磁盘的不同omap中的方式,可以减小磁盘写入时间,提高元数据写入效率。To sum up, it can be seen that the method for classifying and storing metadata information proposed in this application can reduce the processing time of metadata requests and the read and write load of osd, and improve the efficiency in business usage scenarios; First, the metadata of the target content of type file and the metadata of target content of type subdirectory are cached in different data structures, and then the cached metadata in different data structures are stored in different omaps of the disk respectively. In this way, the disk writing time can be reduced and the metadata writing efficiency can be improved.

下面对本发明实施例提供的获取装置进行介绍,下文描述的获取装置与上文描述的获取方法可以相互参照。The following describes the obtaining apparatus provided by the embodiments of the present invention, and the obtaining apparatus described below and the obtaining method described above may refer to each other.

参见图2,本发明实施例提供的一种元数据获取装置结构示意图;该装置包括:Referring to FIG. 2, a schematic structural diagram of an apparatus for obtaining metadata provided by an embodiment of the present invention; the apparatus includes:

第一接收模块100,用于接收客户端发送的元数据获取请求;所述元数据获取请求为获取目录下的文件的获取请求,或者获取目录下的子目录的获取请求;The first receiving module 100 is configured to receive a metadata acquisition request sent by a client; the metadata acquisition request is an acquisition request for acquiring a file under a directory, or an acquisition request for acquiring a subdirectory under the directory;

确定模块200,用于在磁盘中确定与所述元数据获取请求对应的目标omap;其中,omap仅存储目录下的文件的元数据,或者目录下的子目录的元数据;A determination module 200 is used to determine the target omap corresponding to the metadata acquisition request in the disk; wherein, the omap only stores the metadata of the file under the directory, or the metadata of the subdirectory under the directory;

发送模块300,用于从所述目标omap获取元数据信息,并发送至所述客户端。The sending module 300 is configured to obtain metadata information from the target omap and send it to the client.

其中,本方案还包括:Among them, this program also includes:

第二接收模块,用于接收存储目标目录的请求;a second receiving module, configured to receive a request for storing the target directory;

存储模块,用于将所述目标目录下的文件的元数据以及与所述目标目录下的子目录的元数据,存储至磁盘的不同omap中。The storage module is configured to store the metadata of the files under the target directory and the metadata of the subdirectories under the target directory in different omaps of the disk.

其中,所述存储模块包括:Wherein, the storage module includes:

第一确定单元,用于依次遍历所述目标目录下的每个目标内容,根据每个目标内容的目录项确定每个目标内容的索引节点;The first determining unit is used to traverse each target content under the target directory in turn, and determine the index node of each target content according to the directory entry of each target content;

第二确定单元,用于利用每个目标内容的索引节点确定每个目标内容的类型,所述类型包括文件和子目录;a second determining unit, configured to determine the type of each target content by using the index node of each target content, and the type includes files and subdirectories;

存储单元,用于将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据存储至磁盘的不同omap中。The storage unit is used to store the metadata of the target content whose type is a file and the metadata of the target content whose type is a subdirectory into different omaps on the disk.

其中,所述存储单元具体用于:将类型为文件的目标内容的元数据,以及类型为子目录的目标内容的元数据缓存至不同的数据结构中;将不同数据结构中的元数据分别存储至磁盘的不同omap中。The storage unit is specifically configured to: cache the metadata of the target content whose type is a file and the metadata of the target content whose type is a subdirectory into different data structures; store the metadata in the different data structures respectively to different omaps on disk.

参见图3,本发明实施例还公开了一种元数据获取设备结构示意图;该设备包括:Referring to FIG. 3 , an embodiment of the present invention further discloses a schematic structural diagram of a device for obtaining metadata; the device includes:

存储器11,用于存储计算机程序;memory 11 for storing computer programs;

处理器12,用于执行所述计算机程序时实现如上述方法实施例所述的元数据获取方法的步骤。The processor 12 is configured to implement the steps of the metadata acquisition method described in the above method embodiments when the computer program is executed.

在本实施例中,设备可以是PC(Personal Computer,个人电脑),也可以是智能手机、平板电脑、掌上电脑、便携计算机等终端设备。In this embodiment, the device may be a PC (Personal Computer, personal computer), or may be a terminal device such as a smart phone, a tablet computer, a palmtop computer, and a portable computer.

该设备可以包括存储器11、处理器12和总线13。The device may include a memory 11 , a processor 12 and a bus 13 .

其中,存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、磁性存储器、磁盘、光盘等。存储器11在一些实施例中可以是设备的内部存储单元,例如该设备的硬盘。存储器11在另一些实施例中也可以是设备的外部存储设备,例如设备上配备的插接式硬盘,智能存储卡(SmartMedia Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。进一步地,存储器11还可以既包括设备的内部存储单元也包括外部存储设备。存储器11不仅可以用于存储安装于设备的应用软件及各类数据,例如执行元数据获取方法的程序代码等,还可以用于暂时地存储已经输出或者将要输出的数据。The memory 11 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (eg, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, and the like. The memory 11 may in some embodiments be an internal storage unit of the device, such as a hard disk of the device. In other embodiments, the memory 11 may also be an external storage device of the device, such as a plug-in hard disk equipped on the device, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash memory card ( Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the device and an external storage device. The memory 11 can be used not only to store application software installed in the device and various types of data, such as program codes for executing the metadata acquisition method, etc., but also to temporarily store data that has been output or will be output.

处理器12在一些实施例中可以是一中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器或其他数据处理芯片,用于运行存储器11中存储的程序代码或处理数据,例如执行元数据获取方法的程序代码等。The processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chips in some embodiments, for running program codes or processing stored in the memory 11 Data, such as program code that executes metadata acquisition methods, etc.

该总线13可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。为便于表示,图3中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The bus 13 may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. For ease of presentation, only one thick line is used in FIG. 3, but it does not mean that there is only one bus or one type of bus.

进一步地,设备还可以包括网络接口14,网络接口14可选的可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该设备与其他电子设备之间建立通信连接。Further, the device may also include a network interface 14, and the network interface 14 may optionally include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used between the device and other electronic devices Establish a communication connection.

可选地,该设备还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在设备中处理的信息以及用于显示可视化的用户界面。Optionally, the device may further include a user interface, and the user interface may include a display (Display), an input unit such as a keyboard (Keyboard), and an optional user interface may further include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like. Among them, the display may also be appropriately referred to as a display screen or a display unit, for displaying information processed in the device and for displaying a visual user interface.

图3仅示出了具有组件11-14的设备,本领域技术人员可以理解的是,图3示出的结构并不构成对设备的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 3 only shows the device with components 11-14. Those skilled in the art can understand that the structure shown in FIG. 3 does not constitute a limitation on the device, and may include fewer or more components than those shown. Either some components are combined, or different component arrangements.

本发明实施例还公开了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述方法实施例所述的元数据获取方法的步骤。An embodiment of the present invention further discloses a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the metadata acquisition method according to the above method embodiment is implemented A step of.

其中,该存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。Wherein, the storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other various storage media that can store program codes medium.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other.

对所公开的实施例的上述说明,使本领域专业技术人员能够实现或使用本发明。对这些实施例的多种修改对本领域的专业技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本发明的精神或范围的情况下,在其它实施例中实现。因此,本发明将不会被限制于本文所示的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。The above description of the disclosed embodiments enables any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (6)

1. A metadata acquisition method, comprising:
receiving a metadata acquisition request sent by a client; the metadata acquisition request is an acquisition request for acquiring files under a directory or acquisition requests for acquiring sub-directories under the directory;
determining a target omap corresponding to the metadata acquisition request in a disk; wherein, the omap only stores the metadata of the files under the directory or the metadata of the subdirectories under the directory;
acquiring metadata information from the target omap and sending the metadata information to the client;
before receiving a metadata obtaining request sent by a client, the method further includes:
receiving a request to store a target directory;
storing the metadata of the files under the target directory and the metadata of the subdirectories under the target directory into different omaps of a disk; caching metadata of target content with the type of a file and metadata of target content with the type of a subdirectory into different data structures; and respectively storing the metadata in different data structures into different omaps of the disk.
2. The method according to claim 1, wherein the storing the metadata of the file in the target directory and the metadata of the subdirectory in the target directory to different omaps of a disk comprises:
sequentially traversing each target content under the target directory, and determining an index node of each target content according to a directory entry of each target content;
determining the type of each target content by using the index node of each target content, wherein the type comprises files and subdirectories;
and storing the metadata of the target content with the type of the file and the metadata of the target content with the type of the subdirectory into different omaps of the disk.
3. A metadata acquisition apparatus, comprising:
the first receiving module is used for receiving a metadata acquisition request sent by a client; the metadata acquisition request is an acquisition request for acquiring files under a directory or an acquisition request for acquiring sub-directories under the directory;
a determining module, configured to determine a target omap corresponding to the metadata obtaining request in a disk; wherein, the omap only stores the metadata of the files under the directory or the metadata of the subdirectories under the directory;
the sending module is used for obtaining metadata information from the target omap and sending the metadata information to the client;
a second receiving module, configured to receive a request for storing a target directory;
the storage module is used for storing the metadata of the files under the target directory and the metadata of the subdirectories under the target directory into different omaps of a disk; caching metadata of target content with the type of a file and metadata of target content with the type of a subdirectory into different data structures; and respectively storing the metadata in different data structures into different omaps of the disk.
4. The metadata acquisition apparatus according to claim 3, wherein the storage module comprises:
the first determining unit is used for sequentially traversing each target content under the target directory and determining an index node of each target content according to a directory entry of each target content;
a second determining unit, configured to determine a type of each target content using the inode of each target content, where the type includes a file and a subdirectory;
and the storage unit is used for storing the metadata of the target content with the type of the file and the metadata of the target content with the type of the subdirectory into different omaps of the disk.
5. A metadata acquisition apparatus characterized by comprising:
a memory for storing a computer program;
a processor for implementing the steps of the metadata acquisition method as claimed in claim 1 or 2 when executing said computer program.
6. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the metadata acquisition method according to claim 1 or 2.
CN201911332566.3A 2019-12-22 2019-12-22 Metadata acquisition method, device, equipment and computer readable storage medium Active CN111143293B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911332566.3A CN111143293B (en) 2019-12-22 2019-12-22 Metadata acquisition method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911332566.3A CN111143293B (en) 2019-12-22 2019-12-22 Metadata acquisition method, device, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111143293A CN111143293A (en) 2020-05-12
CN111143293B true CN111143293B (en) 2022-06-07

Family

ID=70519280

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911332566.3A Active CN111143293B (en) 2019-12-22 2019-12-22 Metadata acquisition method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111143293B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114168079B (en) * 2021-12-09 2023-08-22 深圳软牛科技有限公司 Method, device and related component for identifying tiff type data deleted from disk
CN114546951A (en) * 2022-01-07 2022-05-27 青岛海尔科技有限公司 File merging method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567003A (en) * 2009-05-27 2009-10-28 清华大学 Method for managing and allocating resource in parallel file system
CN106874383A (en) * 2017-01-10 2017-06-20 清华大学 A kind of decoupling location mode of metadata of distributed type file system
CN108021717A (en) * 2017-12-29 2018-05-11 成都三零嘉微电子有限公司 A kind of implementation method of lightweight embedded file system
CN109684282A (en) * 2018-11-23 2019-04-26 华为技术有限公司 A kind of method and device constructing metadata cache

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9317511B2 (en) * 2012-06-19 2016-04-19 Infinidat Ltd. System and method for managing filesystem objects

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101567003A (en) * 2009-05-27 2009-10-28 清华大学 Method for managing and allocating resource in parallel file system
CN106874383A (en) * 2017-01-10 2017-06-20 清华大学 A kind of decoupling location mode of metadata of distributed type file system
CN108021717A (en) * 2017-12-29 2018-05-11 成都三零嘉微电子有限公司 A kind of implementation method of lightweight embedded file system
CN109684282A (en) * 2018-11-23 2019-04-26 华为技术有限公司 A kind of method and device constructing metadata cache

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于DBMS的元数据管理策略;吴婷等;《计算机应用研究》;20100415(第04期);1297-1300页 *

Also Published As

Publication number Publication date
CN111143293A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
CN110989937B (en) Data storage method, device and equipment and computer readable storage medium
US10191856B2 (en) Method of managing web browser cache size using logical relationships and clustering
WO2016101757A1 (en) Image processing method and device based on mobile device
CN102622347A (en) Image management method and movable terminal
CN102799613A (en) Showing method and device for recently-used file
WO2020113941A1 (en) Data access method, apparatus and system based on mining computer, and readable storage medium
WO2016000507A1 (en) Traffic-saving mode search service method, server, client and system
US11080322B2 (en) Search methods, servers, and systems
CN112306959B (en) File scanning method of mobile storage device, storage medium and device terminal
CN110019873B (en) Face data processing method, device and equipment
CN107832470A (en) A kind of object storage method and device based on storage system
CN111143293B (en) Metadata acquisition method, device, equipment and computer readable storage medium
CN110888843A (en) Cross-host sparse file copying method, device, equipment and storage medium
WO2017219524A1 (en) Page saving method and electronic device
WO2017166760A1 (en) Method, apparatus, mobile terminal, and electronic device for reviewing image file
CN112328592A (en) Data storage method, electronic device and computer readable storage medium
CN118120212A (en) A file deduplication method, device and equipment
US9113135B2 (en) Image advocacy in portable computing devices
CN110908958B (en) File processing method, device, terminal and storage medium
CN108388616B (en) Data collection device, method, system and computer readable storage medium
CN104317955B (en) File scanning method and device in a kind of mobile terminal memory space
US20160224553A1 (en) Search methods and terminals
CN103020186B (en) A kind of document retrieval method based on embedded device, device and equipment
CN106202456B (en) Method and device for sending pictures
US9787755B2 (en) Method and device for browsing network data, and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant