Data processing method, device, electronic device and storage medium

By classifying and storing metadata in the erasure storage file system, the problems of low metadata access efficiency and high hardware consumption in the existing technology are solved, and efficient metadata access and data processing are achieved.

CN114936188BActive Publication Date: 2024-10-11CHONGQING UNISINSIGHT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210601204.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2024-10-11
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

When existing technology improves metadata access efficiency, it increases hardware consumption, resulting in higher data processing costs, and it is difficult to effectively reduce metadata access pressure.

Method used

By classifying metadata according to access frequency in the erasure storage file system, the first type of metadata and the second type of metadata are generated, and stored in the system disk and data disk respectively, reducing unnecessary metadata access and reducing costs. The number of accesses to the data disk.

Benefits of technology

It improves the efficiency of metadata access, reduces the pressure on the data disk, reduces the amount of metadata access, and improves the efficiency of data access and the read and write performance of metadata.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114936188B_ABST
    Figure CN114936188B_ABST
Patent Text Reader

Abstract

The present application provides a data processing method, device, electronic device and storage medium, and relates to the field of data processing technology. The method includes: obtaining a file creation request, the file creation request includes: the size of the target file, the name of the target file; according to the size of the target file, the preset erasure ratio, and the preset size of the data block, determining the number of objects into which the target file is divided, and the number of data blocks contained in each object; according to the preset erasure ratio, creating a data block for each object on each selected disk, and generating file creation information; according to the file creation information, generating the first type of metadata and the second type of metadata of the target file respectively and storing the first type of metadata and the second type of metadata, and storing the first type of metadata in the system disk of the file system, and storing the second type of metadata in the data disk of the file system. This method can reduce the amount of data access and improve data access efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data processing method, device, electronic device and storage medium. Background Art

[0002] With the advent of the big data era, massive amounts of data need to be stored. Erasure Code (EC) is a commonly used data protection method that can achieve higher data reliability with less data redundancy. Massive data storage will generate a large amount of metadata, which mainly describes data attribute information. Erasure calculations require data to be segmented and saved. Therefore, when erasure storage is used, the amount of metadata data will become larger. When accessing data, metadata is usually accessed first. Therefore, it is particularly important to improve the access performance of metadata.

[0003] Currently, the commonly used method to optimize metadata access speed is mainly through hardware acceleration and multiple servers sharing access pressure to improve data access efficiency.

[0004] However, the above method will increase hardware consumption to a certain extent, making the data processing cost higher. Summary of the invention

[0005] The purpose of the present application is to provide a data processing method, device, electronic device and storage medium to improve metadata access efficiency and thus improve data processing efficiency in view of the deficiencies in the above-mentioned prior art.

[0006] To achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:

[0007] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to a file system based on erasure storage, and the method includes:

[0008] Obtaining a file creation request, wherein the file creation request includes: the size of the target file and the name of the target file;

[0009] Determining the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block;

[0010] According to the preset erasure ratio, a data block of each object is created on each selected disk, and file creation information is generated, wherein the file creation information includes: a file name, a file size, a file storage path, a file identifier, a file creation time, a number of objects included in the file, and information of each data block in each object included in the file, wherein the data blocks in each object include valid data blocks and redundant data blocks, and the data blocks under the same object are distributed on different disks of the selected file system;

[0011] According to the file creation information, first-category metadata and second-category metadata of the target file are respectively generated, and the first-category metadata is stored in a system disk of the file system, and the second-category metadata is stored in a data disk of the file system; the first-category metadata includes: basic information of the target file, and an association relationship between the first-category metadata and the second-category metadata, the second-category metadata includes: data block information of the target file, and an access frequency of the first-category metadata is greater than an access frequency of the second-category metadata.

[0012] Optionally, the generating the first type of metadata and the second type of metadata of the target file respectively according to the file creation information includes:

[0013] Generate basic information of the target file according to the file name, file size, file creation time, file storage path, and the number of objects contained in the file, and generate an association relationship between the first category of metadata and the second category of metadata according to the file identifier and information of each data block in each object contained in the file, wherein the association relationship is used to characterize a mapping relationship between the file identifier of the target file and each data block in each object contained in the file;

[0014] Obtaining the first-category metadata of the target file according to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata;

[0015] The data block information of the target file is generated according to the information of each data block in each object contained in the file, and the data block information is used as the second-type metadata.

[0016] Optionally, after respectively generating the first type of metadata and the second type of metadata of the target file according to the file creation information, and storing the first type of metadata in a system disk of the file system, and storing the second type of metadata in a data disk of the file system, the method includes:

[0017] Obtaining a file write request for the target file, the file write request including: a name of the target file and file data of the target file;

[0018] According to the name of the target file, determining whether the target file exists from the created files;

[0019] If so, determining redundant data contained in each object of the target file according to the file data of the target file, wherein the redundant data is used to restore the file data of the target file;

[0020] The redundant data contained in each object of the target file is written into the redundant data block of each object, the file data of the target file is written into the valid data block of each object respectively, and the first type metadata and the second type metadata corresponding to the target file are updated.

[0021] Optionally, after writing the redundant data contained in each object of the target file into a redundant data block of each object and writing the file data of the target file into a valid data block of each object, the method includes:

[0022] Obtaining a file read request for the target file, the file read request including: the name of the target file, the size of the target file, read offset information, and read length information;

[0023] According to the name of the target file and the read offset information, query the first type metadata of each file in the system disk to determine the information of each data block corresponding to the target file;

[0024] According to the information of each data block corresponding to the target file, the target file is read from the corresponding disk according to the read offset information and the read length information.

[0025] Optionally, according to the name of the target file and the read offset information, querying the first type metadata of each file in the system disk to determine the information of each data block corresponding to the target file includes:

[0026] Determine the file identifier of the target file according to the name of the target file;

[0027] According to the file identifier of the target file, query the association relationship between the first type of metadata and the second type of metadata of each file to determine the second type of metadata corresponding to the target file;

[0028] Query the second type of metadata to obtain information about the disk to which each data block of the target file belongs;

[0029] According to the read offset information, the information of the disk to which the target data block corresponding to the target file belongs is determined from the information of each data block corresponding to the target file.

[0030] Optionally, reading the target file from a corresponding disk according to the information of each data block corresponding to the target file and the read offset information and the read length information includes:

[0031] According to the information of the disk to which the target data block corresponding to the target file belongs, and in accordance with the read offset information and the read length information, the file data stored in each target data block is read from the disk to which each target data block belongs;

[0032] The target file is obtained by combining the file data stored in each of the read target data blocks.

[0033] Optionally, the reading of the file data stored in each target data block from the disk to which each target data block belongs includes:

[0034] If the target disk fails to be read, and the data stored in the target data block on the target disk is valid data, erasure calculation is performed to recover the valid data in the target data block on the target disk, where the target disk is any disk corresponding to each target data block.

[0035] Optionally, the performing erasure correction calculation to recover valid data in a target data block on the target disk includes:

[0036] The valid data in the target data block on the target disk is calculated based on the valid data read from the target data block on the disk other than the target disk and the redundant data.

[0037] Optionally, before creating a data block of each object on each selected disk according to the preset erasure ratio, the method includes:

[0038] Determining the number of disks to be selected according to the preset erasure ratio;

[0039] The number of disks is selected from the plurality of disks in the file system according to the disk weight of each disk in the file system, wherein the disk weight of each disk is determined according to the capacity of each disk and the total capacity of the system disks.

[0040] Optionally, the first type of metadata is stored in the form of key-value pairs.

[0041] In a second aspect, an embodiment of the present application further provides a data processing device, which is applied to a file system based on erasure storage, and the device includes: an acquisition module, a determination module, and a generation module;

[0042] The acquisition module is used to acquire a file creation request, wherein the file creation request includes: the size of the target file and the name of the target file;

[0043] The determination module is used to determine the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block;

[0044] The generation module is used to create a data block of each object on each selected disk according to the preset erasure ratio, and generate file creation information, wherein the file creation information includes: the file name, file size, file storage path, file identifier, file creation time, the number of objects contained in the file, and information of each data block in each object contained in the file, wherein the data block in each object includes a valid data block and a redundant data block, and the data blocks under the same object are distributed on different disks of the selected file system;

[0045] The generation module is used to generate first-category metadata and second-category metadata of the target file according to the file creation information, and store the first-category metadata in a system disk of the file system, and store the second-category metadata in a data disk of the file system; the first-category metadata includes: basic information of the target file, and an association relationship between the first-category metadata and the second-category metadata; the second-category metadata includes: data block information of the target file; and an access frequency of the first-category metadata is greater than an access frequency of the second-category metadata.

[0046] Optionally, the generating module is specifically used to generate basic information of the target file according to the file name, file size, file creation time, file storage path and the number of objects contained in the file, and generate an association relationship between the first category metadata and the second category metadata according to the file identifier and information of each data block in each object contained in the file, wherein the association relationship is used to characterize a mapping relationship between the file identifier of the target file and each data block in each object contained in the file;

[0047] Obtaining the first-category metadata of the target file according to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata;

[0048] The data block information of the target file is generated according to the information of each data block in each object contained in the file, and the data block information is used as the second-type metadata.

[0049] Optionally, the device further comprises: a writing module;

[0050] The acquisition module is further used to acquire a file write request for the target file, wherein the file write request includes: a name of the target file and file data of the target file;

[0051] The determination module is further used to determine whether the target file exists from the created files according to the name of the target file;

[0052] The determination module is further configured to determine, if any, redundant data contained in each object of the target file based on the file data of the target file, wherein the redundant data is used to restore the file data of the target file;

[0053] The writing module is used to write the redundant data contained in each object of the target file into the redundant data block of each object, write the file data of the target file into the valid data block of each object respectively, and update the first type metadata and the second type metadata corresponding to the target file.

[0054] Optionally, the device further comprises: a reading module;

[0055] Optionally, the acquisition module is further used to acquire a file read request for the target file, the file read request including: the name of the target file and the size of the target file, read offset information and read length information;

[0056] The determination module is further used to query the first type of metadata of each file in the system disk according to the name of the target file and the read offset information, and determine the information of each data block corresponding to the target file;

[0057] The reading module is used to read the target file from the corresponding disk according to the information of each data block corresponding to the target file, the read offset information and the read length information.

[0058] Optionally, the determination module is specifically used to determine the file identifier of the target file according to the name of the target file;

[0059] According to the file identifier of the target file, query the association relationship between the first type of metadata and the second type of metadata of each file to determine the second type of metadata corresponding to the target file;

[0060] Query the second type of metadata to obtain information about the disk to which each data block of the target file belongs;

[0061] According to the read offset information, the information of the disk to which the target data block corresponding to the target file belongs is determined from the information of each data block corresponding to the target file.

[0062] Optionally, the reading module reads the file data stored in each target data block from the disk to which each target data block belongs, specifically according to the information of the disk to which the target data block corresponding to the target file belongs, and according to the read offset information and the read length information;

[0063] The target file is obtained by combining the file data stored in each of the read target data blocks.

[0064] Optionally, the reading module performs erasure calculation to recover the valid data in the target data block on the target disk if the reading of the target disk fails and the data stored in the target data block on the target disk is valid data. The target disk is any disk among the disks corresponding to each target data block.

[0065] Optionally, the reading module calculates the valid data in the target data block on the target disk based on the valid data and redundant data read from the target data block on a disk other than the target disk.

[0066] Optionally, the determination module is further used to determine the number of disks to be selected according to the preset erasure ratio;

[0067] The number of disks is selected from the plurality of disks in the file system according to the disk weight of each disk in the file system, wherein the disk weight of each disk is determined according to the capacity of each disk and the total capacity of the system disks.

[0068] Optionally, the first type of metadata is stored in the form of key-value pairs.

[0069] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to perform the steps of the method provided in the first aspect.

[0070] In a fourth aspect, an embodiment of the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of the method provided in the first aspect are executed.

[0071] The beneficial effects of this application are:

[0072] The present application provides a data processing method, device, electronic device and storage medium, the method comprising: obtaining a file creation request, the file creation request comprising: the size of a target file and the name of the target file; determining the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio and a preset size of a data block; creating a data block of each object on each selected disk according to the preset erasure ratio, and generating file creation information; generating first-class metadata and second-class metadata of the target file according to the file creation information, storing the first-class metadata and the second-class metadata, storing the first-class metadata in a system disk of a file system, and storing the second-class metadata in a data disk of a file system. This method classifies the metadata information of the file according to the access frequency, generates the first category metadata and the second category metadata respectively, and stores the first category metadata in the system disk of the file system, and stores the second category metadata in the data disk of the file system. Since not all information in the metadata is accessed during the data access process, based on the above classification of metadata, by separately storing the first category metadata with high frequency access and the second category metadata with low frequency access, metadata access can be performed according to access requirements, thereby reducing unnecessary metadata access, reducing the data access amount to a certain extent, and improving data access efficiency. In addition, the first category metadata and the second category metadata are respectively stored in the system disk and the data disk, which can reduce the number of data disk accesses and reduce the pressure on the data disk when accessing data.

[0073] In addition, based on the classified storage of the first type of metadata and the second type of metadata, the amount of metadata that needs to be updated when modifying metadata information can be reduced, thereby improving the reading and writing performance of metadata. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0075] Figure 1 A schematic diagram of the structure of an erasure storage file system provided in an embodiment of the present application;

[0076] Figure 2 A disk space partitioning schematic diagram provided for an embodiment of the present application;

[0077] Figure 3 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 1 ;

[0078] Figure 4 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 2 ;

[0079] Figure 5 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 3 ;

[0080] Figure 6 A schematic diagram of data separation storage based on erasure storage provided in an embodiment of the present application;

[0081] Figure 7 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 4 ;

[0082] Figure 8 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 5 ;

[0083] Fig. 9 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 6 ;

[0084] Fig.10 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 7 ;

[0085] Fig.11 A schematic diagram of the architecture of a data processing system provided in an embodiment of the present application;

[0086] Fig.12 A schematic diagram of data block reading provided in an embodiment of the present application;

[0087] Fig.13 Another data block reading schematic diagram provided in an embodiment of the present application;

[0088] Fig.14 A schematic diagram of a data processing device provided in an embodiment of the present application;

[0089] Fig.15 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0090] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. It should be understood that the drawings in the present application only serve the purpose of explanation and description and are not used to limit the scope of protection of the present application. In addition, it should be understood that the schematic drawings are not drawn in real proportion. The flowchart used in this application shows the operations implemented according to some embodiments of the present application. It should be understood that the operations of the flowchart can be implemented out of sequence, and the steps without logical context can be reversed in order or implemented simultaneously. In addition, those skilled in the art can add one or more other operations to the flowchart under the guidance of the content of the present application, or remove one or more operations from the flowchart.

[0091] In addition, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.

[0092] It should be noted that the term "comprising" will be used in the embodiments of the present application to indicate the existence of the features declared thereafter, but does not exclude the addition of other features.

[0093] Before introducing the present application method, the concept of metadata is explained first. Metadata is mainly information that describes data attributes. For a file, metadata not only records the name, type, access rights, size, storage path, etc. of the file data, but also records the file storage location, file source, etc. When accessing data, the file metadata is usually accessed first. Therefore, during the data access process, the access frequency of the file metadata is very high, far exceeding the access to the file data itself.

[0094] When reading a file, you first need to access the metadata before accessing the data. After querying the file size, access authorization, and storage location based on the file name and other information, you can read the specific file data from the storage disk based on the file storage location information. However, a large number of file access requests may not ultimately require the acquisition of specific file data, but only access to basic file information. In this case, you only need to access metadata, and not all information in metadata needs to be accessed every time it is accessed. If all metadata of the file is obtained for each access, the metadata access efficiency will be low.

[0095] Based on this, this application proposes a method of storing data based on erasure correction technology. In this context, the metadata of the file can be separated, and the high-temperature metadata can be stored in the system disk through a key-value pair database, and the low-temperature metadata can be stored in the data disk. According to the access requirements, only the high-temperature metadata can be accessed, or the high-temperature metadata and the low-temperature metadata can be accessed, thereby avoiding accessing both high-temperature and low-temperature metadata at the same time every time, thereby improving the metadata access efficiency. It should be noted here that high-temperature metadata has a higher access frequency and is easier to access than low-temperature metadata.

[0096] Figure 1 A schematic diagram of the structure of an erasure storage file system provided in an embodiment of the present application is shown in FIG. Figure 1 The storage structure of a file in a file system based on erasure storage is shown as an example. All file data in the file system based on erasure storage have the same storage structure. Figure 1 As shown, file data can be divided into multiple data segments, each data segment is stored as an object, and each object may include multiple data blocks, which may include valid data blocks and redundant data blocks. The data block storing file data can be used as a valid data block, and the data block storing redundant data can be used as a redundant data block. The redundant data can be used to recover damaged valid data. The number of data blocks included in each object can be determined according to a preset correction and erasure ratio, and the data blocks under each object are distributed on different disks of the file system.

[0097] Figure 2 A disk space partition diagram provided in an embodiment of the present application, such as Figure 2 As shown, for Figure 1 For any disk, its disk space may include: a reserved area, a super block, and multiple block groups. Each block group may include: an index area and a data area. Each index area may include a primary index area and a backup index area. The primary and backup index areas include the same information. Taking the primary index area as an example, the primary index area may include multiple sub-index units. A sub-index unit may include 64 file nodes. Each file node stores metadata information of the data block, which may include: the usage status of the data block, file name, file creation time, file modification time, file sequence number, the capacity occupied by the current data block, etc.

[0098] The data area may include 4096 data blocks, each of which stores specific file data. The size of each data block is 64M, and each data block and its corresponding metadata are stored in a block group.

[0099] The super block stores information such as the number of index units, the number of block groups, and the size of data blocks.

[0100] Figure 3 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 1 ; The execution subject of this method can be an electronic device or a processing device such as a processor. This method can be applied to the above Figure 1 In the file system based on erasure storage shown in Figure 3 As shown, the method may include:

[0101] S301. Obtain a file creation request, where the file creation request includes: the size of the target file and the name of the target file.

[0102] The prerequisite for reading and writing files is to create the file first. After the file is created, data can be written to the created file. After writing the data, the file can be read.

[0103] Optionally, a file may be created according to a file creation request. Creating a file here means creating an empty file, and the created file does not include any specific data yet.

[0104] The file creation request may include: the size of the target file and the name of the target file. The target file here may refer to any file to be created currently.

[0105] S302: Determine the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block.

[0106] Here, the erasure ratio can be determined according to the erasure strategy. After the erasure strategy is selected, the erasure ratio is determined. The erasure strategy mainly encodes the original data through the erasure code algorithm to obtain redundant data, and stores the file data and the redundant data together to achieve the purpose of fault tolerance.

[0107] As described above, the preset data block size can be 64M. Assuming that the size of the target file is 1GB (1024M), and the preset erasure ratio is 4:1, then, according to the size of the target file and the size of the preset data block, it can be calculated that the number of data blocks corresponding to the target file is 1024 / 64=16, and the preset erasure ratio is 4:1, which means that one object includes 5 data blocks, of which 4 data blocks are valid data blocks and 1 data block is a redundant data block. Since one object can include 4 valid data blocks to store file data, then, when the target file corresponds to 16 data blocks, the number of objects corresponding to the target file is 4, so that the data of the target file can be stored in each object respectively.

[0108] Based on the above analysis, the number of objects into which the target file is divided and the number of data blocks contained in each object can be determined. When the size of the target file and the preset erasure ratio change, the number of objects into which the target file is divided and the number of data blocks contained in each object can still be determined according to the above method.

[0109] S303: Create a data block for each object on each selected disk according to a preset erasure correction ratio, and generate file creation information.

[0110] Among them, the file creation information may include: the file name of the target file, the file size, the file storage path, the file identifier, the file creation time, the number of objects contained in the file, and the information of each data block in each object contained in the file, wherein the data blocks in each object include valid data blocks and redundant data blocks, and the data blocks under the same object are distributed on different disks of the selected file system.

[0111] In some embodiments, the number of disks to be used to create data blocks can also be determined based on a preset erasure ratio. As described above, the number of data blocks contained in an object can be determined based on the preset erasure ratio. Since the data blocks under the same object are distributed on different disks of the file system, the number of disks to be selected corresponds to the number of data blocks under an object.

[0112] Optionally, based on the selected disks, a data block under an object may be created on each disk, thereby completing the creation of the target file and generating file creation information.

[0113] S304. Generate first-category metadata and second-category metadata of the target file according to the file creation information and store the first-category metadata and the second-category metadata respectively, and store the first-category metadata in the system disk of the file system and store the second-category metadata in the data disk of the file system.

[0114] The first type of metadata includes: basic information of the target file, and the association relationship between the first type of metadata and the second type of metadata. The second type of metadata includes: data block information of the target file. The access frequency of the first type of metadata is greater than the access frequency of the second type of metadata.

[0115] The first type of metadata here may refer to the high-heat metadata mentioned above, and the second type of metadata may refer to the low-heat metadata.

[0116] In some embodiments, the first category metadata and the second category metadata of the target file can be generated according to the file creation information generated above, wherein the first category metadata can be generated according to some information in the file creation information, and the second category metadata can be generated according to other information in the file creation information, and the generated first category metadata and second category metadata can be stored.

[0117] Optionally, in this embodiment, the generated first-category metadata can be stored in a system disk of the file system. From a computer perspective, the system disk is the disk where the system is installed in the computer, usually the C drive. The second-category metadata can be stored in a data disk of the file system. The data disk is a disk other than the system disk used to store data, usually the D drive, E drive, etc.

[0118] It should be noted that the first category of metadata here may also include the association relationship between the first category of metadata and the second category of metadata. In some scenarios, when only the basic file information of the target file needs to be accessed, it can be achieved by accessing the basic information of the target file in the first category of metadata. In other scenarios, when the file data of the target file needs to be accessed, the basic information of the target file in the first category of metadata and the association relationship between the first category of metadata and the second category of metadata can be accessed to determine the information of the data block of the target file, and then the file data of the target file can be read from the disk according to the information of the data block. By establishing the association relationship between the first category of metadata and the second category of metadata, the amount of metadata data that needs to be obtained can be reduced when accessing metadata information.

[0119] Since not all information in metadata is accessed during data access, based on the above classification of metadata, by storing the first-category metadata with high frequency access and the second-category metadata with low frequency access separately, metadata access can be performed according to access requirements, thereby reducing unnecessary metadata access, which can reduce the amount of data access to a certain extent and improve data access efficiency. And the first-category metadata and the second-category metadata are stored on the system disk and the data disk respectively, which can reduce the number of data disk accesses and reduce the pressure on the data disk when accessing data. In addition, based on the classified storage of the first-category metadata and the second-category metadata, the amount of metadata data that needs to be updated when modifying metadata information can be reduced, thereby improving the read and write performance of metadata.

[0120] In summary, the data processing method provided in this embodiment includes: obtaining a file creation request, the file creation request includes: the size of the target file and the name of the target file; determining the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset data block size; creating a data block for each object on each selected disk according to the preset erasure ratio, and generating file creation information; generating first-class metadata and second-class metadata of the target file according to the file creation information, and storing the first-class metadata and the second-class metadata, and storing the first-class metadata in the system disk of the file system, and storing the second-class metadata in the data disk of the file system. This method classifies the metadata information of the file according to the access frequency, generates the first category metadata and the second category metadata respectively, and stores the first category metadata in the system disk of the file system, and stores the second category metadata in the data disk of the file system. Since not all information in the metadata is accessed during the data access process, based on the above classification of metadata, by separately storing the first category metadata with high frequency access and the second category metadata with low frequency access, metadata access can be performed according to access requirements, thereby reducing unnecessary metadata access, reducing the data access amount to a certain extent, and improving data access efficiency. In addition, the first category metadata and the second category metadata are respectively stored in the system disk and the data disk, which can reduce the number of data disk accesses and reduce the pressure on the data disk when accessing data.

[0121] Figure 4 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 2 Optionally, in step S304, generating first-category metadata and second-category metadata of the target file according to the file creation information and storing the first-category metadata and the second-category metadata respectively may include:

[0122] S401. Generate basic information of a target file according to the file name, file size, file creation time, file storage path, and the number of objects contained in the file, and generate an association relationship between the first type of metadata and the second type of metadata according to the file identifier and information of each data block in each object contained in the file. The association relationship is used to characterize a mapping relationship between the file identifier of the target file and each data block in each object contained in the file.

[0123] Optionally, the first category of metadata includes basic information of the target file, and the basic information may include some basic data such as the name, file identifier, file size, file creation time, modification time, storage path, etc. of the target file. The association relationship between the first category of metadata and the second category of metadata can be constructed based on the file identifier of the target file in the first category of metadata and the information of each data block contained in the target file. The association relationship can be used to query and obtain the information of each data block of the target file based on the file identifier of the target file.

[0124] S402: Obtain the first-category metadata of the target file according to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata.

[0125] Therefore, the first type of metadata of the target file can be obtained by combining the basic information of the target file obtained above and the association relationship between the first type of metadata and the second type of metadata.

[0126] S403: Generate data block information of the target file according to information of each data block in each object contained in the file, and use the data block information as the second type of metadata.

[0127] The information of each data block in each object contained in the file may refer to the storage location information of each data block, that is, the disk location corresponding to each data block, and the second type of metadata may include all data block information of the target file.

[0128] According to the information of each data block, each data block can be queried from the corresponding disk and the stored file data can be read from the data block.

[0129] In addition, the second type of metadata may also include: data block size, data block name, etc.

[0130] Here, the focus is on explaining the association between the generated first-category metadata and the second-category metadata. It should be noted that in this embodiment, the first-category metadata is stored in the form of key-value pairs, that is, the first-category metadata is stored in the system disk of the file system through a key-value pair database.

[0131] Key-value database is a new type of database besides relational database. Each record in the database is a key-value pair. The key-value pair consists of two elements, key and value. Both key and value are variable-length byte sequences. Key and value can be either binary data or text strings. The key in the database must be unique. Key-value database can provide persistence mechanism and data synchronization functions. It has the characteristics of high concurrency, high scalability and high reliability. It is an effective way to store metadata.

[0132] The association between the first type of metadata and the second type of metadata can be expressed in the form of a table. It mainly includes the following table structures: The file information table is used to store the table items of the first type of metadata of the file, including the file path, file creation time, modification time, file size, the number of objects contained in the file, file status, the POOL to which the file belongs, and the file ID (file identifier), as shown in Table 1:

[0133] Table 1: File information table

[0134]

[0135] This table shares a key: "FI@File ID", FI stands for File Info, File ID is the unique identifier of the file, and the concatenated character is '@'. The file status is represented by "0, 1, 2", where '0' means that the file has not been written after creation, '1' means that it is being written, and '2' means that the file is closed after writing. Pool ID is the number of the storage resource pool to which the file belongs. The number of objects indicates how many OBJ objects the file occupies.

[0136] The data block information table records the information of all (block) data blocks contained in each file. The key is represented by "FB@file ID", where the file ID indicates that the block in the table belongs to a specific file, and the block description information stores the basic information of each block. As shown in Table 2.

[0137] Table 2: Data block information table

[0138]

[0139] The description information of a block is represented by a string of specified format, where the 5th, 10th, and 12th bits are connection symbols; the first 4 bits are represented by '0000' and are reserved; bits 6-9 are represented by 4 digits, recording the disk number corresponding to the block; bit 11 records the state of the block, represented by 0-5, initialization state, normal state, writing state, damaged state, missing state, and offline state; bit 13 represents the capacity state of the block. In the data block information table, multiple block information is separated by ';'.

[0140] The block description information format table records the specific format of each data block and the information represented by each bit of the data block.

[0141] Table 3: Block description information format

[0142]

[0143] The file index table is used to index files and quickly find the specified file information. The key is represented by "DIMF@file directory:file name" and the value is the file ID.

[0144] Table 4: File index table

[0145]

[0146] Optionally, after the target file is successfully created, the above-mentioned data block information table can be generated according to the generated file creation information, and then the file information table can be generated through the metadata information of the target file, and the database can be called to write the file index table, data block information table, and file information table into the key-value pair database.

[0147] Figure 5 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 3 ; Optionally, in step S304, according to the file creation information, first-category metadata and second-category metadata of the target file are generated and stored respectively, and the first-category metadata and the second-category metadata are stored in the system disk of the file system, and after the second-category metadata is stored in the data disk of the file system, the method of the present application may further include:

[0148] S501: Obtain a file write request for a target file, where the file write request includes: a name of the target file and file data of the target file.

[0149] Based on the target file created above, this embodiment writes data into the target file according to the acquired file write request. The file write request may include: the name of the target file, the file data of the target file, wherein the file data is the specific data to be written into the created target file, which can be understood as follows: the created target file is an empty file, and the file data of the target file is the specific content to be written into the created empty file.

[0150] It should be noted that the target file here can be any file. For the sake of ease of understanding, it can be considered that the target file to be written and the target file created above are one file.

[0151] S502: Determine whether the target file exists from among the created files according to the name of the target file.

[0152] When writing the target file, many files may have been created in the file system before. According to the name of the target file, it is possible to find out whether the target file exists from the multiple files created in the file system, that is, to find out whether the target file has been created in the file system.

[0153] Optionally, the name of the acquired target file may be compared with the file names of each file that has been created in the file system to determine whether the target file exists.

[0154] S503: If it exists, determine the redundant data contained in each object of the target file according to the file data of the target file, and the redundant data is used to restore the file data of the target file.

[0155] If a file with the same name as the target file already exists in the file system, it is confirmed that the target file exists.

[0156] In a file system based on erasure storage, it has been explained above that among the data blocks included in an object of a file, there are valid data blocks for storing valid data of the file and redundant data blocks for storing redundant data.

[0157] Among them, redundant data is used to verify and recover valid data. When the valid data stored in any valid data block under an object is damaged, correction and erasure calculation can be performed based on the valid data in the remaining valid data blocks under the object and the redundant data in the redundant data block to recover the damaged valid data.

[0158] Here, the redundant data may be calculated using an erasure calculation function. Erasure calculation is an existing calculation method, which can be understood by referring to the records. Optionally, the redundant data corresponding to an object may be calculated based on each valid data under the object.

[0159] S504: write the redundant data contained in each object of the target file into the redundant data block of each object, write the file data of the target file into the valid data block of each object, and update the first type metadata and the second type metadata corresponding to the target file.

[0160] Optionally, the valid data blocks and redundant data blocks here are only used to distinguish the types of data stored in the data blocks. The valid data blocks and redundant data blocks are both ordinary data blocks under an object. Any data block can be used as a valid data block after storing valid data, and can be used as a redundant data block after storing redundant data. The redundant data blocks and valid data blocks are not specific data blocks under an object.

[0161] After the writing of the file data of the target file is completed, the first type of metadata and the second type of metadata of the target file generated when the target file is created can be adaptively updated.

[0162] This may include: updating the size of the target file in the first type of metadata. Since some data may fail to be written during the writing process, or the user may only write part of the data, resulting in the size of the written file being inconsistent with the size of the created file, the file size in the first type of metadata of the target file may be updated according to the size of the actual written file. The status of the data blocks in the second type of metadata may also be updated, wherein the status of each data block may include: initialization status, normal status, writing status, damaged status, missing status, and offline status, and each data block may be updated according to its current actual status. Different statuses may be recorded using different digital identifiers, and the status of each data block may be updated by changing each identifier.

[0163] Figure 6 A schematic diagram of data separation storage based on erasure storage provided in an embodiment of the present application. Figure 6 As shown, the first type of metadata of the file can be stored in the system disk of the file system in the form of a copy through the database, and the second type of metadata of the file can be stored in the data disk of the file system in the form of a copy through the database, and the association relationship between the first type of metadata and the second type of metadata is also stored in the system disk in the form of a copy through the database. Here, storing in the form of a copy can improve data security to prevent data loss.

[0164] The valid data of the file and the redundant data obtained through erasure calculation are stored in the data disk, thereby realizing the separate storage of the first-category metadata and the second-category metadata of the file.

[0165] Figure 7 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 4 Optionally, in step S504, after the redundant data contained in each object of the target file is written into the redundant data block of each object and the file data of the target file is written into the valid data block of each object respectively, the method of the present application may further include:

[0166] S701. Obtain a file read request for a target file, where the file read request includes: the name and size of the target file, read offset information, and read length information.

[0167] After the target file is written successfully, the file may be further read, and the file data of the target file may be read from each data block of the target file according to the obtained read request of the target file.

[0168] The read offset information may refer to the offset of the data to be read in the data block, and the read length information may refer to the length of the data to be read.

[0169] S702: According to the name of the target file and the read offset information, query the first type of metadata of each file in the system disk to determine the information of each data block corresponding to the target file.

[0170] In one feasible method, the status of the target file can be searched from a database based on the name of the target file to determine whether the target file exists. If the target file exists, the identifier of the target file can be obtained based on the name of the target file, thereby calling the data block information table, and determining the information of each data block corresponding to the target file based on the association between the identifier of the target file and each data block.

[0171] S703 , reading the target file from the corresponding disk according to the information of each data block corresponding to the target file, the read offset information and the read length information.

[0172] Based on the determined information of the data blocks of the target file, the file data of the target file can be read from the disk corresponding to each data block according to the above-mentioned read offset information and read length information in each data block.

[0173] Figure 8 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 5 Optionally, in step S702, according to the name of the target file and the read offset information, the first type of metadata of each file in the system disk is queried to determine the information of each data block corresponding to the target file, which may include:

[0174] S801. Determine the file identifier of the target file according to the name of the target file.

[0175] Assuming that the file name of the target file is a, the file identifier of the generated target file can be expressed as: DIMF@file path: a.

[0176] S802: According to the file identifier of the target file, query the association relationship between the first-category metadata and the second-category metadata of each file to determine the second-category metadata corresponding to the target file.

[0177] Here, the data block information table is queried, and the information of the data block corresponding to the target file is determined according to the association between each data block and the identifier of each file in the data block information table, that is, the second type of metadata corresponding to the target file is determined.

[0178] S803: Query the second type of metadata to obtain information about the disk to which each data block of the target file belongs.

[0179] Optionally, the identifier of the disk to which each data block belongs recorded in the Block description information format table may be searched to determine the disk information to which each data block of the target file belongs.

[0180] S804: Determine, based on the read offset information, information about the disk to which the target data block corresponding to the target file belongs from information about each data block corresponding to the target file.

[0181] In some embodiments, the file data of the target file currently to be read may be only a part of all the file data of the target file. Then, based on the read offset information and the length of each data block to be read, the target data block corresponding to the target file to be read can be determined from each data block, and then the information of the disk to which the target data block belongs can be determined.

[0182] Fig. 9 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 6 Optionally, in step S703, according to the information of each data block corresponding to the target file, according to the read offset information and the read length information, reading the target file from the corresponding disk may include:

[0183] S901, according to the information of the disk to which the target data block corresponding to the target file belongs, and according to the read offset information and the read length information, the file data stored in each target data block is read from the disk to which each target data block belongs.

[0184] In some embodiments, for the target data blocks of the determined target file, part of the file data may be read from each target data block, wherein the file data may be read in each target data block according to the read offset information and the read length information.

[0185] S902: Combining the file data stored in each of the read target data blocks to obtain a target file.

[0186] Usually, what is read from a target data block is only partial file data of the target file to be read. By combining the partial target file data read from each target data block, the complete target file data can be obtained.

[0187] Optionally, in step S901, the file data stored in each target data block is read from the disk to which each target data block belongs, which may include: if the read of the target disk fails, and the data stored in the target data block on the target disk is valid data, then performing erasure calculation to recover the valid data in the target data block on the target disk, the target disk being any disk among the disks corresponding to each target data block.

[0188] In one feasible manner, if when reading target file data, the disk where the valid data block storing the valid data is located is damaged, resulting in failure to read the valid data, then the valid data can be restored by performing erasure calculation to ensure the integrity of the target file data that is finally read.

[0189] Optionally, performing erasure calculation to recover valid data in a target data block on a target disk may include: calculating valid data in the target data block on the target disk based on valid data read from the target data block on a disk other than the target disk and redundant data.

[0190] For example: the file data of the target file to be read is distributed in each data block under object 1 of the target file. Taking the erasure ratio of 4:1 as an example, object 1 includes valid data block 1, valid data block 2, valid data block 3, valid data block 4 and redundant data block 5. Valid data block 1, valid data block 2, valid data block 3, valid data block 4 and redundant data block 5 are distributed on disk 1, disk 2, disk 3, disk 4 and disk 5 respectively. Assuming that disk 4 is a damaged disk, then when reading file data, reading data from disk 4 fails, that is, reading of valid data stored in valid data block 4 fails. Then, based on the valid data stored in valid data block 1, valid data block 2, valid data block 3, and the redundant data read from redundant data block 5, erasure calculation can be used to calculate the valid data stored in valid data block 4.

[0191] Fig.10 Schematic diagram of the data processing method provided in the embodiment of the present application Figure 7 Optionally, in step S303, before creating a data block of each object on each selected disk according to a preset erasure ratio, the method may further include:

[0192] S110: Determine the number of disks to be selected according to a preset erasure ratio.

[0193] The preset erasure ratio can be determined according to the selected erasure ratio random algorithm. Assuming that the erasure ratio random algorithm is N+M, the preset erasure ratio is N:M, where N:M represents the ratio of valid data blocks to redundant data blocks. Since the data blocks are distributed on different disks, the number of disks to be selected is N+M.

[0194] S111. Select a number of disks from multiple disks in the file system according to the disk weight of each disk in the file system, wherein the disk weight of each disk is determined according to the capacity of each disk and the total capacity of the system disks.

[0195] In order to ensure the balance of disk capacity, the weight of each suction cup can be determined according to the capacity of each disk in the total disk, and the disk with higher weight can be selected first. The following algorithm can be used for disk selection:

[0196] Pick a random number and divide it by the total disk weight to get the first round result. Compare the first round result with the disk weight of each disk. If the first round result falls within a certain disk weight range, the disk is determined to be the disk to be selected, and the disk is removed from the total disks, and the weights of the remaining disks are recalculated.

[0197] Repeat the process, divide the random number by the total disk weight to get the second round result, compare the second round result with the disk weights of the remaining disks, and if the second round result falls within a certain disk weight range, the disk is determined to be the disk to be selected, and the process is repeated until all the disks to be selected are determined.

[0198] In one achievable manner, an electronic device used to execute the present method may be divided into a plurality of functional modules, and the modules interact with each other to execute the present method. Of course, the functional modules here are all virtual modules, and functional subdivision may not be performed. When the present method is executed directly through an electronic device, the steps are also the same.

[0199] Fig.11 The following is a schematic diagram of the architecture of a data processing system provided in an embodiment of the present application. The data processing system may include: a file management module (File Manager, FM), a database module (DataBase, DB), an object management module (OBJManage, OM), an erasure correction calculation module (Erasure Correction, EC) and a disk data management module (Disk DataManage, DDM); the functions of each module may be as follows:

[0200] File management module: After receiving the client's request to create a file, FM generates a unique file ID for the file and notifies the OM module to allocate free space for the file. The allocated space consists of multiple OBJs (objects), and each OBJ consists of multiple BLKs (data blocks). After OM returns the successful creation, FM writes the file information (first-class metadata) and the information returned by OM (the association between the first-class metadata and the second-class metadata) into the database, which is responsible for storing this information in the system disk of the file system. When reading a file, FM also parses the request sent by the client, finds the first-class metadata of the corresponding file and its associated second-class metadata information based on the file name, and obtains the data block information of the file to be read.

[0201] Object management module: A module that manages OBJ. When OM receives a request from FM to create a file, it obtains the server's disk information, allocates OBJ according to the current erasure ratio and file size, selects a suitable disk for each BLK in OBJ, and then creates BLK on the selected disk, and writes the metadata of BLK. After OM is created, it returns the integrated information to FM. When reading data, it will find the disk corresponding to the data block to be accessed through the block file information sent by FM, and access the data information of the BLK. The OBJ module is also responsible for updating the changes in the relationship between files and block files caused by data recovery into the database.

[0202] Database module: The database module stores server disk information, file metadata information, and the relationship between files and data blocks. It also implements double writing through the database's own functions to ensure metadata security and speeds up metadata access through caching.

[0203] Erasure calculation module: responsible for calculating the read and written data. When reading and writing files, erasure calculation is performed based on the data information input by FM to obtain verified data or restore the correct data.

[0204] Disk data management system: manages the data on the disk, finds the corresponding disk according to the BLK information passed in by OBJ, and reads and writes BLK files.

[0205] During file creation:

[0206] a) When FM receives a request from a client to create a file, it first queries the database to ensure whether the file already exists. If it does, it returns the message to the client. If it does not exist, it generates a file index table and a file identifier.

[0207] b) OM obtains all disk information from the database and prepares to create BLK based on N+M disks according to the random algorithm of erasure ratio. To ensure the balance of disk capacity, disk weights are set according to disk capacity, and disks with high weights are selected first;

[0208] c) After OM selects enough disks, it creates BLK files on each disk through DDM;

[0209] d) DDM creates a BLK file and writes the BLK file information (i.e., BLK metadata) to the disk partition;

[0210] e) After FM waits for OM to return that the file is created successfully, it generates a data block information table based on the information of the created file, and generates a file information table based on the file metadata information. It calls the database and writes the file index table, data block information table, and file information table into the database at the same time.

[0211] During file reading:

[0212] a) The client reads the file information. After receiving the request to read the file information, FM first queries the database for the file status, whether it exists, the file size and other information, and calculates the OBJ that needs to be read;

[0213] b) OM calls DDM to read the BLK files on each disk based on the received OBJ information, as well as the read offset and length;

[0214] c) DDM finds the location of the BLK to be read on the disk through the INode (index unit) information on the disk, reads the data of the corresponding offset length, and returns to OM.

[0215] d) After receiving the return result, OM returns it to EC. EC determines whether erasure correction calculation is required based on the return result of OM. If not, it directly returns to FM. If calculation is required, it returns after calculation.

[0216] The method of the present application will be described below through specific examples:

[0217] Example 1 is a case where erasure calculation is not required:

[0218] With an erasure ratio of 4:1, there are five disks on the file system, numbered 1, 2, 3, 4, and 5. Disk 5 is damaged. The client needs to read a 900M file with the file path / storagecli / file.

[0219] At this time, in the database, the file index table is

[0220] DIMF@storage:file 123456

[0221] At this time, the file information table is

[0222]

[0223] The data block information table is:

[0224]

[0225]

[0226] The client needs to read data with an offset of 16MB and a length of 1M (1024k) for the first time. When FM receives the request, it queries the database and obtains the file ID of 123456, which is 900M in size. The file status is normal and can be read. By calculating the offset of 16MB on the first OBJ, the BLK file under the first group of OBJs is found from the FB table. The BLK information is 0000-0001-01-1; 0000-0002-01-1; 0000-0003-01-1; 0000-0004-01-1; 0000-0005-03-1; and at the same time, the offset of 16MB in BLK is calculated to be 4MB (16 divided by 4), and each block needs to read 256KB.

[0227] Fig.12 A schematic diagram of data block reading provided in an embodiment of the present application.

[0228] FM sends the BLK information, offset, and read length that need to be read to OM. OM obtains each BLK information, finds the disk corresponding to each BLK, and sends the BLK name, disk, read offset, and length to DDM. DDM finds the corresponding BLK file name by specifying the file index (Fnode) in the disk partition, obtains the offset of the BLK in the disk, and then reads the corresponding data according to the offset and length that the BLK needs to read, and returns it to OM.

[0229] OM returns the read data to the EC module. At this time, DDM fails to read disk 5. Therefore, in the data returned by OM, the length of the data read from the 5th BLK is 0, and the reading result is failure. The EC module finds through analysis that since the erasure ratio is 4:1, the valid data is on the first 4 BLKs, and there is no need to perform erasure calculations. The data can be directly combined. EC combines the data and returns it to FM, which returns it to the client. This data reading ends.

[0230] Example 2 is a case where erasure calculation is required:

[0231] The client reads data for the second time, with a read offset of 257MB and a read length of 1M. After receiving the request, FM calculates that the data required by the client is on the second OBJ, which is the same as the first time. The BLKs obtained under the second OBJ are 0000-0002-01-1; 0000-0003-01-1; 0000-0004-01-1; 0000-0005-03-1; 0000-0001-01-1; the offset in each BLK is the 9th stripe, and the length to be read is 8 stripes.

[0232] Fig.13 Another data block reading schematic diagram provided for an embodiment of the present application.

[0233] Similar to the first read, FM sends the BLK and the information to be read to OM, and OM sends it to DDM. At this time, since the 4th BLK in the BLK of the second OBJ is on disk 5, DDM fails to read the 4th BLK. OM returns the read data to EC. EC finds that the 4th stripe is a data stripe through the OM result, and the read fails. It needs to perform erasure calculation to recover the data. After calculation, the recovered data is returned to FM. FM returns to the client, and the data reading ends.

[0234] Example 3 is for the case where only the basic information of a file is read but not the specific data of the file:

[0235] The client scans how many files are stored on the server and obtains information about these files. The client sends a request to FM to obtain file information under the specified directory / storage / filegroup1 / . After receiving the request, FM queries the database and scans the files under the directory by forming the key DIMF@storage / filegroup1 with the directory / storage / filegroup1 / . After obtaining the files, it also obtains the file IDs of the files under the directory, and then forms the key FI@FileID with each file ID to scan the file information table. The queried information is returned to the client.

[0236] During this process, the client only wants to obtain file information, not to read the contents of each file. Therefore, after FM receives the request, it only needs to query the database (cache) for the specified directory or specified file information before returning to the client. It does not need to query the BLK information under the file and the specific distribution of BLK on the disk. In other words, in this case, it only needs to access the first type of metadata of the file without accessing the second type of metadata, which reduces the number of disk reads during the query and the amount of data queried.

[0237] Embodiment 4 updates the first type of metadata and the second type of metadata when the data block is damaged:

[0238] When a BLK is damaged, data recovery is required. During recovery, the BLK needs to be rewritten to the disk. If the BLK is recovered on the disk corresponding to the BLK, after recovery, the BLK may no longer be in the original Block group (block group), but the disk number where the BLK is located has not changed. At this time, the metadata that needs to be changed is only the second type of metadata. There is no need to change the second type of metadata, nor the relationship between the two. Therefore, there is no need to make changes in the database, and it does not affect the client's acquisition of file information. Similarly, if the file information is modified, such as changing the file name, only the first type of metadata needs to be updated. There is no need to update the relationship between the two, nor to change the second type of metadata, which effectively reduces the number of writes to the data disk.

[0239] In summary, the data processing method provided by the present application includes: obtaining a file creation request, the file creation request includes: the size of the target file and the name of the target file; determining the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset data block size; creating a data block for each object on each selected disk according to the preset erasure ratio, and generating file creation information; generating first-class metadata and second-class metadata of the target file according to the file creation information, respectively, and storing the first-class metadata and the second-class metadata, and storing the first-class metadata in the system disk of the file system, and storing the second-class metadata in the data disk of the file system. This method classifies the metadata information of the file according to the access frequency, generates the first category metadata and the second category metadata respectively, and stores the first category metadata in the system disk of the file system, and stores the second category metadata in the data disk of the file system. Since not all information in the metadata is accessed during the data access process, based on the above classification of metadata, by separately storing the first category metadata with high frequency access and the second category metadata with low frequency access, metadata access can be performed according to access requirements, thereby reducing unnecessary metadata access, reducing the data access amount to a certain extent, and improving data access efficiency. In addition, the first category metadata and the second category metadata are respectively stored in the system disk and the data disk, which can reduce the number of data disk accesses and reduce the pressure on the data disk when accessing data.

[0240] In addition, based on the classified storage of the first type of metadata and the second type of metadata, the amount of metadata that needs to be updated when modifying metadata information can be reduced, thereby improving the reading and writing performance of metadata.

[0241] The following describes the devices, equipment, storage media, etc. used to execute the method provided in this application. The specific implementation process and technical effects are described above and will not be repeated below.

[0242] Fig.14 A schematic diagram of a data processing device provided in an embodiment of the present application, the functions implemented by the data processing device correspond to the steps performed by the above method. The device can be understood as the above electronic device or server, or the processor of the server, or can also be understood as a component independent of the above server or processor that implements the functions of the present application under the control of the server, such as Fig.14 As shown, the device may include: an acquisition module 140, a determination module 141, and a generation module 142;

[0243] The acquisition module 140 is used to acquire a file creation request, where the file creation request includes: the size of the target file and the name of the target file;

[0244] A determination module 141, configured to determine the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block;

[0245] A generating module 142 is used to create a data block of each object on each selected disk according to a preset erasure ratio, and generate file creation information, wherein the file creation information includes: the file name, file size, file storage path, file identifier, file creation time, the number of objects included in the file, and information of each data block in each object included in the file, wherein the data blocks in each object include valid data blocks and redundant data blocks, and the data blocks under the same object are distributed on different disks of the selected file system;

[0246] The generation module 142 is used to generate the first type of metadata and the second type of metadata of the target file according to the file creation information, and store the first type of metadata in the system disk of the file system, and store the second type of metadata in the data disk of the file system; the first type of metadata includes: basic information of the target file, and the association relationship between the first type of metadata and the second type of metadata, the second type of metadata includes: data block information of the target file, and the access frequency of the first type of metadata is greater than the access frequency of the second type of metadata.

[0247] Optionally, the generating module 142 is specifically used to generate basic information of the target file according to the file name, file size, file creation time, file storage path, and the number of objects contained in the file, and generate an association relationship between the first type of metadata and the second type of metadata according to the file identifier and the information of each data block in each object contained in the file, wherein the association relationship is used to characterize the mapping relationship between the file identifier of the target file and each data block in each object contained in the file;

[0248] According to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata, the first-category metadata of the target file is obtained;

[0249] The data block information of the target file is generated according to the information of each data block in each object contained in the file, and the data block information is used as the second type of metadata.

[0250] Optionally, the device further comprises: a writing module;

[0251] The acquisition module 140 is further used to acquire a file write request for a target file, the file write request including: a name of the target file and file data of the target file;

[0252] The determination module 141 is further used to determine whether the target file exists from the created files according to the name of the target file;

[0253] The determination module 141 is further used to determine the redundant data contained in each object of the target file according to the file data of the target file, if any, and the redundant data is used to restore the file data of the target file;

[0254] The writing module is used to write the redundant data contained in each object of the target file into the redundant data block of each object, write the file data of the target file into the valid data block of each object respectively, and update the first type metadata and the second type metadata corresponding to the target file.

[0255] Optionally, the device further comprises: a reading module;

[0256] Optionally, the acquisition module 140 is further used to acquire a file read request for a target file, the file read request including: the name of the target file and the size of the target file, read offset information and read length information;

[0257] The determination module 141 is further used to query the first type metadata of each file in the system disk according to the name of the target file and the read offset information, and determine the information of each data block corresponding to the target file;

[0258] The reading module is used to read the target file from the corresponding disk according to the information of each data block corresponding to the target file, the read offset information and the read length information.

[0259] Optionally, the determination module 141 is specifically configured to determine a file identifier of the target file according to the name of the target file;

[0260] According to the file identifier of the target file, query the association relationship between the first-category metadata and the second-category metadata of each file to determine the second-category metadata corresponding to the target file;

[0261] Query the second type of metadata to obtain the information about the disk to which each data block of the target file belongs;

[0262] According to the read offset information, the information of the disk to which the target data block corresponding to the target file belongs is determined from the information of each data block corresponding to the target file.

[0263] Optionally, the reading module reads the file data stored in each target data block from the disk to which each target data block belongs, specifically according to the information of the disk to which the target data block corresponding to the target file belongs, according to the read offset information and the read length information;

[0264] The target file is obtained by combining the file data stored in each of the read target data blocks.

[0265] Optionally, the reading module performs erasure calculation to recover the valid data in the target data block on the target disk if the reading of the target disk fails and the data stored in the target data block on the target disk is valid data. The target disk is any disk among the disks corresponding to each target data block.

[0266] Optionally, the reading module calculates valid data in the target data block on the target disk based on valid data and redundant data read from the target data block on a disk other than the target disk.

[0267] Optionally, the determination module 141 is further configured to determine the number of disks to be selected according to a preset erasure ratio;

[0268] According to the disk weight of each disk in the file system, a number of disks are selected from the multiple disks in the file system, and the disk weight of each disk is determined according to the capacity of each disk and the total capacity of the system disk.

[0269] Optionally, the first type of metadata is stored in the form of key-value pairs.

[0270] The above-mentioned device is used to execute the method provided by the aforementioned embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0271] The above modules may be one or more integrated circuits configured to implement the above methods, such as one or more application specific integrated circuits (ASIC), or one or more digital singnal processors (DSP), or one or more field programmable gate arrays (FPGA). For another example, when a module is implemented in the form of a processing element scheduling program code, the processing element may be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

[0272] The above modules can be connected or communicated with each other via a wired connection or a wireless connection. The wired connection may include a metal cable, an optical cable, a hybrid cable, etc., or any combination thereof. The wireless connection may include a connection in the form of a LAN, a WAN, Bluetooth, a ZigBee, or NFC, or any combination thereof. Two or more modules may be combined into a single module, and any one module may be divided into two or more units. Those skilled in the art will clearly understand that for the convenience and simplicity of description, the specific working process of the system and device described above can refer to the corresponding process in the method embodiment, and will not be repeated in this application.

[0273] Fig.15 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, which may be a computing device with data processing capabilities.

[0274] The device may include: a processor 801 and a memory 802 .

[0275] The memory 802 is used to store programs, and the processor 801 calls the programs stored in the memory 802 to execute the above method embodiment. The specific implementation method and technical effect are similar and will not be repeated here.

[0276] The memory 802 stores program codes, and when the program codes are executed by the processor 801, the processor 801 executes various steps of the method according to various exemplary embodiments of the present application described in the above “Exemplary Method” section of this specification.

[0277] Processor 801 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor (DigitalSignal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.

[0278] The memory 802 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 802 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0279] Optionally, the present application also provides a program product, such as a computer-readable storage medium, including a program, which is used to execute the above method embodiment when executed by a processor.

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

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

[0282] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0283] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (English: Read-Only Memory, abbreviated: ROM), random access memory (English: Random Access Memory, abbreviated: RAM), disk or optical disk and other media that can store program codes.

Claims

1. A data processing method, characterized in that: Applied in a file system based on erasure storage, the method includes: Obtaining a file creation request, wherein the file creation request includes: the size of the target file and the name of the target file; Determining the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block; According to the preset erasure ratio, a data block of each object is created on each selected disk, and file creation information is generated, wherein the file creation information includes: a file name, a file size, a file storage path, a file identifier, a file creation time, a number of objects included in the file, and information of each data block in each object included in the file, wherein the data blocks in each object include valid data blocks and redundant data blocks, and the data blocks under the same object are distributed on different disks of the selected file system; According to the file creation information, first-type metadata and second-type metadata of the target file are respectively generated, and the first-type metadata is stored in the system disk of the file system, and the second-type metadata is stored in the data disk of the file system; the first-type metadata includes: basic information of the target file, and an association relationship between the first-type metadata and the second-type metadata, the second-type metadata includes: data block information of the target file, and the access frequency of the first-type metadata is greater than the access frequency of the second-type metadata; The step of generating the first type of metadata and the second type of metadata of the target file respectively according to the file creation information includes: Generate basic information of the target file according to the file name, file size, file creation time, file storage path, and the number of objects contained in the file, and generate an association relationship between the first category of metadata and the second category of metadata according to the file identifier and information of each data block in each object contained in the file, wherein the association relationship is used to characterize a mapping relationship between the file identifier of the target file and each data block in each object contained in the file; Obtaining the first-category metadata of the target file according to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata; The data block information of the target file is generated according to the information of each data block in each object contained in the file, and the data block information is used as the second-type metadata.

2. The method according to claim 1, characterized in that The method further comprises: generating first-type metadata and second-type metadata of the target file according to the file creation information, storing the first-type metadata in the system disk of the file system, and storing the second-type metadata in the data disk of the file system. Obtaining a file write request for the target file, the file write request including: a name of the target file and file data of the target file; According to the name of the target file, determining whether the target file exists from the created files; If so, determining redundant data contained in each object of the target file according to the file data of the target file, wherein the redundant data is used to restore the file data of the target file; The redundant data contained in each object of the target file is written into the redundant data block of each object, the file data of the target file is written into the valid data block of each object respectively, and the first type metadata and the second type metadata corresponding to the target file are updated.

3. The method according to claim 2, characterized in that After writing the redundant data contained in each object of the target file into the redundant data block of each object and writing the file data of the target file into the valid data block of each object respectively, the method comprises: Obtaining a file read request for the target file, the file read request including: the name of the target file, the size of the target file, read offset information, and read length information; According to the name of the target file and the read offset information, query the first type metadata of each file in the system disk to determine the information of each data block corresponding to the target file; According to the information of each data block corresponding to the target file, the target file is read from the corresponding disk according to the read offset information and the read length information.

4. The method according to claim 3, characterized in that According to the name of the target file and the read offset information, the first type of metadata of each file in the system disk is queried to determine the information of each data block corresponding to the target file, including: Determine the file identifier of the target file according to the name of the target file; According to the file identifier of the target file, query the association relationship between the first type of metadata and the second type of metadata of each file to determine the second type of metadata corresponding to the target file; Query the second type of metadata to obtain information about the disk to which each data block of the target file belongs; According to the read offset information, the information of the disk to which the target data block corresponding to the target file belongs is determined from the information of each data block corresponding to the target file.

5. The method according to claim 3, characterized in that: The step of reading the target file from the corresponding disk according to the information of each data block corresponding to the target file and the read offset information and the read length information includes: According to the information of the disk to which the target data block corresponding to the target file belongs, and in accordance with the read offset information and the read length information, the file data stored in each target data block is read from the disk to which each target data block belongs; The target file is obtained by combining the file data stored in each of the read target data blocks.

6. The method according to claim 5, characterized in that The step of reading the file data stored in each target data block from the disk to which each target data block belongs includes: If the target disk fails to be read, and the data stored in the target data block on the target disk is valid data, erasure calculation is performed to recover the valid data in the target data block on the target disk, where the target disk is any disk corresponding to each target data block.

7. The method according to claim 6, characterized in that The performing erasure calculation to restore valid data in the target data block on the target disk includes: The valid data in the target data block on the target disk is calculated based on the valid data read from the target data block on the disk other than the target disk and the redundant data.

8. The method according to claim 1, characterized in that Before creating a data block of each object on each selected disk according to the preset erasure ratio, the method includes: Determining the number of disks to be selected according to the preset erasure ratio; The number of disks is selected from the plurality of disks in the file system according to the disk weight of each disk in the file system, wherein the disk weight of each disk is determined according to the capacity of each disk and the total capacity of the system disks.

9. The method according to claim 1, characterized in that: The first type of metadata is stored in the form of key-value pairs.

10. A data processing device, characterized in that: Applied in a file system based on erasure storage, the device comprises: an acquisition module, a determination module, and a generation module; The acquisition module is used to acquire a file creation request, wherein the file creation request includes: the size of the target file and the name of the target file; The determination module is used to determine the number of objects into which the target file is divided and the number of data blocks contained in each object according to the size of the target file, a preset erasure ratio, and a preset size of a data block; The generation module is used to create a data block of each object on each selected disk according to the preset erasure ratio, and generate file creation information, wherein the file creation information includes: the file name, file size, file storage path, file identifier, file creation time, the number of objects contained in the file, and information of each data block in each object contained in the file, wherein the data block in each object includes a valid data block and a redundant data block, and the data blocks under the same object are distributed on different disks of the selected file system; The generating module is used to generate first-type metadata and second-type metadata of the target file according to the file creation information, and store the first-type metadata in the system disk of the file system, and store the second-type metadata in the data disk of the file system; the first-type metadata includes: basic information of the target file, and an association relationship between the first-type metadata and the second-type metadata, the second-type metadata includes: data block information of the target file, and the access frequency of the first-type metadata is greater than the access frequency of the second-type metadata; The generating module is specifically used to generate basic information of the target file according to the file name, file size, file creation time, file storage path and the number of objects contained in the file, and generate an association relationship between the first category metadata and the second category metadata according to the file identifier and information of each data block in each object contained in the file, wherein the association relationship is used to represent a mapping relationship between the file identifier of the target file and each data block in each object contained in the file; Obtaining the first-category metadata of the target file according to the basic information of the target file and the association relationship between the first-category metadata and the second-category metadata; The data block information of the target file is generated according to the information of each data block in each object contained in the file, and the data block information is used as the second-type metadata.

11. An electronic device, characterized in that: include: A processor, a storage medium and a bus, wherein the storage medium stores program instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the data processing method as described in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 9 are executed.