Storage type change method, related apparatus and medium
By dividing file data into multiple data segments in the physical data storage space and providing phased change instructions in the metadata storage space, the problem of inconsistency between file data storage type and metadata storage type is solved, achieving accuracy and consistency in the process of data storage type change.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-07-16
- Publication Date
- 2026-03-12
AI Technical Summary
In advanced file storage management, the actual storage type of file data in the physical data storage space is often inconsistent with the data in the metadata storage space during the storage type change phase, leading to inconsistency issues during the data storage type change process.
By dividing the target file into multiple data segments in the entity data storage space, assigning change instructions, and setting the storage type change stage data in the metadata storage space as pending change, in progress, and changed, the storage type change operation of each data segment is ensured to be consistently updated in the metadata storage space.
During the data storage type change process, the inconsistency between the actual data storage type of file data in the physical data storage space and the data in the metadata storage space during the storage type change stage is reduced, thereby improving the accuracy and consistency of data storage type changes.
Smart Images

Figure CN2025108764_12032026_PF_FP_ABST
Abstract
Description
Storage type changing method, related device and medium
[0001] The present application claims priority to the Chinese patent application No. 2024112533829, filed on September 9, 2024, and entitled "Storage type changing method, related device and medium", the whole content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present disclosure relates to the technical field of computer, and in particular, to a storage type changing method, related device and medium. BACKGROUND
[0003] At present, in advanced file storage management, file data and metadata are generally stored in different spaces. That is, file data is stored in an entity data storage space, and metadata is stored in a metadata storage space. Metadata refers to basic attribute data of a file, such as size, author, storage time, storage address, etc.
[0004] In some cases, the data storage type of file data stored in the entity data storage space is changed, for example, from a shallow storage type (deleted after being stored for a relatively short time) to a deep storage type (stored for a relatively long time). Therefore, a special attribute data, i.e., storage type changing stage data, is included in the metadata to indicate whether the data storage type change is completed (e.g., whether the shallow storage type is changed to the deep storage type). However, it often happens that the actual data storage type of file data in the entity data storage space is inconsistent with the storage type changing stage data in the metadata storage space (e.g., the file data has actually been changed from the shallow storage type to the deep storage type, but the storage type changing stage data in the metadata storage space still indicates the shallow storage type). SUMMARY
[0005] The present disclosure provides a storage type changing method, related device and medium, which can reduce the inconsistency between the actual data storage type of file data in the entity data storage space and the storage type changing stage data in the metadata storage space during the data storage type changing process.
[0006] According to an aspect of the present disclosure, a storage type changing method is provided, which is executed by an electronic device, and the method comprises:
[0007] In response to a storage type changing request for a target file in an entity data storage space, storage type changing stage data of the target file is set to be changed in a metadata storage space corresponding to the entity data storage space, wherein the target file is stored in the entity data storage space in multiple data segments;
[0008] allocating a change indication for each of the data segments, and setting the storage type change stage data of the target file in the metadata storage space as being changed, the change indication being used to indicate that the storage type of the data segment is changed according to the storage type change request;
[0009] performing the storage type change operation corresponding to the change indication for each of the data segments, and setting the storage type change stage data of the target file in the metadata storage space as being changed after the storage type change operation is performed for each of the data segments.
[0010] According to an aspect of the present disclosure, a storage type change device is provided, and the device comprises:
[0011] a setting unit configured to, in response to a storage type change request of a target file in an entity data storage space, set storage type change stage data of the target file in a metadata storage space corresponding to the entity data storage space as being changed, wherein the target file is stored in the entity data storage space in a plurality of data segments;
[0012] a first change unit configured to allocate a change indication for each of the data segments, and set the storage type change stage data of the target file in the metadata storage space as being changed, the change indication being used to indicate that the storage type of the data segment is changed according to the storage type change request;
[0013] a second change unit configured to perform the storage type change operation corresponding to the change indication for each of the data segments, and set the storage type change stage data of the target file in the metadata storage space as being changed after the storage type change operation is performed for each of the data segments.
[0014] According to an aspect of the present disclosure, an electronic device is provided, comprising a memory and a processor, the memory stores a computer program, and the processor implements the storage type change method as described above when executing the computer program.
[0015] According to an aspect of the present disclosure, a computer readable storage medium is provided, the storage medium stores a computer program, and the computer program is executed by a processor to implement the storage type change method as described above.
[0016] According to an aspect of the present disclosure, a computer program product is provided, the computer program product comprises a computer program, the computer program is read and executed by a processor of a computer device, so that the computer device performs the storage type change method as described above.
[0017] In the embodiments of the present disclosure, when the storage type change rule for the target file is hit, the server will first update the storage type change stage data of the target file in response to the storage type change request for the target file in the entity data storage space, that is, in the metadata storage space corresponding to the entity data storage space, the storage type change stage data of the target file is set to be changed, indicating that the storage type change of the target file is needed. Further, since the target file is stored in multiple data segments in the entity data storage space, after setting the storage type change stage data to be changed, a change indication needs to be allocated for each data segment to mark each data segment, and after allocating the change indication for each data segment, the storage type change stage data of the target file is set to be changed in the metadata storage space, so as to update the storage type change stage data. Next, the storage type change operation corresponding to the change indication is performed for each data segment to change the storage type. Further, the execution of the storage type change operation for each data segment is detected, and after detecting that the storage type change operation for each data segment is completed, it is determined that the storage type of all data segments is changed. At this time, the storage type change stage data of the target file is set to be changed in the metadata storage space, so that the storage type change stage data of the target file at the current time is changed. This way, the change processing of the file data in the entity data storage space and the update of the storage type change stage data in the metadata storage space are closely combined, so that the inconsistency between the actual data storage type of the file data in the entity data storage space and the storage type change stage data in the metadata storage space can be reduced during the data storage type change process. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings are included to provide a further understanding of the technical scheme of the present disclosure, and constitute a part of the specification, and are used together with the embodiments of the present disclosure to explain the technical scheme of the present disclosure, and do not constitute a limitation on the technical scheme of the present disclosure.
[0019] FIG. 1 is a system architecture diagram of a storage type change method according to an embodiment of the present disclosure;
[0020] FIG. 2A shows a schematic diagram of a data storage type change scene according to an embodiment of the present disclosure;
[0021] FIG. 2B shows a schematic diagram of a data storage type change scene according to an embodiment of the present disclosure;
[0022] FIG. 2C shows a schematic diagram of a data storage type change scene according to an embodiment of the present disclosure;
[0023] FIG. 2D shows a fourth schematic diagram of application of the storage type change method in a data storage type change scenario according to an embodiment of the present disclosure;
[0024] FIG. 2E shows a fifth schematic diagram of application of the storage type change method in a data storage type change scenario according to an embodiment of the present disclosure;
[0025] FIG. 2F shows a sixth schematic diagram of application of the storage type change method in a data storage type change scenario according to an embodiment of the present disclosure;
[0026] FIG. 3 is a flowchart of a storage type change method according to an embodiment of the present disclosure;
[0027] FIG. 4 is a flowchart of setting storage type change stage data as to be changed according to an embodiment of the present disclosure;
[0028] FIG. 5 is a flowchart of generating a target tree according to an embodiment of the present disclosure;
[0029] FIG. 6 is a schematic diagram of an implementation process of generating a target tree according to an embodiment of the present disclosure;
[0030] FIG. 7 is a flowchart of generating a storage type change request according to an embodiment of the present disclosure;
[0031] FIG. 8 is a schematic diagram of an implementation process of generating a storage type change request according to an embodiment of the present disclosure;
[0032] FIG. 9 is a flowchart of generating a candidate storage type change rule according to an embodiment of the present disclosure;
[0033] FIG. 10 is a specific structure diagram of a storage type conversion rule according to an embodiment of the present disclosure;
[0034] FIG. 11 is a flowchart of assigning a change indication to a target data segment according to an embodiment of the present disclosure;
[0035] FIG. 12 is a schematic diagram of a mapping relationship between a metadata block and a data segment according to an embodiment of the present disclosure;
[0036] FIG. 13 is a flowchart of setting storage type change stage data as changed according to an embodiment of the present disclosure;
[0037] FIG. 14 is a schematic diagram of an implementation process of performing storage type change on a data segment of a target file according to an embodiment of the present disclosure;
[0038] FIG. 15 is a flowchart of assigning a change indication to a target data segment according to another embodiment of the present disclosure;
[0039] FIG. 16 is a flowchart of setting storage type change stage data as changed according to another embodiment of the present disclosure;
[0040] FIG. 17 is a flowchart of generating a candidate data segment according to one embodiment of the present disclosure;
[0041] FIG. 18 is a schematic diagram of an implementation process of identifying a data segment of a storage bucket according to one embodiment of the present disclosure;
[0042] FIG. 19 is a flowchart of accessing a metadata storage space according to one embodiment of the present disclosure;
[0043] FIG. 20 is a schematic diagram of an implementation process of accessing a metadata storage space according to one embodiment of the present disclosure;
[0044] FIG. 21 is a flowchart of accessing a metadata storage space according to another embodiment of the present disclosure;
[0045] FIG. 22 is a schematic diagram of an implementation process of accessing a metadata storage space according to another embodiment of the present disclosure;
[0046] FIG. 23 is a flowchart of updating a metadata block according to one embodiment of the present disclosure;
[0047] FIG. 24A is a schematic diagram of an implementation process of updating a metadata block according to one embodiment of the present disclosure;
[0048] FIG. 24B is a schematic diagram of an implementation process of updating a metadata block according to one embodiment of the present disclosure;
[0049] FIG. 25 is a schematic diagram of implementation details of a storage type change method according to one embodiment of the present disclosure;
[0050] FIG. 26 is a schematic diagram of implementation details of a storage type change method according to another embodiment of the present disclosure;
[0051] FIG. 27 is a module diagram of a storage type change apparatus according to one embodiment of the present disclosure;
[0052] FIG. 28 is a terminal structure diagram of a storage type change method according to one embodiment of the present disclosure;
[0053] FIG. 29 is a server structure diagram of a storage type change method according to one embodiment of the present disclosure. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present disclosure and do not limit the present disclosure.
[0055] The system architecture and scenarios to which the embodiments of the present disclosure are applied are described below.
[0056] FIG. 1 is a system architecture diagram to which a storage type changing method according to an embodiment of the present disclosure is applied. It includes an object terminal 140, an Internet 130, a gateway 120, a data processing server 110, etc.
[0057] The object terminal 140 includes desktop computers, laptop computers, PDA (Personal Digital Assistant), mobile phones, car terminals, home theater terminals, special terminals, etc. in various forms. In addition, it can be a single device or a collection of multiple devices. The object terminal 140 can communicate with the Internet 130 in a wired or wireless manner to exchange data. The object terminal 140 contains a data processing platform for receiving a data storage type changing request of a target object for a certain file and sending the data storage type changing request to the data processing server 110 to make the data processing server 110 change the data type of the file in the entity data storage space 150 and the metadata storage space 160.
[0058] The data processing server 110 refers to a computer system that can provide certain services for the object terminal 140. Compared with the ordinary object terminal 140, the data processing server 110 requires higher stability, security, performance, etc. The data processing server 110 can be a high-performance computer in a network platform, a cluster of multiple high-performance computers, a part of a high-performance computer (such as a virtual machine), a combination of parts of multiple high-performance computers (such as virtual machines), etc. The data processing server 110 contains various types of services, and the implementation of each service of the data processing server 110 is often associated with some intermediate databases or storage media, etc. The data processing server 110 is used to change the data type of the file in the entity data storage space 150 and the metadata storage space 160 according to the data storage type changing request of the target object for the certain file, and to make the actual data storage type of the file data in the entity data storage space 150 consistent with the storage type changing stage data of the metadata storage space 160 when the type is changed.
[0059] The gateway 120 is also called an internetworking connector or a protocol converter. The gateway 120 implements network interconnection at the transport layer and is a computer system or device that acts as a conversion function. The gateway 120 is a translator between two systems that use different communication protocols, data formats or languages, or even have completely different architectures. Meanwhile, the gateway 120 can also provide filtering and security functions. The message sent by the object terminal 140 to the data processing server 110 needs to be sent to the corresponding data processing server 110 through the gateway 120. The message sent by the data processing server 110 to the object terminal 140 also needs to be sent to the corresponding object terminal 140 through the gateway 120.
[0060] The embodiments of the present disclosure can be applied in various scenarios, such as the data storage type changing scenario shown in FIGS. 2A-2F.
[0061] As shown in FIG. 2A, when the target object needs to change the data storage type of the file data of a file in a certain file system, the target object logs in the data processing platform on the object terminal and enters the storage type changing process. At this time, a prompt field "Please enter the relevant information of the file system to which the storage type changing is to be performed" is displayed on the page, and an editing area for inputting the file system name is provided. At this time, the target object inputs "file system KK1" in the editing area for inputting the file system name and clicks the "Confirm" button to determine that the data storage type of the file data in the file system KK1 needs to be changed.
[0062] As shown in FIG. 2B, after the target object clicks the "Confirm" button in FIG. 2A, a prompt field "The file data of the file system KK1 is stored in the entity data storage space, and the metadata is stored in the metadata storage space. The following is the storage structure of the file system KK1 in the metadata storage space. Please confirm whether to continue to set the storage type changing rule" is displayed on the page, and the tree-shaped storage structure of the file system KK1 is displayed. The file system KK1 contains a folder 1 and a file 1, the folder 1 has a subfolder (folder 2) and a file 2, and the folder 2 has a file 3. At this time, the target object clicks the "Confirm" button to determine to continue to set the storage type changing rule for each file of the file system KK1.
[0063] As shown in FIG. 2C, after the target object clicks the "Confirm" button in FIG. 2B, a prompt field "Please input the storage type change rule for the file system KK1" is displayed on the page, and an input area for inputting specific rule information is provided. At this time, the target object inputs rule 1 "file for path " / file1", 7 days to deep archive type", rule 2 "file for path " / folder1", 5 days to low frequency storage type", and rule 3 "file for path " / folder1 / folder2 / file3", 10 days to archive storage type" in the input area for inputting specific rule information. Among them, rule 1 is a change rule for file 1, rule 2 is a change rule for file 2 and file 3, and rule 3 is a change rule for file 3.
[0064] As shown in FIG. 2D, after the target object clicks the "Confirm" button in FIG. 2C, the server filters the rules according to the specific path of the file corresponding to each rule in the tree-shaped storage structure of the file system KK1. At this time, a prompt window is displayed on the page, and the prompt window has a prompt field "Since the file path pointed to by rule 3 is the longest, only rule 3 is a valid storage type change rule, and the storage type change operation for file 3 will be performed according to rule 3", to determine that the data type change for the file system KK1 is performed according to rule 3.
[0065] As shown in FIG. 2E, since rule 3 is "file for path " / folder1 / folder2 / file3", 10 days to archive storage type", after 10 days, the execution of rule 3 is triggered automatically, and at this time, a prompt window is displayed on the page, and the prompt window has a prompt field "The time condition of rule 3 has been reached, and the file data of file 3 will be changed to archive storage type through asynchronous processing", to prompt the target object that the server will perform the data type change for file 3.
[0066] As shown in FIG. 2F, after prompting the target object that the server will perform the data type change for file 3, the server first displays a prompt field "The storage type change of file 3 has been completed", and changes the file data of file 3 and the storage type change stage data through asynchronous execution.
[0067] The embodiments of the present disclosure are described below.
[0068] According to one embodiment of the present disclosure, a storage type change method is provided, which is executed by an electronic device. The electronic device executing the storage type change method is taken as a server for example in the embodiments of the present application.
[0069] The storage type changing method is generally applied to a business scenario in which file data and metadata of a file are respectively stored in different spaces, and the data storage type of the file data needs to be flexibly changed, such as the data storage type changing scenarios shown in FIGS. 2A-2F. Embodiments of the present disclosure provide a scheme for changing the storage type changing stage data in stages according to different processing stages of the file data in the data storage type changing process, which can reduce the inconsistency between the actual data storage type of the file data in the entity data storage space and the storage type of the storage type changing stage data in the metadata storage space in the data storage type changing process.
[0070] As shown in FIG. 3, the storage type changing method according to one embodiment of the present disclosure can include:
[0071] Step 310, in response to a storage type changing request for a target file in an entity data storage space, setting storage type changing stage data of the target file as to be changed in a metadata storage space corresponding to the entity data storage space.
[0072] Step 320, assigning a changing indication to each data segment, and setting the storage type changing stage data of the target file as being changed in the metadata storage space.
[0073] Step 330, performing a storage type changing operation corresponding to the changing indication for each data segment, and after the storage type changing operation is performed for all the data segments, setting the storage type changing stage data of the target file as changed in the metadata storage space.
[0074] The steps 310-330 are described in detail below.
[0075] In step 310, in response to a storage type changing request for a target file in an entity data storage space, setting storage type changing stage data of the target file as to be changed in a metadata storage space corresponding to the entity data storage space.
[0076] The entity data storage space refers to a storage space for storing file data of a file. In the entity data storage space, file data of each file can be stored as an object. For example, file data of a file is taken as an object, or file data of a file is divided into multiple data segments, and each data segment is taken as a separate object. In the entity data storage space, an object usually includes data itself, a certain amount of metadata, and a unique identifier of the object.
[0077] The target file refers to a file that needs to be changed in storage type, wherein the target file is stored in multiple data segments in the entity data storage space.
[0078] Each data segment is used to indicate a part of file data in the target file. The collection of multiple data segments constitutes the complete file data of the target file.
[0079] The storage type change request refers to a request generated when a storage type change rule for the target file is triggered. The storage type change request is a request that is automatically triggered when various indicators at the current time point meet the conditions required by the storage type change rule.
[0080] The metadata storage space refers to a storage space used to store the metadata of each file.
[0081] The storage type change stage data is used to indicate whether the storage type change of the file data of the target file is completed.
[0082] In the implementation of this embodiment, when each indicator at the current time point meets the condition for performing the storage type change on the target file, a storage type change request for the target file in the entity data storage space is generated. Based on this, the server receives the storage type change request, finds the target file in the metadata storage space corresponding to the entity data storage space, and sets the storage type change stage data of the target file to be changed, so as to realize the quick search and marking of the target file.
[0083] For brevity, the generation process of the storage type change request of the embodiment of the present disclosure and the specific implementation process of setting the storage type change stage data of the target file to be changed in the metadata storage space corresponding to the entity data storage space will be described in detail below. Herein, no further description is made.
[0084] In step 320, a change indication is assigned to each data segment, and the storage type change stage data of the target file is set to be changed in the metadata storage space.
[0085] The change indication is used to indicate the storage type change of the data segment according to the storage type change request, and specifically can indicate the storage type of each data segment of the target file after the change.
[0086] In the implementation of this embodiment, first, the change indication is generated according to the changed storage type indicated by the storage type change request. Then, the change indication is assigned to each data segment, so that each data segment is assigned to the change indication. Further, after determining that each data segment is assigned to the change indication, the storage type change stage data of the target file is set to be changed in the metadata storage space.
[0087] For brevity, the specific implementation process of assigning the change indication to each data segment of the embodiment of the present disclosure will be described in detail below. Herein, no further description is made.
[0088] In step 330, the corresponding storage type changing operation of the change instruction is executed for each data segment, and after the storage type changing operation is executed for all the data segments, the storage type changing stage data of the target file in the metadata storage space is set as changed.
[0089] The storage type changing operation refers to an operation of changing the storage type of a data segment, which is used to change the storage type of the data segment to the changed storage type indicated by the change instruction.
[0090] In the implementation of this embodiment, first, for each data segment, the corresponding storage type changing operation of the change instruction is executed for each data segment, and the current storage type of the data segment is changed to the storage type required by the change instruction. Then, after it is determined that the storage type changing operation is executed for each data segment, the storage type changing stage data of the target file in the metadata storage space is set as changed, so that the storage type changing stage data is consistent with the actual storage type of each data segment.
[0091] For the sake of brevity, the specific implementation process of setting the storage type changing stage data of the target file in the metadata storage space as changed in the embodiment of the present disclosure will be described in detail below. Here, no further description is given.
[0092] Through steps 310-330, when the storage type change rule for the target file is hit, the server updates the storage type change stage data of the target file in response to the storage type change request for the target file in the entity data storage space, that is, in the metadata storage space corresponding to the entity data storage space, the storage type change stage data of the target file is set to be changed, to indicate that the storage type change of the target file is needed. Further, since the target file is stored in multiple data segments in the entity data storage space, after the storage type change stage data is set to be changed, a change indication needs to be allocated for each data segment to mark each data segment, and after the change indication is allocated for each data segment, in the metadata storage space, the storage type change stage data of the target file is set to be changed, to update the storage type change stage data. Next, the storage type change operation corresponding to the change indication is performed for each data segment to change the storage type of the data segment. Further, the execution of the storage type change operation for each data segment is detected, and after the storage type change operation for each data segment is detected to be completed, it is determined that the storage type of all data segments has been changed. At this time, in the metadata storage space, the storage type change stage data of the target file is set to have been changed, so that the storage type change stage data of the target file at the current time is changed. This way, the storage type change processing of the file data in the entity data storage space and the update of the storage type change stage data in the metadata storage space are closely combined, so that the inconsistency between the actual data storage type of the file data in the entity data storage space and the storage type change stage data in the metadata storage space can be reduced during the data storage type change process.
[0093] The above is a general description of steps 310-330. The specific implementation of steps 310, 320, and 330 will be described in detail below.
[0094] Step 310 will be described in detail below.
[0095] In step 310, in response to the storage type change request for the target file in the entity data storage space, the storage type change stage data of the target file is set to be changed in the metadata storage space corresponding to the entity data storage space, wherein the target file is stored in multiple data segments in the entity data storage space.
[0096] In one embodiment, in order to meet the actual needs of the object on the object terminal as quickly as possible and shorten the waiting time for data conversion, after the storage type change stage data of the target file is set to be changed, the storage type change method further includes:
[0097] In response to the state acquisition request for the storage type change stage data of the target file, the state of the storage type change stage data is displayed as changed.
[0098] The state acquisition request refers to a request initiated by the target object when the target object wants to check whether the storage type of the file data of the target file is converted.
[0099] Specifically, when the target object wants to check whether the storage type of the file data of the target file is converted, the target object initiates a state acquisition request for the storage type change stage data of the target file through the data processing platform on the object terminal. Then, under the condition of authorized permission, the server receives the state acquisition request and, in response to the state acquisition request, displays the state of the storage type change stage data as changed, thereby realizing asynchronous change of the storage type of the file data of the target file.
[0100] The advantage of this embodiment is that, during the data storage type change process, the state of the storage type change stage data is first displayed as changed, and when the storage type change stage data is actually still to be changed, the processes of asynchronously assigning change instructions to each data segment of the target file and executing the change instructions are performed, so that the storage type change stage data of the target file is displayed as changed (settled) on the object terminal in advance, and the real change process is asynchronously executed on the server, which can satisfy the actual needs of the object on the object terminal as soon as possible, shorten the waiting time for data conversion, and provide protection for overhead calculation.
[0101] In the embodiments of the present disclosure, the metadata storage space contains a target tree, and each file in the entity data storage space corresponds to a file node in the target tree.
[0102] The target tree refers to a tree structure formed by the metadata storage space for each file storage architecture in which each file is maintained. The file storage architecture refers to a file system to which each file belongs.
[0103] In the metadata storage space, one file storage architecture corresponds to one target tree, and files under different file storage architectures correspond to file nodes in different target trees.
[0104] For example, a tree structure formed by a file storage architecture where the target file is located is a specific target tree in the metadata storage space. When there are file storage architecture A, file storage architecture B and file storage architecture C, the metadata storage space includes three target trees, namely target tree 1 corresponding to file storage architecture A, target tree 2 corresponding to file storage architecture B and target tree 3 corresponding to file storage architecture C. If the target file is a file in file storage architecture B, the target file node of the target file exists in target tree 2.
[0105] For brevity, the specific process of generating the target tree in the embodiment of the present disclosure will be described in detail below. Here, no further description is given.
[0106] Please refer to FIG. 4. In one embodiment, step 310 specifically includes, but is not limited to, steps 410-420:
[0107] Step 410, determining the target file node corresponding to the target file in the target tree of the metadata storage space;
[0108] Step 420, setting the storage type change stage data in the target file node to be changed.
[0109] The steps 410-420 are described in detail below.
[0110] In step 410, the target file node corresponding to the target file in the target tree of the metadata storage space is determined.
[0111] The target file node refers to a tree node corresponding to the target file in the target tree.
[0112] In the implementation of this embodiment, since the file and the file node are one-to-one corresponding in the target tree of the metadata storage space, the file index of the file is often directly used as the node index of the file node, where the file index is used to uniquely identify the file and the node index is used to uniquely identify the file node. Based on this, first, the target file index of the target file is obtained. Then, in the target tree of the metadata storage space, the file node with the same node index as the target file index is found, and the found file node is taken as the target file node corresponding to the target file.
[0113] In another embodiment, since the storage type change request is generated based on a preset, valid storage type change rule (i.e., a target storage type change rule hereinafter), and the target storage type change rule specifies the specific path of the file to which the target storage type change rule is applied in the target tree when the target storage type change rule is set. Based on this, when determining the target file node corresponding to the target file, the file path corresponding to the target storage type change rule can also be obtained from the storage type change request, and the file node pointed to by the file path in the target tree is taken as the target file node corresponding to the target file.
[0114] In step 420, the storage type change stage data in the target file node is set to be changed.
[0115] First, the field value corresponding to the storage type change stage data is found in the node information of the target file node. Then, the field value corresponding to the found storage type change stage data is set to be changed, indicating that the target file corresponding to the target file node needs to be changed in data storage type.
[0116] The advantage of this embodiment is that the various data in the metadata storage space form a target tree, making each file a specific node in the target tree, which can improve the storage rationality of the metadata of each file and the query convenience of the file node of each file. In addition, the target tree corresponding to each file storage architecture is maintained in the metadata storage space, which can manage the file directory and the file under each file storage architecture respectively, and can make the data management of the metadata storage space have better orderliness. Based on the target tree, after finding the target file node corresponding to the target file, changing the field value recording the storage type change stage data in the target file node to be changed can improve the convenience of data change.
[0117] Please refer to FIG. 5. In one embodiment, the process of generating the target tree includes but is not limited to the following steps 510-520:
[0118] Step 510, obtaining the file storage architecture in which the target file in the entity data storage space is located;
[0119] Step 520, taking the file storage architecture as the root node of the target tree, taking the folder in the file storage architecture as the branch node of the target tree, and taking each file in the folder as the leaf node under the branch node.
[0120] The steps 510-520 are described in detail below.
[0121] In step 510, the file storage architecture in which the target file in the entity data storage space is located is obtained.
[0122] The file storage architecture refers to a structure of storing and organizing various files. The file storage structure can be simply understood as a file system. The file storage architecture includes multiple folders (file directories) and files. In the file storage architecture, when the directory to which a file belongs and the file name are known, the file can be found.
[0123] In the implementation of the embodiment, the related data of each file storage architecture (file system) is often stored as a whole in the entity data storage space. Based on this, after the file storage architecture in which the target file is located is stored in the entity data storage space, the file storage architecture in which the target file is located can be obtained from the object storing the file storage architecture or from the entity data storage space under the condition of authorized permission.
[0124] In step 520, the file storage architecture is taken as the root node of the target tree, the folders in the file storage architecture are taken as the branch nodes of the target tree, and the files in the folders are taken as the leaf nodes under the branch nodes.
[0125] The branch node refers to some intermediate nodes of the target tree. The branch node corresponds to the folder in the file storage architecture. Therefore, the branch node can also be understood as some directory nodes in the target tree.
[0126] The leaf node corresponds to each file in the file storage architecture. Therefore, the leaf node can also be understood as some file nodes in the target tree.
[0127] In the implementation of the embodiment, when the target tree corresponding to the file storage architecture in which the target file is located is constructed, first, the file storage architecture is taken as the root node of the target tree. Then, according to the hierarchical relationship of each folder (file directory) and each file in the file storage architecture, the folders in the file storage architecture are taken as the branch nodes of the target tree in a hierarchical nested form, and each file in the folder is taken as the leaf node extending from the branch node. Until each folder and each file has a corresponding node, the complete target tree corresponding to the file storage architecture can be obtained.
[0128] As shown in FIG. 6, it is a structural diagram of a target tree of a file storage architecture (file system) in a metadata storage space. Specifically, in the file system, there are a folder Dir1 and a file file1, and the folder Dir1 has a file file2 and a folder Dir2. Based on this, the target tree has three levels, the first level is a root node constituted by the file storage architecture; the second level is constituted by the folder Dir1 and the file file1, wherein the folder Dir1 corresponds to a directory node (branch node) of the first level, and the file file1 corresponds to a file node (leaf node) of the first level; the third level is constituted by the folder Dir2 and the file file2, wherein the folder Dir2 corresponds to a directory node (branch node) of the second level, and the file file2 corresponds to a file node (leaf node) of the second level. In addition, in the target tree, the file path of the folder Dir1 is “ / Dir1”; the file path of the folder Dir2 is “ / Dir1 / Dir2”; the file path of the file file1 is “ / file1”; and the file path of the file file2 is “ / Dir1 / file2”.
[0129] The advantage of this embodiment is that, for each file storage architecture, the file storage architecture is taken as the root node of the target tree, the folder in the file storage architecture is taken as the branch node of the target tree, and each file under the folder is taken as the leaf node under the branch node, so that each data in the file storage architecture can be stored and managed in the form of a tree structure, the data in the metadata storage space is constructed into multiple target trees, and thus the related data of each file is recorded as node data in each file node, which can improve the query convenience and storage security of the related data of each file. In addition, the hierarchical relationship in the target tree can also clearly reflect the belonging relationship of each file in the file storage architecture, and the overall structure of the file storage architecture can have a better visualization degree.
[0130] Referring to FIG. 7, in one embodiment, the process of generating a storage type change request includes but is not limited to the following steps 710-740:
[0131] Step 710, obtaining multiple candidate storage type change rules for a file storage architecture in which a target file in an entity data storage space is located;
[0132] Step 720, for each candidate storage type change rule, determining a file path pointed to by the candidate storage type change rule in the target tree;
[0133] Step 730, determining a target storage type change rule from the multiple candidate storage type change rules based on the length of the file path pointed to by each of the multiple candidate storage type change rules;
[0134] Step 740, if it is determined that the trigger condition of the target storage type change rule is reached, a storage type change request is generated.
[0135] The steps 710-740 are described in detail below.
[0136] In step 710, a plurality of candidate storage type change rules for the file storage architecture where the target file in the entity data storage space is located are acquired.
[0137] The candidate storage type change rule is used to indicate that the file in the file storage architecture where the target file is located needs to change the storage type of the file data to what type under what condition.
[0138] In the implementation of this embodiment, since the plurality of candidate storage type change rules for the file storage architecture where the target file in the entity data storage space is located are pre-set by the target object. Based on this, under the condition of authorized permission, when the target object sets the candidate storage type change rule, the server detects this rule setting event for the file storage architecture where the target file is located, thereby acquiring the plurality of candidate storage type change rules for the file storage architecture where the target file is located.
[0139] To save space, in the embodiment of the present disclosure, the specific implementation process of generating the candidate storage type change rule will be described in detail below. Herein, no further description is made.
[0140] In step 720, for each candidate storage type change rule, the file path pointed to by the candidate storage type change rule in the target tree is determined.
[0141] The file path is used to indicate which files in the file storage architecture where the target file is located the candidate storage type change rule is applicable to, and to indicate the specific location of these files in the target tree.
[0142] In the implementation of this embodiment, since the target object often sets which files or file directories (folders) the candidate storage type change rule is associated with when setting the candidate storage type change rule. Based on this, the location of the folder or file in the target tree can be found according to the file or folder selected when setting the candidate storage type change rule, and the path from the leaf node corresponding to the file or the branch node corresponding to the folder to the root node is determined as the file path pointed to by the candidate storage type change rule.
[0143] In step 730, the target storage type change rule is determined from the plurality of candidate storage type change rules based on the length of the file path pointed to by each of the plurality of candidate storage type change rules.
[0144] The length is used to indicate how many levels the file path pointed by the candidate storage type change rule crosses in the target tree.
[0145] The target storage type change rule is used to indicate the finally effective candidate storage type change rule in the set of multiple candidate storage type change rules.
[0146] In the implementation of this embodiment, based on the length of each file path, the candidate storage type change rule with the longest file path length is taken as the target storage type change rule.
[0147] It should be noted that in the embodiments of the present disclosure, the effective candidate storage type change rule is in compliance with the principle of the longest file path length (pointing to the file with the smallest level in the target tree).
[0148] In step 740, if it is determined that the trigger condition of the target storage type change rule is reached, a storage type change request is generated.
[0149] The trigger condition is used to indicate the environmental condition to be met for triggering the target storage type change rule, where the trigger condition can be that the current time reaches a certain state, or the current network state meets a certain running condition, and the like.
[0150] In the implementation of this embodiment, first, the trigger condition of the target storage type change rule is determined. Then, when it is detected that the current environmental condition reaches the trigger condition of the target storage type change rule, a storage type change request is generated according to the target file pointed by the target storage type change rule and the required changed storage type.
[0151] The target file node of the target file belongs to the file path pointed by the target storage type change rule.
[0152] As shown in FIG. 8, it is a rule matching process for the target tree of the file system K. Specifically, the target tree of the file system K is composed of five levels. The root node of the first level is the file system K; the second level is the directory node corresponding to the folder usr and the directory node corresponding to the folder tmp; the third level is the directory node corresponding to the subfolder local of the folder usr; the fourth level is the directory node corresponding to the subfolder workspace of the folder local and the directory node corresponding to the subfolder service; and the fifth level is the file node of the file A and the file node of the file B in the subfolder workspace, and the file node of the file C and the file node of the file D in the subfolder service.
[0153] Based on this, when the target object is the file system K, the candidate storage type change rule is set as rule 1 "for files in the path " / usr / local / ", 15 days to sink to the deep archive type", rule 2 "for files in the path " / usr / local / workspace", 10 days to sink to the low-frequency storage type", and rule 3 "for files in the path " / usr / local / service", 10 days to sink to the archive storage type". As can be seen, rule 1 is directed to the directory node corresponding to the third-level folder local, and is applicable to files A, B, C, and D. Rule 2 is directed to the directory node corresponding to the fourth-level folder workspace, and is applicable to files A and B. Rule 3 is directed to the directory node corresponding to the fourth-level folder service, and is applicable to files C and D. According to the principle of the longest path, the effective candidate storage type change rules are rule 2 and rule 3.
[0154] The advantage of this embodiment is that, when generating a storage type change request, among the pre-set multiple candidate storage type change rules, according to the longest path matching rule, the candidate storage type change rule with a longer file path and applicable to a smaller level file node in the target tree is taken as the final effective rule (target storage type change rule), which can realize reasonable screening of multiple candidate storage type change rules, so as to quickly generate a storage type change request when the trigger condition of the target storage type change rule is hit, and improve the generation accuracy and rationality of the storage type change request.
[0155] Please refer to FIG. 9. In one embodiment, the generation process of the candidate storage type change rule includes, but is not limited to, the following steps 910-940:
[0156] Step 910, in response to a rule configuration request for a file storage architecture, obtaining a rule trigger time and storage type change information;
[0157] Step 920, determining a rule-associated file in each file included in the file storage architecture, and generating a file path based on the position of the leaf node corresponding to the rule-associated file in the target tree;
[0158] Step 930, performing a first verification on the storage type change information based on a pre-set storage type conversion rule;
[0159] Step 940, if it is determined that the storage type change information passes the first verification, generating a candidate storage type change rule based on the rule trigger time, the storage type change information, and the file path.
[0160] The steps 910-940 are described in detail below.
[0161] In step 910, in response to the rule configuration request for the file storage architecture, the rule trigger time and the storage type change information are acquired.
[0162] The rule configuration request refers to a request initiated by a target object when the target object wants to set a storage type change rule for files under some file directories in the file storage architecture.
[0163] The rule trigger time is used to indicate a specific time requirement for executing a candidate storage type change rule. The rule trigger time can be a specific time point, or can indicate a time interval from the current time point.
[0164] The storage type change information is used to indicate a storage type to which file data of a file is to be converted, i.e., a changed storage type.
[0165] In the implementation of this embodiment, when the target object wants to configure a rule for files in a file storage architecture, the target object will edit the rule trigger time and the storage type change information, and provide the rule trigger time and the storage type change information with the initiated rule matching request to the server. Based on this, under the condition of authorized permission, the server will acquire the rule trigger time and the storage type change information configured by the target object on the front-end interface in response to the rule configuration request.
[0166] In step 920, a rule-associated file is determined in each file of the file storage architecture, and a file path is generated based on a position of a leaf node corresponding to the rule-associated file in the target tree.
[0167] In the implementation of this embodiment, first, according to the storage type change information provided by the target object, it is acquired which files the storage type change information points to and which files are to be changed in storage type, so that in each file of the file storage architecture, the files to be changed in storage type pointed to by the storage type change information are determined as rule-associated files. Then, the file node corresponding to the rule-associated file in the target tree is found, and the path connecting the file node to the root node is taken as the file path.
[0168] In step 930, the storage type change information is first verified based on a preset storage type conversion rule.
[0169] The storage type conversion rule is used to indicate a conversion requirement to be met by conversion of a storage type of file data, and is used to limit which conversions between storage types are feasible and which conversions between storage types are infeasible.
[0170] In the embodiment, when the first verification on the storage type change information is performed, first, the changed storage type indicated in the storage type change information is extracted. Then, the storage type of the rule association file at the current time point is acquired for the rule association file pointed by the storage type change information. Further, according to the storage type conversion rule, it is judged whether the storage type of the rule association file at the current time point supports conversion to the changed storage type indicated by the storage type change information. If the conversion from the storage type at the current time point to the changed storage type indicated by the storage type change information is supported in the storage type conversion rule, it is determined that the first verification is passed. If the conversion from the storage type at the current time point to the changed storage type indicated by the storage type change information is not supported in the storage type conversion rule, it is determined that the first verification is failed, and the rule configuration request of the target object is rejected.
[0171] In step 940, if it is determined that the storage type change information passes the first verification, a candidate storage type change rule is generated based on the rule trigger time, the storage type change information, and the file path.
[0172] In the embodiment, if it is determined that the first verification is passed, it indicates that the target file supports conversion from the storage type at the current time point to the changed storage type indicated by the storage type change information, so the rule trigger time, the storage type change information, and the file path can be assembled into the candidate storage type change rule.
[0173] For example, a certain candidate storage type change rule can be expressed as "for the file at path " / usr / local / workspace", 10 days to cold storage type", wherein "10 days" is the rule trigger time, "to cold storage type" is the storage type change information, and " / usr / local / workspace" is the file path.
[0174] Fig. 10 is a diagram illustrating a specific structure of a storage type conversion rule. The storage types of the file data of a file include, but are not limited to, Normal, intelligentNormal, Degrade, arch, intelligentDegrade, deepArch, and delete. Based on this, the supported change cases when performing storage type change include the following: conversion from Normal to intelligentNormal is supported; conversion between Degrade and intelligentDegrade is supported; conversion from intelligentNormal to Degrade is supported; conversion from Degrade, intelligentNormal, or intelligentDegrade to arch is supported; conversion from arch to deepArch is supported; and conversion from arch or deepArch to delete is supported. In the specific structure of the storage type conversion rule, the priority of each storage type increases from bottom to top, i.e., the storage type of the upper layer is prior to the storage type of the lower layer. When performing delete, the file node can be deleted according to the file path in the target tree, or the file node can be deleted according to the node ID in the target tree.
[0175] The embodiment has the advantage that when generating the candidate storage type change rule according to the rule trigger time and the storage type change information provided by the target object, a storage type conversion rule is set to limit the supported storage type change manner. When the storage type change information provided by the target object meets the storage type conversion rule (when the first verification is passed), the rule trigger time, the storage type change information, and the file path are assembled into the candidate storage type change rule. This can improve the rationality of the generation of the candidate storage type change rule, and further improve the feasibility of the storage type change of the file data of the file.
[0176] Step 320 is described in detail below.
[0177] In step 320, a change indication is assigned to each data segment, and the storage type change phase data of the target file is set to be in change in the metadata storage space.
[0178] Referring to Fig. 11, in an embodiment, step 320 specifically includes, but is not limited to, the following steps 1110-1150:
[0179] Step 1110, in the target tree, a plurality of metadata blocks corresponding to the target file node are obtained.
[0180] Step 1120, a preset mapping table is obtained.
[0181] Step 1130, for each metadata block, compare the target metadata contained therein with each candidate metadata in the preset mapping table;
[0182] Step 1140, determine the candidate data segment corresponding to the candidate metadata consistent with the target metadata as the target data segment;
[0183] Step 1150, based on the changed storage type indicated by the storage type change request, generate a change indication, and assign the change indication to each target data segment.
[0184] The steps 1110-1150 are described in detail below.
[0185] In step 1110, in the target tree, a plurality of metadata blocks corresponding to the target file node are obtained.
[0186] The metadata block refers to the block structure for storing the metadata of the target file node in the metadata storage space.
[0187] The metadata block contains at least one target metadata. One target metadata is used to indicate the basic characteristic information of one data segment of the target file node. Different target metadata is used to indicate the basic characteristic information of different data segments.
[0188] In the implementation of this embodiment, under the condition of authorized permission, the server can obtain node information, metadata structure, etc. related to the target file node in the metadata storage space. Based on this, data extraction can be performed in the obtained metadata structure related to the target file node, so as to obtain a plurality of metadata blocks corresponding to the target file node.
[0189] For example, in the entity data storage space, the target file is divided into 4 equal-length data segments, and in the metadata storage space, the target file node will have four metadata blocks (block), each of which records the target metadata (range) corresponding to one data segment (object).
[0190] In step 1120, a preset mapping table is obtained.
[0191] The preset mapping table includes a plurality of candidate data segments in the entity data storage space, and candidate metadata corresponding to each candidate data segment in the metadata storage space.
[0192] The candidate data segment refers to the file data of each file stored in the entity data storage space.
[0193] The candidate metadata refers to the file metadata of each file stored in the metadata storage space.
[0194] In the implementation of this embodiment, the preset mapping table is built according to the correspondence between the file data and the metadata of each file when storing the file data of each file into the entity data storage space and storing the metadata of each file into the metadata storage space, and is constantly updated with the continuous file storage. Based on this, under the condition of authorized permission, the server can directly call the preset mapping table being maintained all the time to obtain the mapping relationship between the file data of each file stored in the entity data storage space and the metadata of each file stored in the metadata storage space from the preset mapping table.
[0195] In step 1130, for each metadata block, the target metadata contained therein is compared with each candidate metadata in the preset mapping table to determine which candidate metadata is consistent with the target metadata.
[0196] In step 1140, the candidate data segment corresponding to the candidate metadata consistent with the target metadata is determined as the target data segment.
[0197] The target data segment is a data segment into which the target file is divided.
[0198] In the implementation of this embodiment, if the candidate metadata in the preset mapping table is consistent with the target metadata, it indicates that the candidate metadata and the target metadata are the same metadata, and the candidate data segment corresponding to the candidate metadata consistent with the target metadata is determined as the target data segment.
[0199] In step 1150, based on the changed storage type indicated by the storage type change request, a change indication is generated, and the change indication is allocated to each target data segment.
[0200] In the implementation of this embodiment, first, the changed storage type indicated by the storage type change request is filled into the preset template, and the preset template filled with the changed storage type is taken as the change indication. Then, the change indication is allocated to each target data segment, so that each target data segment is allocated to one change indication. The change indications to which the target data segments of the target file are allocated are basically the same.
[0201] As shown in FIG. 12, it is a diagram of the specific metadata structure of the file node (the leaf node corresponding to the file A.txt) in the target tree of a file storage architecture, and the mapping relationship between the metadata of the file A and the file data. Specifically, in the entity storage space, the file data of the file A is equally divided into four candidate data segments, which are candidate data segment 1 (object 1), candidate data segment 2 (object 2), candidate data segment 3 (object 3), and candidate data segment 4 (object 4) in sequence. In the target tree, the metadata of the file node of the file A is composed of four metadata blocks, wherein the four metadata blocks are metadata block 1 (block 1) storing target metadata 1, metadata block 2 (block 2) storing target metadata 2, metadata block 3 (block 3) storing target metadata 3, and metadata block 4 (block 4) storing target metadata 4 in sequence. The target metadata 1 is used to describe the basic characteristics of the candidate data segment 1, the target metadata 2 is used to describe the basic characteristics of the candidate data segment 2, the target metadata 3 is used to describe the basic characteristics of the candidate data segment 3, and the target metadata 4 is used to describe the basic characteristics of the candidate data segment 4. As can be seen, in the target tree, each target metadata of the file A corresponds to a candidate data segment in the entity data storage space.
[0202] The advantage of this embodiment is that in the metadata storage space, the file metadata of each file is stored in blocks, that is, the file metadata is stored and managed in the form of multiple metadata blocks. At the same time, the mapping relationship between the file metadata of each file and the file data (multiple data segments) is constructed in the metadata storage space. When receiving a storage type change request for a target file, in the metadata storage space, the target file node can be quickly found, and according to the target metadata stored in each metadata block of the found target file node and the mapping relationship between the target metadata and the data segments of the entity data storage space, the multiple data segments (i.e., target data segments) corresponding to the target file can be quickly and accurately found in the entity storage space, thereby improving the efficiency of finding the target data segments and the efficiency of allocating change indicators to each target data segment.
[0203] The step 330 is described in detail below.
[0204] In step 330, a storage type change operation corresponding to the change indicator is performed for each data segment, and after the storage type change operation is performed for all the data segments, the storage type change stage data of the target file is set to changed in the metadata storage space.
[0205] If only the storage type of each data segment of the target file is changed without marking the storage type of each data segment of the target file, it will lead to the fact that whether the storage type of each data segment is changed completely cannot be determined accurately, and the difficulty of the storage type changing process and the verification of the changing result will be increased. Based on this, the embodiment of the present disclosure provides a storage type changing scheme based on updating the field value of the storage type field of each data segment, which can clearly describe and mark the process of the storage type changing, and improve the queryability of the storage type changing process.
[0206] In the embodiment of the present disclosure, the data segment contains a storage type field. The storage type field is used to indicate which specific storage type the data segment of the target file is in at the current time point.
[0207] Please refer to FIG. 13. In one embodiment, step 330 specifically includes but is not limited to steps 1310-1320:
[0208] Step 1310, after the storage type changing operation for a single data segment is performed, the storage type field of the data segment is set to the target storage type.
[0209] Step 1320, after the storage type fields of the multiple data segments are all the target storage type, in the metadata storage space, the storage type changing stage data of the target file is set to changed.
[0210] The steps 1310-1320 are described in detail below.
[0211] In step 1310, after the storage type changing operation for a single data segment is performed, the storage type field of the data segment is set to the target storage type.
[0212] The target storage type is the changed storage type indicated by the storage type changing request.
[0213] In the implementation of this embodiment, first, the corresponding storage type changing operation is performed according to the change indication for a single data segment, and the current storage type of the data segment is changed to the indicated changed target storage type. Then, after the storage type changing operation for the data segment is performed, the storage type field of the data segment is set to the target storage type.
[0214] In step 1320, after the storage type fields of the multiple data segments are all the target storage type, in the metadata storage space, the storage type changing stage data of the target file is set to changed.
[0215] In the implementation of this embodiment, first, the storage type fields of the data segments are respectively subjected to field detection to determine whether the storage type fields of the data segments are all set to the target storage type. Then, after it is determined that the storage type fields of the data segments are all the target storage type, it is indicated that the storage types of all the data segments of the target file have been changed, and based on this, the storage type change stage data of the target file is set to changed in the metadata storage space, so that the storage type change stage data of the target file and the real storage types of the data segments can be kept consistent.
[0216] As shown in FIG. 14, it is a specific diagram of performing allocation change indication on each data segment of a target file and performing a storage type change operation. Specifically, in the entity data storage space, the target file is divided into four data segments, which are data segment 1, data segment 2, and data segment 3 in turn. Among them, before the storage type change, the change indication of each data segment of the target file is empty, and the storage type field is the archive storage type. Based on this, when the storage type change request requires converting the storage type of the file data of the target file to the deep archive storage type, the server will generate the change indication “change to deep archive storage”, and allocate the change indication to the four data segments of the target file respectively to realize the marking of each data segment. At this time, the change indication of each data segment of the target file is “change to deep archive storage”, but the storage type field of each data segment is still the archive storage. Further, in the storage type change, each data segment performs the storage type change operation corresponding to the change indication to change the storage type according to the change indication, and after the storage type change of each data segment is completed (the storage type change operation is performed), the change indication of each data segment of the target file becomes empty again, but the storage type field of each data segment has been changed from the original archive storage to deep archive storage.
[0217] The advantage of this embodiment is that a storage type field is set for each data segment to record the real storage type of the data segment at the current time. By clearly marking the storage type of each data segment of the target file by using the storage type field, after the storage type change operation corresponding to the change indication is performed for a single data segment, the storage type field of the data segment is modified, which can more accurately determine whether the storage type of each data segment has been changed, so that the process of the storage type change can be clearly described and marked, the queryability of the storage type change process is improved, and the difficulty of checking the storage type change result is reduced.
[0218] The following is a detailed description of the process of changing the storage category of the target file of the first type in one embodiment of the present disclosure.
[0219] Since the file types of the files in each file storage architecture often have some differences, for some ordinary files, the file node of the ordinary file in the target tree often has only one, and for some hierarchical files composed of multiple sub files, the file node of the hierarchical file in the target tree often has multiple sub nodes. If only the metadata and the data segment corresponding to the file node itself are considered when the storage type of the file data of various files is changed, the storage type of the file data often does not match the storage type change stage data of the file node. For example, when the file data of the hierarchical file is not all changed to the target storage type, the storage type change stage data is changed. Based on this, the embodiment of the present disclosure provides a scheme for changing the storage type of a specific type of target file, which can reduce the inconsistency between the storage type of the file data of the specific type of target file (the hierarchical file) and the storage type change stage data of the file node.
[0220] Please refer to FIG. 15, in one embodiment, step 320 specifically includes but is not limited to the following steps 1510-1570:
[0221] Step 1510, if the type of the target file is the first type, in the target tree, a plurality of file sub nodes under the target file node are obtained;
[0222] Step 1520, for each file sub node, in the target tree, a plurality of metadata blocks of the file sub node are obtained;
[0223] Step 1530, a preset mapping table is obtained;
[0224] Step 1540, for each metadata block, the target metadata contained therein is compared with each candidate metadata in the preset mapping table;
[0225] Step 1550, the candidate data segment corresponding to the candidate metadata consistent with the target metadata is determined as an intermediate data segment;
[0226] Step 1560, a plurality of intermediate data segments are integrated into a target data segment;
[0227] Step 1570, based on the changed storage type indicated by the storage type change request, a change indication is generated, and each target data segment is allocated with the change indication.
[0228] The steps 1510-1570 are described in detail below.
[0229] In step 1510, if the type of the target file is the first type, in the target tree, a plurality of file sub nodes under the target file node are obtained.
[0230] The first type is used to indicate that the target file comprises a plurality of partition files.
[0231] The partition file refers to each sub-file included under the target file, and the collection of the partition files can form the first type of target file.
[0232] In a specific example, the first type of target file is an MPU file (Memory Pool Unit), and the target file can be a file related to cache management of a file system; and the partition file of the target file is a Part file (Partition), and the partition file can represent specific information of a specific region (for example, size, position, etc. of a specific partition).
[0233] Each partition file has a corresponding file sub-node in the target tree. The file sub-node is used to indicate the location of each partition file in the target tree.
[0234] It should be noted that, since each partition file is composed of the target file, the partition file can be regarded as a sub-file of the target file. There is a subordinate relationship between the target file and the partition file. Therefore, in the target tree, the file sub-node of the partition file is generally a leaf node of the next level of the target file node corresponding to the target file, and the file sub-node is extended from the target file node.
[0235] When the embodiment is specifically implemented, if the type of the target file is the first type, it indicates that the target file is formed by the collection of a plurality of partition files. First, the target file node corresponding to the target file is obtained in the target tree. Then, the leaf nodes subordinate to the target file node are determined as a plurality of file sub-nodes corresponding to a plurality of partition files.
[0236] Steps 1520-1550 are similar to steps 1110-1140 described above. For the sake of brevity, they will not be described again.
[0237] In step 1560, a plurality of intermediate data segments are integrated into a target data segment.
[0238] The intermediate data segment is a data segment divided by the partition file. The target data segment is a data segment divided by the target file.
[0239] When the embodiment is specifically implemented, since each intermediate data segment represents a part of file data of each partition file, and the target file is formed by a plurality of partition files, based on this, all intermediate data segments are collected into a set, and all data segments in the set represent all file data of the target file, therefore, the data segments in the set are taken as the target data segment.
[0240] Step 1570 is similar to step 1150 described above. For the sake of brevity, it will not be described again.
[0241] The embodiment has the advantages that the change of the data storage type of the hierarchical file such as the MPU file is considered, when it is determined that the target file is of the first type, the file child nodes of each partition file corresponding to the target file are determined in the target tree first, further, the storage type change is performed based on each partition file as a basic unit, and all target data segments corresponding to the target file are integrated based on the metadata of the file child nodes of each partition file, so that the target data segments corresponding to the target file can be quickly collected, and the same change indication is allocated to each target data segment, which can meet the requirement of the storage type change of different types of files and has good universality. In addition, for the hierarchical target file, the storage type change of the file data can also be performed through the file node in the target tree and the mapping relationship between the metadata and the data segment in the file node, so that the inconsistency between the storage type of the file data of the specific type of target file (the hierarchical file) and the storage type change stage data of the file node can be reduced.
[0242] Please refer to FIG. 16, in the embodiment, the step 330 specifically includes but is not limited to the following steps 1610-1620:
[0243] In step 1610, after the storage type change operation is performed on each data segment of the single partition file, the storage type change stage data of the partition file is set as changed in the metadata storage space.
[0244] In step 1620, after the storage type change stage data of the multiple partition files are all changed, the storage type change stage data of the target file is set as changed in the metadata storage space.
[0245] The steps 1610-1620 are described in detail as follows.
[0246] In step 1610, for each partition file, the storage type change operation corresponding to the change indication is performed, and when it is determined that the storage type change operation is performed on each data segment in the partition file, it is indicated that the data segments of the partition file have completed the storage type change, so the storage type change stage data of the partition file is set as changed in the metadata storage space, and the specific process is similar to the above steps 1310-1320. To save space, no longer description.
[0247] In step 1620, first, it is detected whether the storage type change stage data of each partition file has all become changed to determine whether the storage type of the file data of each partition file has all been changed. Then, when it is determined that the storage type change stage data of each partition file is all changed, it indicates that the storage type of the file data of each partition file has all been changed, and therefore, the storage type change stage data of the target file can be set to changed in the metadata storage space.
[0248] The advantage of this embodiment is that when the storage type of data is changed, the storage type change is performed in the unit of partition file, and after the storage type change of each data segment of a single partition file is completed, the storage type change stage data of the partition file is set to changed, and only when the storage type change stage data of all partition files is changed, the storage type change stage data of the target file is updated, which realizes the data change in the form of from bottom to top (from part to whole), effectively improves the setting accuracy of the storage type change stage data of the target file, reduces the risk caused by modifying the storage type change stage data of the target file before the file data of part of the partition files is changed, and is beneficial to improving the consistency of the storage type of the file data of the target file of a specific type and the storage type change stage data of the file node in the data storage type change.
[0249] The following is a detailed description of the process of generating a plurality of candidate data segments in one embodiment of the present disclosure.
[0250] Please refer to FIG. 17, in one embodiment, the process of generating a plurality of candidate data segments of the entity data storage space includes but is not limited to the following steps 1710-1730:
[0251] Step 1710, obtaining a plurality of candidate file storage architectures;
[0252] Step 1720, for each candidate file in each candidate file storage architecture, the candidate file is divided into a plurality of file data blocks according to a predetermined size;
[0253] Step 1730, taking one file data block as one candidate data segment, and storing a plurality of candidate data segments into a preset storage bucket of the entity data storage space.
[0254] The following is a detailed description of steps 1710-1730.
[0255] In step 1710, a plurality of candidate file storage architectures are obtained.
[0256] The candidate file storage architecture refers to the storage structure system in which each file in the entity data storage space is located, wherein the candidate file storage architecture can be understood as each different file system.
[0257] In the embodiment, when the plurality of candidate file storage architectures are obtained, each object can be requested to obtain a file system set by the object under the condition of authorized permission, and the file system is taken as the candidate file storage architecture. Alternatively, each file stored in a directory according to a certain architecture can be obtained on each data source, and the obtained architecture and the directory and file under the architecture are taken as the candidate file storage architecture.
[0258] In step 1720, for each candidate file in each candidate file storage architecture, the candidate file is divided into a plurality of file data blocks according to a predetermined size.
[0259] The candidate file refers to a file in a file directory (folder) in the candidate file storage architecture.
[0260] The predetermined size is used to limit the data amount of data contained in each file data block.
[0261] The file data block is used to indicate a divided independent data unit.
[0262] In the embodiment, for each candidate file of each candidate file storage architecture, the candidate file is divided into a plurality of data blocks of the same data amount according to a predetermined size, and a plurality of file data blocks corresponding to the candidate file are obtained.
[0263] In step 1730, one file data block is taken as one candidate data segment, and a plurality of candidate data segments are stored in a preset storage bucket of the entity data storage space.
[0264] The preset storage bucket refers to a container for storing file data in the entity data storage space. The capacity of the preset storage bucket has no upper limit, and the preset storage bucket can realize flat management of file data of each candidate file in the entity data storage space, and eliminate the hierarchical structure characteristics of each candidate file in the file directory / architecture in the candidate file storage architecture.
[0265] In the embodiment, when the file data of each candidate file is stored, one file data block is taken as one candidate data segment, and a plurality of candidate data segments are stored in a preset storage bucket of the entity data storage space, so as to realize unified storage and management of the plurality of candidate data segments.
[0266] As shown in FIG. 18, it is a specific process of bucket label setting of a storage bucket in the entity data storage space. Specifically, the storage type transformation rule applicable to each candidate data segment stored in the storage bucket is low frequency / low cost storage (fsid_standard_IA), archive storage (fsid_archive) and deep archive storage (fsid_deep_archive). When assigning the change indication to each data segment of the target file, the change indication is taken as the key and the changed storage type corresponding to each data segment is taken as the value. For the storage bucket, according to the rule predetermined by the storage bucket, the converted value (storage type) can be low frequency / low cost storage, archive storage or deep archive storage.
[0267] The advantage of this embodiment is that the candidate files of each candidate file storage structure are divided according to the predetermined size, so that each candidate data segment stored in the entity data storage space has a relatively uniform data size; at the same time, when storing the file data of each candidate file in the entity data storage space, the storage bucket is taken as a container to store each candidate data segment, which can realize the flat management and storage of file data, eliminate the inherent hierarchical characteristics of candidate files in the candidate file storage architecture, and improve the simplicity of data storage in the entity data storage space.
[0268] The following is a detailed description of the process of accessing the metadata storage space in one embodiment of the present disclosure.
[0269] After storing the file data and metadata of the file in different management platforms, the user often needs to access the metadata storage space and obtain the metadata of some files from the metadata storage space due to some business needs. However, the request initiated by the user through different business ports often has request incompatibility and other problems, which can cause the request to not normally reach the metadata storage space, resulting in metadata acquisition failure. For example, the business request initiated by the user through the external interface of the entity data storage space cannot be directly transmitted to the metadata storage space. Based on this, the present embodiment provides a protocol conversion-based way to obtain the file metadata of the metadata storage space, which can improve the reliability and success rate of metadata acquisition.
[0270] In one embodiment, after storing the plurality of candidate data segments in the preset storage bucket of the entity data storage space, the storage type changing method further includes:
[0271] Accessing the metadata storage space.
[0272] Please refer to FIG. 19. In this embodiment, the process of accessing the metadata storage space includes but is not limited to the following steps 1910-1930:
[0273] Step 1910, obtaining a data obtaining request for the metadata storage space;
[0274] Step 1920, performing protocol conversion on the data obtaining request based on a preset protocol conversion interface to obtain a converted obtaining request;
[0275] Step 1930, calling the metadata in the metadata storage space based on the converted obtaining request through a preset data access interface.
[0276] The steps 1910-1930 are described in detail as follows.
[0277] In step 1910, a data obtaining request for the metadata storage space is obtained.
[0278] The data obtaining request refers to a request initiated by a user (for example, a target object) when the user wants to obtain file metadata of a file.
[0279] In the implementation of the embodiment, when an object wants to obtain file metadata of a file, the object initiates a data obtaining request on a data processing platform of a terminal of the object. Based on this, the server can obtain the data obtaining request for the metadata storage space under the condition of authorization permission.
[0280] In step 1920, protocol conversion is performed on the data obtaining request based on a preset protocol conversion interface to obtain a converted obtaining request.
[0281] The protocol conversion interface is used to perform protocol conversion on the data obtaining request initiated by the user to obtain a request meeting predetermined protocol requirements.
[0282] For example, when the protocol conversion interface is a Gateway interface, the protocol conversion interface can convert a request based on an S3 protocol into a request based on posix semantics, where the request based on posix semantics is a protocol type that can be received by a metadata server layer of the metadata storage space.
[0283] The converted obtaining request is used to indicate a protocol conversion result of the data obtaining request. The converted obtaining request and the data obtaining request are basically consistent in request content, except that the transmission protocols based on which the two requests are different.
[0284] In the implementation of the embodiment, first, the server forwards the data obtaining request to the protocol conversion interface. Then, the protocol conversion interface performs protocol conversion on the data obtaining request, converts the protocol of the data obtaining request into a protocol type acceptable by the metadata storage space, and obtains the converted obtaining request.
[0285] In step 1930, based on the converted acquisition request, the metadata in the metadata storage space is called through the preset data access interface.
[0286] The data access interface is used to realize the forwarding of the request and send the request meeting the predetermined protocol requirement to the management end of the metadata storage space.
[0287] In the implementation of this embodiment, first, the preset data access interface sends the converted acquisition request to the metadata service layer of the metadata storage space, and then the metadata service layer performs request verification on the converted acquisition request. After verifying the request content and the request initiating object and the like of the converted acquisition request and determining that the request verification is passed, the metadata service layer calls the metadata in the metadata storage space and feeds back the metadata in the metadata storage space to the object through the data access interface and the protocol conversion interface.
[0288] As shown in FIG. 20, it is an access example of the metadata storage space based on protocol conversion. Specifically, when the user Actor wants to acquire the file metadata in the metadata storage space, first, the data acquisition request is sent to the access layer (COS CGI) of the entity data storage space through the interface (object storage API) of the entity data storage space, and then the data acquisition request is forwarded to the protocol conversion interface (Gateway) for protocol conversion to obtain the converted acquisition request. Further, the converted acquisition request is sent to the metadata service layer (MetaServer) of the metadata storage space through the data access interface (proxy). Similarly, when creating or deleting some data of the metadata storage space, the data deletion request or the data creation request can also be forwarded to the data management interface / data management layer (RootServer) through the access layer (COS CGI) of the entity data storage space, and then sent to the metadata service layer (MetaServer) of the metadata storage space by the data management interface / data management layer (RootServer).
[0289] The advantage of this embodiment is that when acquiring the file metadata of the metadata storage space, the request incompatibility problem of the request initiated by the user from different business ports is considered, and the protocol conversion based manner is provided to acquire the file metadata of the metadata storage space. The protocol conversion interface is used to perform protocol conversion on the data acquisition request, generate the converted acquisition request acceptable by the metadata storage space, and send the converted acquisition request to the management end of the metadata storage space through the data access interface, which can improve the reliability and success rate of metadata acquisition.
[0290] Since the metadata storage space often needs to store a large amount of file metadata, the metadata storage space is often implemented by a metadata master service and a metadata slave service to manage each file metadata. Therefore, in actual storage, according to the metadata master service and the metadata slave service, a plurality of sub-storage spaces are divided in the metadata storage space, for example, one metadata master service corresponds to one specific sub-storage space, and one metadata slave service also corresponds to one specific sub-storage space, and each sub-storage space is managed by different metadata master service / metadata slave service; thus, the file metadata of each file of different file systems is stored in different sub-storage spaces. Among them, in the embodiment of the present disclosure, the target tree where the target file is located is stored in the target sub-storage space of the metadata storage space.
[0291] The target sub-storage space refers to a specific sub-storage space in the metadata storage space.
[0292] Please refer to FIG. 21, in one embodiment, after the target tree is generated in the metadata storage space, the storage type changing method further includes but is not limited to the following steps 2110-2130:
[0293] Step 2110, in response to the metadata access request for the file storage architecture where the target file is located, the architecture index of the file storage architecture is obtained;
[0294] Step 2120, based on the architecture index, data query is performed through a preset data management interface to obtain the storage location of the target tree in the target sub-storage space;
[0295] Step 2130, based on the storage location, the target tree is called through a preset data access interface to obtain the file metadata in the target tree.
[0296] The steps 2110-2130 are described in detail below.
[0297] In step 2110, in response to the metadata access request for the file storage architecture where the target file is located, the architecture index of the file storage architecture is obtained.
[0298] The metadata access request is a request initiated by the user when he wants to access the metadata of the metadata storage space.
[0299] Since one target tree in the metadata storage space corresponds to one file storage architecture, the architecture index of the file storage architecture can be used to uniquely identify each target tree, therefore, the architecture index is used to indicate which target tree in the metadata storage space is the file storage architecture.
[0300] In the embodiment, when the object needs to acquire the metadata corresponding to the file storage architecture where the target file is located, the object initiates a metadata access request for the file storage architecture where the target file is located. Then, the server responds to the metadata access request for the file storage architecture where the target file is located, and determines the file storage architecture and the architecture index of the file storage architecture according to the target file, based on the authorized permission.
[0301] In step 2120, based on the architecture index, data is queried through the preset data management interface to obtain the storage location of the target tree in the target sub storage space.
[0302] The data management interface is used to manage the file system of the metadata storage space and the metadata of the file, and the management forms include but are not limited to creating or deleting the target tree corresponding to the file system (file storage architecture), changing the attribute of the target tree corresponding to the file system (file storage architecture), and the like.
[0303] In some practical applications, the data management interface can be a Root server interface (RS interface).
[0304] The storage location is used to indicate the specific location of the target tree in the target sub storage space.
[0305] In the embodiment, first, the candidate architecture indexes corresponding to the target trees in each sub storage space in the metadata storage space are acquired through the preset data management interface. Then, data is queried through the data management interface to find the candidate architecture index consistent with the architecture index indicated by the metadata access request in the plurality of candidate architecture indexes. Finally, the specific location of the target tree corresponding to the candidate architecture index consistent with the architecture index indicated by the metadata access request in the metadata storage space (target sub storage space) is taken as the storage location of the target tree where the target file is located in the target sub storage space.
[0306] In step 2130, based on the storage location, the target tree is called through the preset data access interface to acquire the file metadata in the target tree.
[0307] The data access interface is used to provide the metadata interface externally, and the data access interface is used to realize the protocol conversion and forwarding of the request, and send the request meeting the predetermined protocol requirement to the management end of the metadata storage space.
[0308] The file metadata is used to describe the file data of each file.
[0309] In the embodiment, the specific process of step 2130 is similar to that of step 1930 described above. For the sake of brevity, no longer be described.
[0310] As shown in FIG. 22, it is a specific process of accessing the metadata storage space. Specifically, when the user client accesses the metadata storage space, first, the metadata access request is sent to the data management interface / data management layer (RootServer), and the data management interface / data management layer (RootServer) finds the target tree corresponding to the metadata access request according to the target tree maintained by the plurality of metadata storage master services (MDS Master) and the plurality of metadata storage slave services (MDS Slave) in the metadata storage space, and provides the storage location of the target tree to the user. Further, the user provides the storage location to the data access interface (proxy) through the metadata stream, and the data access interface finds the corresponding metadata in the metadata storage space according to the storage location and feeds back to the user. Wherein, the databases where various metadata in the metadata storage space can constitute a database cluster (DB cluster), and the database cluster includes CDB data, TDSQL data, and CynosDB data and other types of data. In addition, when the user wants to obtain the file data in the entity data storage space, the data acquisition request can be directly sent to the entity data storage space, and the file data is obtained through the data stream.
[0311] The advantage of this embodiment is that when the metadata access request is received, the specific location of the target data corresponding to each target tree of the metadata storage space can be queried according to the architecture index of the file storage architecture, so as to realize accurate and fast positioning of the target tree in the metadata storage space. Further, the preset data access interface (Proxy interface) is used for protocol conversion and forwarding according to the metadata access request, so as to realize fast calling of the metadata of the target tree in the metadata storage space, and improve the convenience of obtaining the metadata.
[0312] The following is a detailed description of the process of updating the metadata block of each file in the metadata storage space in one embodiment of the present disclosure.
[0313] Please refer to FIG. 23, in one embodiment, the process of updating the metadata block of each file in the metadata storage space includes but is not limited to the following steps 2310-2320:
[0314] Step 2310, for each metadata block, data detection is performed on the metadata block;
[0315] Step 2320, if it is determined that the target metadata of the metadata block does not reach the preset number, the preset data appending interface is called, the metadata corresponding to the preset supplement data is supplemented into the metadata block, and the metadata of the metadata block is updated.
[0316] The steps 2310-2320 are described in detail as follows.
[0317] In step 2310, data detection is performed on the metadata block for each metadata block.
[0318] In the embodiment, for each metadata block, the number of target metadata in the metadata block is obtained, so as to detect the space utilization of the metadata block according to the number of target metadata.
[0319] In step 2320, if it is determined that the target metadata of the metadata block does not reach the preset number, a preset data appending interface is called to supplement the metadata corresponding to the preset additional data into the metadata block, so as to update the metadata of the metadata block.
[0320] The preset number is used to indicate the upper limit of the data of the metadata that can be accommodated by the metadata block.
[0321] The data appending interface is used to upload the metadata corresponding to the data in the file data of the subsequent supplemented file to the metadata block of the file.
[0322] The preset additional data is used to indicate the specific data additionally added in the file data of the target file in the entity data storage space.
[0323] In the embodiment, first, the number of target metadata of the metadata block is compared with the preset data. Then, if it is determined that the target metadata of the metadata block does not reach the preset number, it indicates that there is free space in the metadata block where the target metadata is located. Therefore, the preset data appending interface is called to supplement the metadata corresponding to the specific data (preset additional data) additionally added in the file data of the target file in the entity data storage space into the metadata block, so that the metadata block stores two parts of metadata (target metadata and metadata corresponding to the preset additional data), thereby realizing the metadata update of the metadata block.
[0324] As shown in FIG. 24A, it is a process of implementing metadata appending to metadata block 4 of file A. Specifically, the file node in the target tree of the file storage architecture corresponds to a file A, wherein the size of file A is 15M. File A is divided into four data segments in the entity data storage space according to the size of 4M, which are data segment 1 of 4M, data segment 2 of 4M, data segment 3 of 4M, and data segment 4 of 3M in turn, and the metadata corresponding to the four data segments are stored in four different metadata blocks respectively, wherein the metadata corresponding to data segment 1 is stored in metadata block 1; the metadata corresponding to data segment 2 is stored in metadata block 2; the metadata corresponding to data segment 3 is stored in metadata block 3; and the metadata corresponding to data segment 4 is stored in metadata block 4. Since the metadata allowed to be stored in each metadata block is at most 4M, there is a certain free space in metadata block 4. Based on this, a supplement data (i.e. data segment 5) corresponding to file A can be appended in the entity data storage space, and the metadata corresponding to data segment 5 is stored in metadata block 4 in the target tree, so that the storage space of metadata block 4 is fully utilized, and at this time, metadata block 4 has two metadata, i.e. the metadata corresponding to data segment 4 and the metadata corresponding to data segment 5.
[0325] The advantage of this embodiment is that for the metadata block of each file of the metadata storage space, a data amount detection link of the metadata block is introduced, so that when there is free space in the metadata block, the metadata corresponding to the related data supplemented in the file data of the file in the entity data storage space can be supplemented into the metadata block of the file, the metadata storage space can be fully utilized, and the space utilization rate of the metadata storage space can be improved.
[0326] In another embodiment, the process of updating the metadata block of each file in the metadata storage space includes but is not limited to the following steps:
[0327] In response to a data segmentation request for a target metadata block in a plurality of metadata blocks, the target metadata in the target metadata block is segmented, and the correspondence between the segmented target metadata and the candidate data segment is updated.
[0328] The data segmentation request is a request generated when the metadata of a certain file in the metadata storage space is to be segmented into smaller blocks.
[0329] The segmented target metadata is used to indicate the result of data segmentation of the target metadata. The segmented target metadata can be regarded as a component of the target metadata.
[0330] The correspondence relationship is used to indicate how the one-to-one correspondence relationship between each metadata in the metadata storage space and each data segment in the entity data storage space is after the data segmentation.
[0331] In the implementation of this embodiment, when the object wants to segment the metadata of a metadata block of a target file in the metadata storage space into smaller pieces, the object initiates a data segmentation request for the target metadata block in the plurality of metadata blocks. Based on this, the server first determines which metadata block is to be segmented according to the data segmentation request, and takes the metadata block to be segmented as the target metadata block. Then, the target metadata in the target metadata block is segmented according to the segmentation requirement of the data segmentation request, at least two segmented target metadata are obtained, and the correspondence relationship between the original target metadata and the candidate data segment is updated to that at least two segmented target metadata correspond to the same candidate data segment.
[0332] As shown in FIG. 24B, in the metadata storage space, file A corresponds to four metadata, and the four metadata are stored in different metadata blocks. Among them, the 4M metadata 2 stored in the metadata block 2 corresponds to the data segment 2 in the entity data storage space, and the 4M metadata 3 stored in the metadata block 3 corresponds to the data segment 3 in the entity data storage space. Based on this, when the metadata of the metadata block 2 and the metadata block 3 is to be segmented, the 4M metadata in the metadata block 2 is equally divided into two 2M segmented metadata, and the 4M metadata in the metadata block 3 is equally divided into two 2M segmented metadata. At this time, the metadata corresponding to file A in the metadata storage space changes from 4 to 6, but the data segment corresponding to file A in the entity data storage space is still 4. Further, the correspondence relationship between the metadata and the data segment is updated, so that the data segment 2 originally corresponding to one metadata 2 becomes corresponding to two 2M segmented metadata (segmented result of metadata 2), and the data segment 3 originally corresponding to one metadata 2 becomes corresponding to two 2M segmented metadata (segmented result of metadata 3).
[0333] The advantage of this embodiment is that the metadata of each metadata block in the metadata storage space can be freely segmented, and the target metadata with a large data volume can be segmented into a plurality of segmented target metadata with a relatively small data volume. This way can divide the file metadata of the target file into a more fine-grained manner. At the same time, after the segmentation is completed, the correspondence relationship between the segmented target metadata and the candidate data segment is also updated, which can improve the accuracy of data mapping.
[0334] The implementation details of the storage type changing method of one embodiment of the present disclosure are described below.
[0335] As shown in FIG. 25, it is an asynchronous processing procedure of hitting the target storage type changing rule. Specifically, first, the storage type changing procedure is executed in an asynchronous transmission manner, when the target storage type changing rule pointing to the target file is matched, if the trigger condition of the target storage type changing rule is reached, the storage type changing stage data is set to be changed in the server backend, and the storage type changing stage data seen by the user in the front end is set to be changed. Then, the file type of the target file is judged. When the target file is a standard file or a partition file, the target file node is hit in the target tree, and the data segment corresponding to the target file node is allocated a changing indication (i.e. labeled), wherein the changing indication specifically includes determining the target file node, determining the corresponding metadata block, labeling the data segment corresponding to the metadata block, and the like. Further, after all the data segments corresponding to all the target file nodes are allocated the changing indication, the storage type changing stage data is set to be changed, and the specific process is similar to the above steps 310-320. In addition, when the target file is an MPU file, the target file node is hit in the target tree, and the partition file corresponding to the MPU file is determined, the file node corresponding to each partition file is obtained, the storage type changing stage data of each partition file is set to be changed, and the changing indication is allocated to the data segment of each partition file. After all the data segments corresponding to a single partition file are allocated the changing indication, the storage type changing stage data of the partition file is set to be changed, and after the storage type changing stage data of all the partition files is set to be changed, the storage type changing stage data of the MPU file is set to be changed, and the specific process is similar to the above steps 1510-1570. For the sake of brevity, no longer tedious.
[0336] As shown in FIG. 26, it is a specific process of assigning change indication to each data segment by means of asynchronous processing. Specifically, when the storage type change stage data is changed from to be changed to being changed, the storage type change stage data seen by the user has been changed to changed, but the backend of the server is executed asynchronously, when the storage type change stage data is set to to be changed, the target file is queried in the data segment corresponding to the file node corresponding to the target tree, and each data segment in the entity data storage space is marked. Specifically, first, the file type of the target file is judged, when the target file is a standard file or a partition file, the data segment corresponding to the target file node is assigned a change indication, and it is detected whether all data segments corresponding to the target file node are assigned a change indication, and all data segments corresponding to the target file node are assigned a change indication. Then, when all data segments are marked, the storage type change stage data is changed to being changed. In addition, when the target file is an MPU file, the storage type change stage data of the MPU file needs to be converted from to be changed to being changed, at this time, the storage type change of each partition file in the MPU file is carried out respectively, when all partition files are changed, the storage type change stage data is changed to changed; if part of the partition file is not changed, all nodes corresponding to the MPU file are marked, and the specific process is similar to steps 310-320 and steps 1510-1570 described above. For the sake of brevity, no longer tedious.
[0337] The apparatus and device of the embodiments of the present disclosure are described below.
[0338] It can be understood that although each step in each flowchart described above is displayed in sequence according to the arrow representation, these steps are not necessarily executed in sequence according to the arrow representation. Unless otherwise specified in the embodiments, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, at least part of the steps in the flowchart described above can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or steps or stages in other steps.
[0339] It should be noted that in various specific embodiments of the present application, when relevant processing needs to be performed on data related to the characteristics of the target object, such as target object attribute information or attribute information set, the permission or consent of the target object is obtained first, and the collection, use and processing of the data comply with relevant laws, regulations and standards. In addition, when the embodiments of the present application need to obtain target object attribute information, the separate permission or separate consent of the target object is obtained through a pop-up window or by jumping to a confirmation page, and after obtaining the separate permission or separate consent of the target object, the necessary target object related data for enabling the embodiments of the present application to normally run is obtained.
[0340] FIG. 27 is a structural schematic diagram of a storage type changing device 2700 provided by an embodiment of the present disclosure. The storage type changing device 2700 comprises:
[0341] A setting unit 2710 is configured to, in response to a storage type changing request for a target file in an entity data storage space, set storage type changing stage data of the target file as to be changed in a metadata storage space corresponding to the entity data storage space, wherein the target file is stored in the entity data storage space in a plurality of data segments;
[0342] A first changing unit 2720 is configured to allocate a changing indication for each data segment, and set the storage type changing stage data of the target file as being changed in the metadata storage space, wherein the changing indication is used to indicate changing the storage type of the data segment according to the storage type changing request;
[0343] A second changing unit 2730 is configured to perform a storage type changing operation corresponding to the changing indication for each data segment, and set the storage type changing stage data of the target file as having been changed in the metadata storage space after the storage type changing operation is performed for all the data segments.
[0344] Optionally, the data segment comprises a storage type field;
[0345] The second changing unit 2730 is configured to:
[0346] set the storage type field of the data segment as a target storage type after the storage type changing operation is performed for the single data segment, wherein the target storage type is the changed storage type indicated by the storage type changing request;
[0347] set the storage type changing stage data of the target file as having been changed in the metadata storage space after the storage type field of each of the plurality of data segments is set as the target storage type.
[0348] Optionally, the metadata storage space comprises a target tree, each file in the entity data storage space corresponds to a file node in the target tree.
[0349] The setting unit 2710 is configured to:
[0350] In the target tree of the metadata storage space, determine a target file node corresponding to a target file;
[0351] Set the storage type change stage data in the target file node to be changed.
[0352] Optionally, the target tree is generated by:
[0353] Obtain a file storage architecture in which a target file in the entity data storage space is located;
[0354] Take the file storage architecture as a root node of the target tree, take a folder in the file storage architecture as a branch node of the target tree, and take each file in the folder as a leaf node under the branch node.
[0355] Optionally, the storage type change request is generated by:
[0356] Obtain a plurality of candidate storage type change rules for a file storage architecture in which a target file in the entity data storage space is located;
[0357] For each candidate storage type change rule, determine a file path pointed to by the candidate storage type change rule in the target tree;
[0358] Based on lengths of the file paths respectively pointed to by the plurality of candidate storage type change rules, determine a target storage type change rule in the plurality of candidate storage type change rules;
[0359] If it is determined that a trigger condition of the target storage type change rule is reached, generate the storage type change request, wherein a target file node corresponding to the target file belongs to a file path pointed to by the target storage type change rule.
[0360] Optionally, the candidate storage type change rule is generated by:
[0361] In response to a rule configuration request for the file storage architecture, obtain a rule trigger time and storage type change information;
[0362] Determine a rule-associated file in each file included in the file storage architecture, and generate a file path based on a position of a leaf node corresponding to the rule-associated file in the target tree;
[0363] Based on a preset storage type conversion rule, perform first verification on the storage type change information;
[0364] If it is determined that the storage type change information passes the first verification, a candidate storage type change rule is generated based on a rule triggering time, the storage type change information, and a file path.
[0365] Optionally, the first changing unit 2720 is configured to:
[0366] In the target tree, a plurality of metadata blocks corresponding to the target file node are obtained, wherein the metadata blocks contain at least one target metadata.
[0367] A preset mapping table is obtained, wherein the preset mapping table includes a plurality of candidate data segments in the entity data storage space and candidate metadata corresponding to the plurality of candidate data segments in the metadata storage space.
[0368] For each metadata block, the target metadata contained therein is compared with each candidate metadata in the preset mapping table.
[0369] The candidate data segment corresponding to the candidate metadata consistent with the target metadata is determined as a target data segment, wherein the target data segment is a data segment into which the target file is divided.
[0370] Based on the changed storage type indicated by the storage type change request, a change indication is generated, and the change indication is allocated to each target data segment.
[0371] Optionally, the plurality of candidate data segments in the entity data storage space are generated by the following method:
[0372] A plurality of candidate file storage architectures are obtained.
[0373] For a candidate file in each candidate file storage architecture, the candidate file is divided according to a predetermined size to obtain a plurality of file data blocks.
[0374] One file data block is taken as one candidate data segment, and the plurality of candidate data segments are stored in a preset storage bucket of the entity data storage space.
[0375] Optionally, the storage type changing apparatus 2700 further includes a calling unit (not shown), which is configured to:
[0376] A data acquisition request for the metadata storage space is obtained.
[0377] The data acquisition request is protocol-converted based on a preset protocol conversion interface to obtain a converted acquisition request.
[0378] Based on the converted acquisition request, metadata in the metadata storage space is called through a preset data access interface.
[0379] Optionally, the target tree is stored in a target sub-storage space of the metadata storage space.
[0380] The storage type changing apparatus 2700 further comprises an obtaining unit (not shown), configured to:
[0381] obtain an architecture index of the file storage architecture in response to a metadata access request for the file storage architecture where the target file is located;
[0382] based on the architecture index, perform data query through a preset data management interface to obtain a storage location of the target tree in the target sub-storage space;
[0383] based on the storage location, call the target tree through a preset data access interface to obtain file metadata in the target tree.
[0384] Optionally, the first changing unit 2720 is configured to:
[0385] if the type of the target file is a first type, obtain, in the target tree, a plurality of file child nodes under a target file node, wherein the first type is used to indicate that the target file comprises a plurality of partition files, and the plurality of partition files respectively have corresponding file child nodes in the target tree;
[0386] for each file child node, obtain, in the target tree, a plurality of metadata blocks of the file child node, wherein the metadata blocks contain at least one target metadata;
[0387] obtain a preset mapping table, wherein the preset mapping table comprises a plurality of candidate data segments in the entity data storage space and respective candidate metadata of the plurality of candidate data segments in the metadata storage space;
[0388] for each metadata block, compare the target metadata contained therein with each candidate metadata in the preset mapping table;
[0389] determine a candidate data segment corresponding to the candidate metadata consistent with the target metadata as an intermediate data segment, wherein the intermediate data segment is a data segment obtained by cutting a partition file;
[0390] integrate the plurality of intermediate data segments into a target data segment, wherein the target data segment is a data segment obtained by cutting the target file;
[0391] based on the changed storage type indicated by the storage type changing request, generate a change indication, and assign the change indication to each target data segment.
[0392] Optionally, the second changing unit 2730 is configured to:
[0393] after performing the storage type changing operation on each data segment of a single partition file, set, in the metadata storage space, storage type changing stage data of the partition file as changed.
[0394] After the data of the storage type change stage of the plurality of partition files is all changed, the storage type change stage data of the target file is set as changed in the metadata storage space.
[0395] Optionally, the storage type changing apparatus 2700 further comprises a display unit (not shown), and the display unit (not shown) is configured to:
[0396] In response to the state acquisition request for the storage type change stage data of the target file, the state of the storage type change stage data is displayed as changed.
[0397] Optionally, the plurality of metadata blocks corresponding to the target file node are updated in the following manner:
[0398] For each metadata block, data detection is performed on the metadata block.
[0399] If it is determined that the target metadata of the metadata block does not reach the preset number, a preset data appending interface is called, and the metadata corresponding to the preset supplement data is supplemented into the metadata block, so as to update the metadata of the metadata block.
[0400] Optionally, the plurality of metadata blocks corresponding to the target file node are updated in the following manner:
[0401] In response to a data segmentation request for target metadata in the plurality of metadata blocks, data segmentation is performed on the target metadata in the target metadata block, and the correspondence between the segmented target metadata and the candidate data segment is updated.
[0402] Referring to FIG. 28, FIG. 28 is a structural block diagram of part of a terminal implementing the storage type changing method of the embodiment of the present disclosure, which includes a radio frequency (RF) circuit 2810, a memory 2815, an input unit 2830, a display unit 2840, a sensor 2850, an audio circuit 2860, a wireless fidelity (WiFi) module 2870, a processor 2880, and a power supply 2890, and the like. Those skilled in the art can understand that the structure of the terminal shown in FIG. 28 does not constitute a limitation on the mobile phone or computer, and can include more or fewer components than those shown, or combine some components, or different component arrangements.
[0403] The RF circuit 2810 can be used for receiving and sending signals in the process of information or call, especially, receiving the downlink information of the base station and processing by the processor 2880; in addition, sending the uplink data to the base station.
[0404] The memory 2815 can be used to store software programs and modules, and the processor 2880 can execute various function applications and data processing of the object terminal by running the software programs and modules stored in the memory 2815.
[0405] The input unit 2830 can be used to receive inputted digital or character information, and to generate key signal input related to the setting and function control of the object terminal. Specifically, the input unit 2830 can include a touch panel 2231 and other input devices 2832.
[0406] The display unit 2840 can be used to display inputted information or provided information and various menus of the object terminal. The display unit 2840 can include a display panel 2841.
[0407] The audio circuit 2860, the speaker 2861, and the microphone 2862 can provide an audio interface.
[0408] In the embodiment, the processor 2880 included in the terminal can execute the storage type changing method of the foregoing embodiments.
[0409] The terminal of the embodiments of the present disclosure includes but is not limited to a mobile phone, a computer, a smart voice interactive device, a smart home appliance, a vehicle-mounted terminal, an aircraft, etc. The embodiments of the present disclosure can be applied to various scenarios, including but not limited to data security, blockchain, data storage, information technology, etc.
[0410] FIG. 29 is a structural block diagram of a part of a server implementing the storage type changing method of the embodiments of the present disclosure. The server can have a large difference due to different configurations or performances, and can include one or more central processing units (CPUs) 2922 (for example, one or more processors) and a memory 2932, one or more storage media 2930 (for example, one or more mass storage devices) storing application programs 2942 or data 2944. Among them, the memory 2932 and the storage media 2930 can be temporary storage or persistent storage. The programs stored in the storage media 2930 can include one or more modules (not shown in the figure), and each module can include a series of instruction operations in the server. Further, the central processing unit 2922 can be configured to communicate with the storage media 2930 and execute the series of instruction operations in the storage media 2930 on the server.
[0411] The server can also include one or more power supplies 2923, one or more wired or wireless network interfaces 2950, one or more input and output interfaces 2958, and / or one or more operating systems 2941, such as Windows Server TMMac OS X TM Unix TM Linux TM FreeBSD TM and so on.
[0412] The central processing unit 2922 in the server can be used to execute the storage type changing method of the embodiments of the present disclosure.
[0413] The embodiments of the present disclosure also provide a computer readable storage medium for storing program codes, the program codes being used to execute the storage type changing method of the various embodiments.
[0414] The embodiments of the present disclosure also provide a computer program product, which comprises a computer program. The processor of the computer device reads and executes the computer program, so that the computer device executes the storage type changing method as described above.
[0415] The above is a specific description of the embodiments of the present disclosure, but the present disclosure is not limited to the above-mentioned embodiments. Those skilled in the art can make various equivalent modifications or replacements without departing from the spirit of the present disclosure, and these equivalent modifications or replacements are all included in the scope defined by the claims of the present disclosure.
Claims
1. A storage type changing method, executed by an electronic device, the method comprising: in response to a storage type changing request for a target file in an entity data storage space, setting storage type changing stage data of the target file to be changed in a metadata storage space corresponding to the entity data storage space, wherein the target file is stored in the entity data storage space in a plurality of data segments; allocating a changing indication for each of the data segments, and setting the storage type changing stage data of the target file to be changed in the metadata storage space, the changing indication indicating that the storage type of the data segment is to be changed according to the storage type changing request; performing a storage type changing operation corresponding to the changing indication for each of the data segments, and setting the storage type changing stage data of the target file to have been changed in the metadata storage space after the storage type changing operation is performed for each of the plurality of data segments.
2. The method of claim 1, wherein, the data segment comprises a storage type field; the setting of the storage type changing stage data of the target file to have been changed in the metadata storage space after the storage type changing operation is performed for each of the plurality of data segments comprises: setting the storage type field of the data segment to a target storage type after the storage type changing operation is performed for the data segment, wherein the target storage type is a changed storage type indicated by the storage type changing request; setting the storage type changing stage data of the target file to have been changed in the metadata storage space after the storage type field of each of the plurality of data segments is set to the target storage type.
3. The method of claim 1 or 2, wherein, the metadata storage space comprises a target tree, and each file in the entity data storage space corresponds to a file node in the target tree; the setting of the storage type changing stage data of the target file to be changed in the metadata storage space corresponding to the entity data storage space comprises: determining a target file node corresponding to the target file in the target tree of the metadata storage space; setting the storage type changing stage data in the target file node to be changed.
4. The method of claim 3, wherein, the target tree is generated by: obtaining a file storage architecture in which the target file in the entity data storage space is located; taking the file storage architecture as a root node of the target tree, taking a folder in the file storage architecture as a branch node of the target tree, and taking each file in the folder as a leaf node under the branch node.
5. The method of claim 3 or 4, wherein, the storage type changing request is generated by: obtaining a plurality of candidate storage type changing rules for a file storage architecture in which the target file in the entity data storage space is located; for each of the candidate storage type changing rules, determining a file path pointed to by the candidate storage type changing rule in the target tree; determining a target storage type change rule from the plurality of candidate storage type change rules based on lengths of file paths pointed to by the plurality of candidate storage type change rules respectively; generating the storage type change request if it is determined that a trigger condition of the target storage type change rule is reached, wherein the target file node to which the target file corresponds belongs to a file path pointed to by the target storage type change rule.
6. The method of claim 5, wherein, The candidate storage type change rule is generated by: obtaining a rule trigger time and storage type change information in response to a rule configuration request for the file storage architecture; determining a rule associated file in each file of the file storage architecture, and generating a file path based on a position of a leaf node corresponding to the rule associated file in the target tree; performing a first verification on the storage type change information based on a preset storage type conversion rule; generating the candidate storage type change rule based on the rule trigger time, the storage type change information, and the file path if it is determined that the storage type change information passes the first verification.
7. The method according to any one of claims 3 to 6, wherein, The allocation of the change indication to each of the data segments includes: obtaining a plurality of metadata blocks corresponding to the target file node in the target tree, wherein the metadata blocks contain at least one target metadata; obtaining a preset mapping table, wherein the preset mapping table includes a plurality of candidate data segments in the entity data storage space and candidate metadata corresponding to the plurality of candidate data segments in the metadata storage space respectively; comparing the target metadata contained in each of the metadata blocks with each of the candidate metadata in the preset mapping table; determining a candidate data segment corresponding to the candidate metadata consistent with the target metadata as a target data segment, wherein the target data segment is the data segment into which the target file is divided; generating a change indication based on a changed storage type indicated by the storage type change request, and allocating the change indication to each of the target data segments.
8. The method of claim 7, wherein, The plurality of candidate data segments in the entity data storage space are generated by: obtaining a plurality of candidate file storage architectures; dividing a candidate file in each of the candidate file storage architectures into a plurality of file data blocks according to a predetermined size; storing one of the file data blocks as one of the candidate data segments into a preset storage bucket of the entity data storage space.
9. The method of claim 8, wherein, After storing the plurality of candidate data segments into the preset storage bucket of the entity data storage space, the storage type change method further includes: obtaining a data obtaining request for the metadata storage space; performing protocol conversion on the data obtaining request based on a preset protocol conversion interface to obtain a converted obtaining request; calling metadata in the metadata storage space through a preset data access interface based on the converted obtaining request.
10. The method of claim 8 or 9, wherein, The target tree is stored in a target sub-storage space of the metadata storage space. After storing the plurality of candidate data segments into the preset storage bucket of the entity data storage space, the storage type changing method further comprises: In response to a metadata access request for a file storage architecture in which the target file is located, obtaining an architecture index of the file storage architecture; Based on the architecture index, performing data query through a preset data management interface to obtain a storage location of the target tree in the target sub-storage space; Based on the storage location, calling the target tree through a preset data access interface to obtain file metadata in the target tree.
11. The method according to any one of claims 3 to 6, wherein, The allocation of the change indication to each data segment comprises: If the type of the target file is a first type, obtaining a plurality of file child nodes under the target file node in the target tree, wherein the first type is used to indicate that the target file comprises a plurality of partition files, and the plurality of partition files each have a corresponding file child node in the target tree; For each file child node, obtaining a plurality of metadata blocks of the file child node in the target tree, wherein the metadata blocks contain at least one target metadata; Obtaining a preset mapping table, wherein the preset mapping table comprises a plurality of candidate data segments in the entity data storage space and corresponding candidate metadata of the plurality of candidate data segments in the metadata storage space; For each metadata block, comparing the target metadata contained therein with each candidate metadata in the preset mapping table; Determining the candidate data segment corresponding to the candidate metadata consistent with the target metadata as an intermediate data segment, wherein the intermediate data segment is a data segment obtained by cutting the partition file; Integrating a plurality of intermediate data segments into a target data segment, wherein the target data segment is the data segment obtained by cutting the target file; Based on the changed storage type indicated by the storage type change request, generating a change indication and allocating the change indication to each target data segment.
12. The method of claim 11, wherein, After the storage type changing operation is performed on each of the plurality of data segments, setting the storage type change stage data of the target file as changed in the metadata storage space, comprising: After the storage type changing operation is performed on each data segment of a single partition file, setting the storage type change stage data of the partition file as changed in the metadata storage space; After the storage type change stage data of the plurality of partition files are all changed, setting the storage type change stage data of the target file as changed in the metadata storage space.
13. The method according to any one of claims 1 to 12, wherein, After setting the storage type change stage data of the target file as to be changed, the storage type changing method further comprises: In response to a state obtaining request for the storage type change stage data of the target file, displaying the state of the storage type change stage data as changed.
14. A storage type conversion device, wherein, The apparatus comprises: The setting unit is configured to, in response to a storage type change request for a target file in an entity data storage space, set storage type change stage data of the target file as to be changed in a metadata storage space corresponding to the entity data storage space, wherein the target file is stored in the entity data storage space in a plurality of data segments; The first changing unit is configured to assign a changing indication to each of the data segments, and set the storage type change stage data of the target file as being changed in the metadata storage space, wherein the changing indication is used to indicate that the storage type of the data segment is changed according to the storage type change request; The second changing unit is configured to perform a storage type change operation corresponding to the changing indication for each of the data segments, and set the storage type change stage data of the target file as having been changed in the metadata storage space after the storage type change operation is performed for all of the plurality of data segments.
15. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein, The processor executes the computer program to implement the storage type change method in any one of claims 1 to 13.
16. A computer readable storage medium storing a computer program, wherein, The computer program is executed by the processor to implement the storage type change method in any one of claims 1 to 13.
17. A computer program product, comprising a computer program, which is read and executed by a processor of an electronic device, so that the electronic device performs the storage type change method in any one of claims 1 to 13.
Citation Information
Patent Citations
Map tile updating method and device and computer-readable storage medium
CN109002452A
Hard disk migration method, distributed storage cluster system and storage medium
CN111880751A
Data migration method and related device
CN117234412A
Electronic document management and control method and device, computer equipment and storage medium
CN118193813A
Storage type changing method, related device and medium
CN118760657A