Metadata management method and device
By determining the index identifier and storage location of metadata in the file system, combined with consistency verification and log file updates, the problem of high metadata storage coupling is solved and the accuracy and reliability of metadata are improved.
Patent Information
- Application Number
- CN202211559766.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-12-02
AI Technical Summary
In the prior art, metadata of a file system is highly coupled in terms of storage location and storage relationship, resulting in an inability to guarantee the reliability of the metadata.
By determining the index identifier of the metadata in the file system, the target storage list and target storage location of the metadata are determined from the storage list set according to the index identifier and the preset value, and the metadata is stored in the target storage location. At the same time, a consistency check and log file update mechanism are adopted to ensure the independence and accuracy of the metadata.
The uniqueness and independence of metadata storage locations are achieved, the coupling between metadata is eliminated, and the accuracy and reliability of metadata are improved.
Smart Images

Figure CN115827563B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, specifically to technical fields such as cloud computing, big data, and intelligent supply chain, and more particularly to a metadata management method, device, computer-readable medium, and electronic device. Background Art
[0002] File system metadata is system data used to describe the characteristics of files within the file system. It is the core data of the entire file system. File systems generally use a directory tree structure, with the root directory as the root node of the tree, directories as nodes, and files as leaves. To facilitate server loading of file system metadata, metadata is managed and stored in a directory tree format both in memory and on disk. This results in a high degree of coupling between metadata in terms of storage location and storage relationships, making metadata reliability uncertain. Summary of the Invention
[0003] The embodiments of the present application provide a metadata management method, device, computer-readable medium, and electronic device.
[0004] In a first aspect, an embodiment of the present application provides a metadata management method, including: determining an index identifier of metadata in a file system; determining a target storage list corresponding to the metadata, and a target storage position corresponding to the metadata in the target storage list from a storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; and storing the metadata to the target storage position in the target storage list.
[0005] In some examples, the above-mentioned determining the target storage list corresponding to the metadata and the target storage position corresponding to the metadata in the target storage list from the storage list set based on the index identifier and the preset value includes: performing a modulo operation on the index identifier and the preset value to obtain an integer value and a remainder value; determining the target storage list from the storage list set based on the integer value; and determining the target storage position from the target storage list based on the remainder value.
[0006] In some examples, the file system also uses a metadata file based on a directory tree to manage the metadata of the file system; and the above method also includes: performing consistency verification on the metadata in the storage list in the storage list set and the metadata in the metadata file; in response to determining that the metadata in the storage list in the storage list set and the metadata in the metadata file are inconsistent, repairing the metadata in the storage list in the storage list set, or the metadata in the metadata file.
[0007] In some examples, the above method further includes: determining modification operation information representing modification of metadata in the file system from the log file; and updating metadata in the metadata file based on the modification operation information.
[0008] In some examples, the method further includes: determining modification operation information representing modification of metadata in the file system from the log file; and updating metadata in a storage list in the storage list set based on the modification operation information.
[0009] In some examples, the above-mentioned updating of metadata in the storage list in the storage list set based on the modification operation information includes: in response to determining that the multiple metadata corresponding to the multiple modification operations represented by the modification operation information include adjacent metadata in the storage list in the storage list set, merging the modification operations corresponding to the adjacent metadata to obtain a merged modification operation; and updating the adjacent metadata in the storage list in the storage list set based on the merged modification operation.
[0010] In some examples, the method further includes: in response to determining that a storage list exists in the storage list set in which all files corresponding to the stored metadata have been deleted, deleting the determined storage list.
[0011] In some examples, the method further includes: in response to determining that the file system is deleted, deleting the storage list set.
[0012] In a second aspect, an embodiment of the present application provides a metadata management device, comprising: a first determination unit, configured to determine an index identifier of metadata in a file system; a second determination unit, configured to determine a target storage list corresponding to the metadata, and a target storage position corresponding to the metadata in the target storage list from a storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; and a storage unit, configured to store the metadata to the target storage position in the target storage list.
[0013] In some examples, the second determination unit is further configured to: perform a modulo operation on the index identifier and the preset value to obtain an integer value and a remainder value; determine a target storage list from the storage list set based on the integer value; and determine a target storage location from the target storage list based on the remainder value.
[0014] In some examples, the file system also uses a metadata file based on a directory tree to manage the metadata of the file system; and the above-mentioned device also includes: a verification unit, configured to perform consistency verification on the metadata in the storage list in the storage list set and the metadata in the metadata file; a repair unit, configured to repair the metadata in the storage list in the storage list set, or the metadata in the metadata file, in response to determining that the metadata in the storage list in the storage list set and the metadata in the metadata file are inconsistent.
[0015] In some examples, the apparatus further includes: a first updating unit configured to determine modification operation information representing modification of metadata in the file system from the log file; and update metadata in the metadata file based on the modification operation information.
[0016] In some examples, the apparatus further includes: a second updating unit configured to determine modification operation information representing modification of metadata in the file system from the log file; and update metadata in a storage list in the storage list set based on the modification operation information.
[0017] In some examples, the second update unit is further configured to: in response to determining that the multiple metadata corresponding to the multiple modification operations represented by the modification operation information include adjacent metadata in the storage list in the storage list set, merge the modification operations corresponding to the adjacent metadata to obtain a merged modification operation; and based on the merged modification operation, update the adjacent metadata in the storage list in the storage list set.
[0018] In some examples, the apparatus further includes: a first deleting unit configured to, in response to determining that a storage list exists in the storage list set in which all files corresponding to the stored metadata are deleted, delete the determined storage list.
[0019] In some examples, the apparatus further includes: a second deleting unit configured to delete the storage list set in response to determining that the file system is deleted.
[0020] In a third aspect, an embodiment of the present application provides a computer-readable medium having a computer program stored thereon, wherein when the program is executed by a processor, the method described in any implementation manner of the first aspect is implemented.
[0021] In a fourth aspect, an embodiment of the present application provides an electronic device comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner of the first aspect.
[0022] The metadata management method and device provided by the embodiments of the present application determine the index identifier of the metadata in the file system; determine the target storage list corresponding to the metadata and the target storage position corresponding to the metadata in the target storage list from the storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store the preset value of metadata; store the metadata in the target storage position in the target storage list, so that the storage position of each metadata in the file system is unique and fixed, without the risk of mutual overwriting, and eliminating the coupling between the metadata in the storage position; and make each metadata in the file system independent of each other, without logical dependency, so that damage to a certain metadata will not affect other metadata, eliminating the coupling between the metadata in the storage relationship, thereby improving the accuracy and reliability of the metadata. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Other features, objects and advantages of the present application will become more apparent upon reading the detailed description of non-limiting embodiments made with reference to the following drawings:
[0024] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present application may be applied;
[0025] Figure 2 is a flowchart of an embodiment of a metadata management method according to the present application;
[0026] Figure 3 is a schematic diagram of an application scenario of the metadata management method according to this embodiment;
[0027] Figure 4 This is a schematic diagram of the structure of the metadata file based on the directory tree method according to the present application;
[0028] Figure 5 is a schematic diagram of the structure of the storage list according to the present application;
[0029] Figure 6 is a schematic diagram of modifying metadata according to the file system of this application;
[0030] Figure 7 is a schematic diagram of updating metadata in a storage list and metadata in a metadata file based on a log file according to the present application;
[0031] Figure 8 is a flowchart of another embodiment of a metadata management method according to the present application;
[0032] Figure 9 is a structural diagram of an embodiment of a metadata management device according to the present application;
[0033] Figure 10 It is a structural diagram of a computer system suitable for implementing the embodiments of the present application. DETAILED DESCRIPTION
[0034] The present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the relevant invention and are not intended to limit the invention. It should also be noted that, for ease of description, only portions relevant to the relevant invention are shown in the accompanying drawings.
[0035] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in this application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0036] Figure 1 An exemplary architecture 100 is shown to which the metadata management method and apparatus of the present application can be applied.
[0037] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, and 103, a network 104, and a server 105. The communication connections between terminal devices 101, 102, and 103 constitute a topological network, and network 104 is used to provide a medium for communication links between terminal devices 101, 102, and 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0038] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to perform operations such as reading, writing, and modifying files in the file system. Terminal devices 101, 102, 103 can be hardware devices or software that support network connection for data interaction and data processing. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices that support network connection, information acquisition, interaction, display, processing and other functions, including but not limited to smart phones, tablet computers, e-book readers, laptop computers and desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules for providing distributed services, for example, or they can be implemented as a single software or software module. No specific limitation is made here.
[0039] The server 105 may be a server providing various services, for example, a background processing server that manages metadata of the file system targeted by operation requests from the terminal devices 101, 102, and 103 through storage lists in the storage list set.
[0040] It should be noted that the server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules (e.g., software or software modules for providing distributed services), or as a single software or software module. No specific limitations are given here.
[0041] It should also be noted that the metadata management method provided in the embodiments of the present application can be executed by a server, a terminal device, or a server and a terminal device in collaboration. Accordingly, the various components (e.g., various units) included in the metadata management apparatus can be entirely located in the server, entirely located in the terminal device, or separately located in the server and the terminal device.
[0042] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the system architecture is merely illustrative. Any number of terminal devices, networks, and servers may be provided as needed. When the electronic device on which the metadata management method is running does not need to transmit data to other electronic devices, the system architecture may only include the electronic device (e.g., a server or terminal device) on which the metadata management method is running.
[0043] Continue to refer Figure 2 , a process 200 of an embodiment of a metadata management method is shown, comprising the following steps:
[0044] Step 201: Determine the index identifier of the metadata in the file system.
[0045] In this embodiment, the execution subject of the metadata management method (eg Figure 1 The terminal device or server in the file system can determine the index identifier of the metadata in the file system.
[0046] Files in the file system are stored on the hard drive. The smallest storage unit of a hard drive is called a sector. Each sector stores 512 bytes (equivalent to 0.5KB) of data. When the operating system reads the hard drive, it does not read sector by sector, which is inefficient. Instead, it reads multiple sectors at a time, or a block. This block, composed of multiple sectors, is the smallest unit of file access. The most common block size is 4KB, meaning eight consecutive sectors make up a block.
[0047] File data in the file system is stored in blocks, and the file metadata is stored in inodes. Each inode has a number, which is the index identifier. The operating system uses the index identifier to identify different files.
[0048] File system metadata is system data used to describe the characteristics of files in the file system, including but not limited to the file's byte count, the file owner's user ID (identity document), the file's GroupID, the file's read, write, and execute permissions, and the file's timestamp. File timestamps include the time of the last change to the file or directory (permissions / attributes), the last access to the file or directory, and the last modification to the file or directory (content / data).
[0049] For each piece of metadata in the file system, the execution entity may determine an index identifier of the metadata.
[0050] Step 202: Determine a target storage list corresponding to the metadata and a target storage position corresponding to the metadata in the target storage list from the storage list set according to the index identifier and the preset value.
[0051] In this embodiment, the execution entity can determine the target storage list corresponding to the metadata and the target storage location corresponding to the metadata in the target storage list from the storage list set based on the index identifier and the preset value. The storage list in the storage list set is used to store the preset value of metadata.
[0052] The storage list set corresponds to the file system and is used to store all metadata in the file system. The storage list set includes at least one storage list, and each storage list can store a preset number of metadata.
[0053] As an example, the above-mentioned execution entity or an electronic device communicatively connected to the above-mentioned execution entity stores a correspondence table that represents the correspondence between each storage location in a storage list in a storage list set and the index identifier of the metadata to be stored in the storage location; further, the above-mentioned execution entity can determine the target storage list corresponding to the index identifier of the metadata to be stored and the target storage position corresponding to the metadata in the target storage list from the correspondence table after determining the index identifier of the metadata.
[0054] As another example, the execution entity or an electronic device communicatively connected to the execution entity stores a correspondence table representing the correspondence between storage lists in a storage list set and the range of index identifiers of metadata to be stored in the storage lists. Furthermore, the metadata is stored in the storage lists in ascending order of index identifiers. Furthermore, after determining the index identifier of the metadata, the execution entity can determine from the correspondence table the target storage list corresponding to the index identifier of the metadata to be stored, and then determine the target storage location corresponding to the metadata from the target storage list based on the ascending order of index identifiers.
[0055] In some optional implementations of this embodiment, the execution entity may perform step 202 as follows:
[0056] First, a modulo operation is performed on the index identifier and the preset value to obtain an integer value and a remainder value.
[0057] In this implementation, the execution entity can determine the integer value and the remainder value using the following formula:
[0058] file_x=inode_x / m
[0059] offset_in_file=inode_x%m
[0060] In which, inode_x represents the index identifier of the metadata, m represents a preset value, file_x represents an integer value, and offset_in_file represents a remainder value.
[0061] Second, a target storage list is determined from the storage list set according to the integer value.
[0062] In this implementation, the storage lists in the storage list set are numbered starting from 0 in ascending order. Metadata is stored in ascending order of index identifiers within the storage list set, in ascending order of list numbers, and in each storage list, from the beginning to the end of the list.
[0063] In this implementation, the storage list corresponding to the number represented by the integer value is determined as the target storage list of the metadata.
[0064] Third, according to the remainder value, the target storage location is determined from the target storage list.
[0065] In this implementation, each storage list includes m storage locations, corresponding to location numbers 1 to m. The execution entity can directly determine the storage location corresponding to the location number represented by the remainder value as the target storage location.
[0066] In this implementation, metadata is stored in ascending order of index identifiers within the storage list set, in ascending order of list numbers, and from the beginning to the end of each storage list. This allows for rapid determination of the target storage list corresponding to the metadata and the target storage location corresponding to the metadata within the target storage list by performing a modulo operation on the index identifier and a preset value, improving efficiency and convenience in determining information.
[0067] Step 203: Store the metadata in the target storage location in the target storage list.
[0068] In this embodiment, the execution entity may store the metadata in a target storage location in the target storage list.
[0069] For each piece of metadata in the file system, the above-mentioned execution entity can determine the target storage list for storing the metadata and the target storage location in the target storage list based on steps 201-203, and store the metadata to the target storage location in the corresponding target storage list, thereby realizing the storage of each piece of metadata in the entire file system based on the storage list.
[0070] Continue to see Figure 3 , Figure 3 FIG3 is a schematic diagram 300 of an application scenario of the metadata management method according to this embodiment. Figure 3 In the application scenario, the file system 301 includes N pieces of metadata, and the index identifiers of the N pieces of metadata are 1, 2, 3...N in sequence. To store the metadata in the file system 301, a storage list set 302 is set in the server where the file system is deployed. The storage list set always includes multiple storage lists, and each storage list is used to store a preset value (m) of metadata. After determining the index identifier of the metadata in the file system, the server determines the target storage list corresponding to the metadata and the target storage location corresponding to the metadata in the target storage list from the storage list set based on the index identifier and the preset value. Finally, each piece of metadata in the file system is stored in the target storage location in the target storage list corresponding to the metadata.
[0071] The method provided by the above-mentioned embodiment of the present application determines the index identifier of the metadata in the file system; determines the target storage list corresponding to the metadata and the target storage position corresponding to the metadata in the target storage list from the storage list set according to the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; stores the metadata in the target storage position in the target storage list, so that the storage position of each metadata in the file system is unique and fixed, without the risk of mutual overwriting, and eliminating the coupling between the metadata in the storage position; and makes each metadata in the file system independent of each other, without logical dependency, so that damage to a certain metadata will not affect other metadata, eliminating the coupling between the metadata in the storage relationship, thereby improving the accuracy and reliability of the metadata.
[0072] In some optional implementations of this embodiment, the file system also uses metadata files based on a directory tree to manage the metadata of the file system. Figure 4 , shows a schematic structural diagram of a metadata file 400 based on a directory tree.
[0073] In this implementation, the above-mentioned execution entity may also perform the following operations: perform consistency check on the metadata in the storage list in the storage list set and the metadata in the metadata file; in response to determining that the metadata in the storage list in the storage list set and the metadata in the metadata file are inconsistent, repair the metadata in the storage list in the storage list set, or the metadata in the metadata file.
[0074] As an example, when metadata A is included in the storage list in the storage list set, but metadata A is not included in the metadata file, the above-mentioned execution entity can refer to the storage list in the storage list set to repair the metadata file; when metadata B is included in the metadata file, but metadata B is not included in the storage list in the storage list set, the above-mentioned execution entity can refer to the metadata file to repair the storage list in the storage list set.
[0075] Continue to refer Figure 5 , showing a schematic diagram of the structure of the storage list 500, and Figure 4 In the storage list, each storage location stores metadata and the index identifier of the parent directory corresponding to the metadata, that is, the inode number.
[0076] In this implementation, metadata is stored in a heterogeneous dual backup manner combining storage lists and metadata files, and consistency verification and repair of metadata can be achieved based on the two backup methods, further improving the accuracy and reliability of metadata.
[0077] In some optional implementations of this embodiment, the above-mentioned execution entity may also perform the following operations: first, determine the modification operation information representing the modification of metadata in the file system from the log file; then, based on the modification operation information, update the metadata in the metadata file.
[0078] In some optional implementations of this embodiment, the above-mentioned execution entity can also perform the following operations: first, determine the modification operation information representing the modification of metadata in the file system from the log file; then, based on the modification operation information, update the metadata in the storage list in the storage list set.
[0079] Continue to refer Figure 6 , shows a schematic diagram of file system metadata modification 600. When modifying the metadata of the file system, the modification operation issued by the client will be written to the log file and an indication of whether the modification is successful will be returned.
[0080] Continue to refer Figure 7 , shows a schematic diagram 700 of updating metadata in a storage list and metadata files based on a log file. The changes in the log file are applied asynchronously. The modification operation information in the log file is split into two identical copies when applied, one applied to the metadata file based on the directory tree, and the other applied to the storage list. Figure 7 In the example, the metadata of inode_1, inode_2, and inode_x are modified based on the write operations write_1, write_2, and write_x, respectively.
[0081] In this implementation, since the metadata of the storage list and the metadata in the metadata file are updated in the application corresponding to the log file, there is almost no impact on the performance of the file system. While ensuring the timeliness of metadata modification, it provides adaptability to the file system.
[0082] In some optional implementations of this embodiment, the above-mentioned execution entity can update the metadata in the storage list in the storage list set based on the modification operation information by performing the following operations: first, in response to determining that the multiple metadata corresponding to the multiple modification operations represented by the modification operation information include adjacent metadata in the storage list in the storage list set, merge the modification operations corresponding to the adjacent metadata to obtain a merged modification operation; then, based on the merged modification operation, update the adjacent metadata in the storage list in the storage list set.
[0083] Continue to refer Figure 7, where the metadata corresponding to the index identifiers inode_1, inode_2, and inode_x of the write operations write_1, write_2, and write_x respectively are adjacent metadata, so the two write operations write_1 and write_2 are merged into a merged write operation merge_write_1_2.
[0084] In this implementation, multiple modification operations corresponding to adjacent metadata are merged into one merged modification operation, so that multiple adjacent metadata can be processed through one merged modification operation, which reduces the number of interactions in the metadata modification process and improves the convenience and efficiency of metadata processing.
[0085] In some optional implementations of this embodiment, the execution subject may further perform the following operation: in response to determining that a storage list exists in the storage list set in which all files corresponding to the stored metadata have been deleted, deleting the determined storage list.
[0086] In this implementation, the number of storage lists in the storage list set can dynamically expand and contract as the number of files in the file system changes. When all files corresponding to the metadata in a storage list are deleted, the storage list can be deleted. When the file data in the file system increases, causing the existing storage lists in the storage list set to be unable to meet the metadata storage needs, a new storage list can be created.
[0087] In some optional implementations of this embodiment, the execution subject may further perform the following operation: in response to determining that the file system is deleted, deleting the storage list set.
[0088] In this implementation, the number of storage lists in the storage list set can be dynamically expanded or contracted as the number of files in the file system changes, further improving the flexibility of the metadata management process based on the storage lists.
[0089] Continue to refer Figure 8 , shows a schematic process 800 of an embodiment of a remote plug-in development and publishing method according to the present application, including the following steps:
[0090] Step 801: Determine the index identifier of the metadata in the file system.
[0091] Step 802: Perform a modulo operation on the index identifier and the preset value to obtain an integer value and a remainder value.
[0092] Step 803: Determine a target storage list from the storage list set according to the integer value.
[0093] Step 804: Determine the target storage location from the target storage list according to the remainder value.
[0094] Step 805: Store the metadata to the target storage location in the target storage list.
[0095] Step 806: Perform consistency check on the metadata in the storage list in the storage list set and the metadata in the metadata file.
[0096] In this embodiment, the file system also uses metadata files based on a directory tree to manage metadata of the file system.
[0097] Step 807 : In response to determining that the metadata in the storage list in the storage list set is inconsistent with the metadata in the metadata file, repair the metadata in the storage list in the storage list set or the metadata in the metadata file.
[0098] It can be seen from this embodiment that Figure 2 Compared with the corresponding embodiment, process 800 of the metadata management method in this embodiment specifically illustrates the process of determining the target storage location in the target storage list corresponding to the metadata, the consistency verification process of the metadata in the storage list and the metadata in the metadata file, and the repair process, thereby further improving the accuracy and reliability of the metadata.
[0099] Continue to refer Figure 9 As an implementation of the methods shown in the above figures, the present application provides an embodiment of a metadata management device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0100] like Figure 9 As shown, the metadata management device includes: a first determination unit 901, configured to determine the index identifier of the metadata in the file system; a second determination unit 902, configured to determine the target storage list corresponding to the metadata and the target storage position corresponding to the metadata in the target storage list from the storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; a storage unit 903, configured to store the metadata to the target storage position in the target storage list.
[0101] In some optional implementations of this embodiment, the above-mentioned second determination unit 902 is further configured to: perform a modulo operation on the index identifier and the preset value to obtain an integer value and a remainder value; determine a target storage list from the storage list set based on the integer value; and determine a target storage position from the target storage list based on the remainder value.
[0102] In some optional implementations of this embodiment, the file system also uses a metadata file based on a directory tree to manage the metadata of the file system; and the above-mentioned device also includes: a verification unit (not shown in the figure), configured to perform consistency verification on the metadata in the storage list in the storage list set and the metadata in the metadata file; a repair unit (not shown in the figure), configured to repair the metadata in the storage list in the storage list set, or the metadata in the metadata file, in response to determining that the metadata in the storage list in the storage list set and the metadata in the metadata file are inconsistent.
[0103] In some optional implementations of this embodiment, the above-mentioned device also includes: a first update unit (not shown in the figure), which is configured to determine modification operation information representing the modification of metadata in the file system from the log file; and update the metadata in the metadata file based on the modification operation information.
[0104] In some optional implementations of this embodiment, the above-mentioned device also includes: a second update unit (not shown in the figure), which is configured to determine modification operation information representing the modification of metadata in the file system from the log file; based on the modification operation information, update the metadata in the storage list in the storage list set.
[0105] In some optional implementations of this embodiment, the above-mentioned second update unit (not shown in the figure) is further configured to: in response to determining that the multiple metadata corresponding to the multiple modification operations represented by the modification operation information include adjacent metadata in the storage list in the storage list set, merge the modification operations corresponding to the adjacent metadata to obtain a merged modification operation; based on the merged modification operation, update the adjacent metadata in the storage list in the storage list set.
[0106] In some optional implementations of this embodiment, the above-mentioned device also includes: a first deletion unit (not shown in the figure), which is configured to delete the determined storage list in response to determining that there is a storage list in the storage list set in which all files corresponding to the stored metadata have been deleted.
[0107] In some optional implementations of this embodiment, the apparatus further includes: a second deleting unit (not shown in the figure), configured to delete the storage list set in response to determining that the file system is deleted.
[0108] In this embodiment, a first determination unit in a metadata management device determines an index identifier of metadata in a file system; a second determination unit determines a target storage list corresponding to the metadata and a target storage position corresponding to the metadata in the target storage list from a storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; the storage unit stores the metadata in the target storage position in the target storage list, thereby making the storage position of each metadata in the file system unique and fixed, without the risk of mutual overwriting, and eliminating the coupling between metadata in storage positions; and making each metadata in the file system independent of each other, without logical dependency, so that damage to a certain metadata will not affect other metadata, eliminating the coupling between metadata in storage relationships, thereby improving the accuracy and reliability of the metadata.
[0109] Reference below Figure 10 , which shows a device suitable for implementing the embodiments of the present application (eg Figure 1 Schematic diagram of the structure of the computer system 1000 of the devices 101, 102, 103, 105 shown. Figure 10 The device shown is only an example and should not limit the functions and scope of use of the embodiments of the present application.
[0110] like Figure 10 As shown, the computer system 1000 includes a processor (e.g., CPU, central processing unit) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage unit 1008 into a random access memory (RAM) 1003. Various programs and data required for the operation of the system 1000 are also stored in the RAM 1003. The processor 1001, ROM 1002, and RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0111] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, and the like; an output section 1007 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 1008 including a hard disk; and a communication section 1009 including a network interface card such as a LAN card or a modem. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 1010 as needed, so that computer programs read therefrom can be installed into the storage section 1008 as needed.
[0112] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 1009 and / or installed from the removable medium 1011. When the computer program is executed by the processor 1001, the above-mentioned functions defined in the method of the present application are performed.
[0113] It should be noted that the computer-readable medium of the present application may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or device. In the present application, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0114] Computer program code for performing the operations of the present application may be written in one or more programming languages, or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the client computer, partially on the client computer, as a stand-alone software package, partially on the client computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the client computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0115] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the devices, methods and computer program products according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, program segment or a part of code, and the module, program segment or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified function or operation, or can be implemented by a combination of dedicated hardware and computer instructions.
[0116] The units involved in the embodiments described in the present application can be implemented by software or by hardware. The units described can also be set in a processor. For example, they can be described as: a processor comprising a first determination unit, a second determination unit, and a storage unit. The names of these units do not constitute a limitation on the units themselves under certain circumstances. For example, the second determination unit can also be described as "a unit that determines the target storage list corresponding to the metadata and the target storage location corresponding to the metadata in the target storage list from the storage list set according to the index identifier and the preset value."
[0117] As another aspect, the present application also provides a computer-readable medium, which may be included in the device described in the above embodiment; or may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by the device, the computer device: determines the index identifier of the metadata in the file system; determines the target storage list corresponding to the metadata and the target storage location corresponding to the metadata in the target storage list from the storage list set based on the index identifier and a preset value, wherein the storage list in the storage list set is used to store a preset value of metadata; and stores the metadata in the target storage location in the target storage list.
[0118] The above description is merely a preferred embodiment of the present application and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also encompasses other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned inventive concept. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this application.
Claims
1. A metadata management method, comprising: Determine the index identifier of the metadata in the file system; Determining, from a storage list set, a target storage list corresponding to the metadata and a target storage location corresponding to the metadata in the target storage list according to the index identifier and the preset value, wherein a storage list in the storage list set is used to store the preset value of metadata; The metadata is stored in the target storage location in the target storage list.
2. The method according to claim 1, wherein The step of determining, from a storage list set according to the index identifier and the preset value, a target storage list corresponding to the metadata and a target storage location corresponding to the metadata in the target storage list includes: Performing a modulo operation on the index identifier and the preset value to obtain an integer value and a remainder value; determining the target storage list from the storage list set according to the integer value; The target storage location is determined from the target storage list according to the remainder value.
3. The method according to claim 1, wherein The file system also uses metadata files based on a directory tree to manage metadata of the file system; as well as Also includes: Performing a consistency check on the metadata in the storage list in the storage list set and the metadata in the metadata file; In response to determining that the metadata in the storage list in the storage list set and the metadata in the metadata file are inconsistent, the metadata in the storage list in the storage list set or the metadata in the metadata file is repaired.
4. The method according to claim 3, wherein: Also includes: Determining modification operation information representing modification of metadata in the file system from the log file; Based on the modification operation information, the metadata in the metadata file is updated.
5. The method according to claim 1, wherein Also includes: Determining modification operation information representing modification of metadata in the file system from the log file; Based on the modification operation information, metadata in the storage list in the storage list set is updated.
6. The method according to claim 5, wherein: The updating of metadata in the storage list in the storage list set based on the modification operation information includes: In response to determining that the plurality of metadata corresponding to the plurality of modification operations represented by the modification operation information include adjacent metadata in the storage list in the storage list set, merging the modification operations corresponding to the adjacent metadata to obtain a merged modification operation; Based on the post-merge modification operation, the adjacent metadata in the storage lists in the storage list set are updated.
7. The method according to claim 1, wherein Also includes: In response to determining that a storage list in which all files corresponding to the stored metadata are deleted exists in the storage list set, the determined storage list is deleted.
8. The method according to claim 1, wherein Also includes: In response to determining that the file system is deleted, the storage list set is deleted.
9. A metadata management device, comprising: A first determining unit is configured to determine an index identifier of metadata in the file system; a second determining unit configured to determine, from a storage list set, a target storage list corresponding to the metadata and a target storage location corresponding to the metadata in the target storage list according to the index identifier and a preset value, wherein a storage list in the storage list set is used to store the preset value of metadata; The storage unit is configured to store the metadata in the target storage location in the target storage list.
10. A computer-readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
11. An electronic device comprising: one or more processors; a storage device having one or more programs stored thereon, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Data processing method and device
CN107092564A
Metadata management method of distributed file system in power grid dispatching control system
CN111427862A