Method of processing data and distributed storage system
By adding type markers to erasure coding-encoded data blocks and checksum blocks, and combining file status and read/write patterns, the recovery strategy is optimized, solving the problem of inflexible recovery operations in erasure coding technology and improving the performance and resource utilization of the storage system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-19
- Publication Date
- 2026-03-24
AI Technical Summary
The data recovery operation of existing erasure coding technology lacks flexibility, leading to a decline in storage system performance.
After erasure coding, a type tag is added to each data block and check block, and the recovery operation is triggered first or delayed based on the type tag. The recovery strategy is optimized by combining file status, read and write mode and recovery priority.
It enhances the flexibility of recovery operations and the performance of the storage system, improves resource utilization, and adapts to data recovery needs in different scenarios.
Smart Images

Figure CN121144114B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data recovery, in particular to a data processing method and a distributed storage system. BACKGROUND
[0002] In a related storage system, an erasure code (EC) technology is usually used for data slice writing. After data slice damage, a data recovery operation is triggered immediately to recover the damaged or missing data slice through encoding principles (such as EC calculation).
[0003] Therefore, the recovery operation in the related technology lacks flexibility and reduces the performance of the storage system. SUMMARY
[0004] The present application provides a data processing method and a distributed storage system, which can improve the flexibility of the recovery operation.
[0005] To solve the above technical problems, one technical solution adopted by the present application is to provide a data processing method, which comprises: obtaining a file state of a target file; wherein the target file is encoded by an erasure code, has N data blocks and M check blocks, and each data block and each check block has a type mark; N and M are positive integers; in response to the file state being an abnormal state, obtaining a type mark of an abnormal block corresponding to the target file; the type mark is used to represent a data block type or a check block type; and according to the type mark, a recovery operation is triggered preferentially or is triggered with a delay; wherein the recovery operation is used to recover data of the abnormal block.
[0006] According to the type mark, the recovery operation is triggered preferentially or is triggered with a delay, which comprises: in response to the type mark representing the data block type, the recovery operation is triggered preferentially; and in response to the type mark representing the check block type, the recovery operation is triggered with a delay.
[0007] In response to the file state being the abnormal state, the type mark of the abnormal block corresponding to the target file is obtained, which comprises: in response to the file state being the abnormal state, a read-write mode of the target file is obtained; and in response to the read-write mode being a first read-write mode, the type mark of the abnormal block corresponding to the target file is obtained; wherein the first read-write mode indicates that the number of read operations of the target file within a preset period is greater than the number of write operations.
[0008] According to the type mark, the recovery operation is triggered preferentially or is triggered with a delay, which comprises: obtaining a read-write mode of the target file; and according to the type mark and the read-write mode, the recovery operation is triggered preferentially or is triggered with a delay.
[0009] The priority trigger recovery operation or the delayed trigger recovery operation is triggered according to the type mark and the read-write mode, including: in response to the type mark indicating a data block type and the read-write mode being a first read-write mode, the priority trigger recovery operation is triggered; wherein the first read-write mode indicates that the number of read times of the target file is greater than the number of write times in a preset period; in response to the type mark indicating a check block type and the read-write mode being a second read-write mode, the delayed trigger recovery operation is triggered; wherein the second read-write mode indicates that the number of read times of the target file is less than or equal to the number of write times in a preset period.
[0010] Before obtaining the type mark of the abnormal block corresponding to the target file, the method further comprises: in response to the file state being an abnormal state, determining whether the target file meets at least one of a plurality of recovery priority conditions; wherein the recovery priority includes a time priority, a file damage degree priority and a device priority; if yes, triggering the recovery operation; if no, obtaining the type mark of the abnormal block corresponding to the target file.
[0011] The method further comprises: obtaining the creation duration of the target file; and determining that the target file meets the time priority condition when the creation duration meets a first preset condition.
[0012] The method further comprises: obtaining the number of abnormal blocks; and determining that the target file meets the file damage degree priority condition when the number is greater than or equal to M.
[0013] The method further comprises: obtaining the file collection device corresponding to the target file; and determining that the target file meets the device priority condition when the device priority of the file collection device is greater than a preset level.
[0014] The method is applied to a distributed storage system, the distributed storage system comprising a management node and a plurality of storage nodes; N data blocks and M check blocks are stored in different storage nodes, and the management node stores the metadata of the target file; the metadata comprises the storage locations and types of the N data blocks and the M check blocks; the method further comprises: the management node receives first data information and updates the file state corresponding to the first data information; wherein the first data information is generated when data abnormality occurs in reading the target file;
[0015] And / or, the management node receives second data information sent by each storage node and updates the file state corresponding to the second data information; wherein the second data information is generated when abnormal blocks are found in the comparison between the periodic scanning of all data blocks and check blocks on the storage node and the check data recorded by the storage node;
[0016] And / or, the management node receives third data information sent by each storage node, and updates a file state corresponding to the third data information; wherein the third data information is generated by each storage node according to the data change information when detecting that the storage device corresponding to the storage node changes;
[0017] And / or, the management node delays recovering data in the target storage node when detecting that the target storage node is offline.
[0018] To solve the above technical problems, one technical solution adopted by the present application is to provide a distributed storage system, comprising: a plurality of storage nodes; a management node, which uses the processing method provided in the above technical solution to process data of each storage node.
[0019] Among them, the file stored in the storage node includes a video file.
[0020] The data processing method and the distributed storage system provided by the present application, when storing a target file, encode the target file by using an erasure code, and mark the type of each data block and each check block after encoding, so as to obtain the type mark of the abnormal block corresponding to the target file when the file state is abnormal. Then, according to the type mark, it is determined whether to trigger the recovery operation preferentially or to delay the triggering of the recovery operation; wherein the recovery operation is used to recover the data of the abnormal block, so as to improve the flexibility of the recovery operation and the performance of the storage system without triggering the data recovery operation immediately every time the file state is abnormal, thereby improving the resource utilization of the entire distributed storage system. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor. Among them:
[0022] Figure 1 is a flowchart of an embodiment of the data processing method provided by the present application;
[0023] Figure 2 is a flowchart of another embodiment of the data processing method provided by the present application;
[0024] Figure 3 is a flowchart of another embodiment of the data processing method provided by the present application;
[0025] Figure 4 is a flowchart of another embodiment of the data processing method provided by the present application;
[0026] Figure 5 is a flowchart of an embodiment of the application for judging time priority;
[0027] Figure 6 is a flowchart of an embodiment of the application for judging file damage degree priority;
[0028] Figure 7 is a flowchart of an embodiment of the application for judging device priority;
[0029] Figure 8 is a structural diagram of an embodiment of the distributed storage system provided by the application. DETAILED DESCRIPTION
[0030] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. It can be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application. In addition, it should be noted that, for the convenience of description, only the parts related to the present application are shown in the drawings, but not all the structures. Based on the embodiments in the present application, all the other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0031] In this document, reference to“an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase“in an embodiment” in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive of one another. Those skilled in the art will understand that the embodiments described herein can be combined with other embodiments.
[0032] In the related storage system, the data slice is usually written by using the erasure code (EC) technology. After the data slice is damaged, the data recovery operation is triggered immediately, and the damaged or missing data slice is recovered by using the encoding principle (such as EC calculation).
[0033] Therefore, the recovery operation in the related technology lacks flexibility, and the performance of the storage system is easily reduced.
[0034] Based on this, the application proposes that when storing a target file, the target file is encoded by erasure coding, and each data block and each check block after encoding is marked with a type, so as to obtain the type mark of the abnormal block corresponding to the target file when the file state is abnormal; then, according to the type mark, it is determined whether to preferentially trigger a recovery operation or to delay triggering the recovery operation; wherein the recovery operation is used to recover the data of the abnormal block, so that the data recovery operation does not need to be triggered immediately every time the file state is abnormal, the flexibility of the recovery operation is improved, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system. For details, refer to any of the following embodiments.
[0035] Reference Figure 1 , Figure 1 is a flowchart of an embodiment of the data processing method provided by the application. The processing method comprises:
[0036] Step 11: obtaining the file state of the target file.
[0037] In some embodiments, the target file is encoded by erasure coding (Erasure Coding, EC) and has N data blocks and M check blocks, and each data block and each check block has a type mark; N and M are positive integers. In some embodiments, the erasure coding can be one of RS type erasure coding, concatenated low-density erasure coding, digital fountain code, array erasure coding, LDPC code, etc. Each of the N data blocks and the M check blocks represents a data slice.
[0038] In related technologies, after encoding a file by erasure coding to obtain N data blocks and M check blocks, only data storage is performed in the form of blocks, but the data is not marked with a type. In related technologies, when any block of data is abnormal, data recovery needs to be performed immediately using the remaining data, so it is unnecessary to mark the blocks with a type in related technologies.
[0039] In some embodiments, when writing the target file, the target file is first divided into file objects Object (determined according to the EC mode, such as 4+1, and the Object size is 4*256MB) according to a fixed size, wherein the Object size does not include EC redundant data. The Object is divided into a plurality of target blocks (block, default 256MB, size configurable) of a fixed size according to different EC modes. Then each target block is marked with a type (such as marking the data block type and the check block type), the type is marked when space is applied, and the health status of target blocks of different types is maintained through various periodic reports and error perception reports in the process.
[0040] In some embodiments, the data processing method of the present application can be applied in a distributed storage system, and can also be applied in a centralized storage system.
[0041] In some embodiments, the data processing method of the present application can be applied in any technical field using erasure code technology.
[0042] Step 12: In response to the file state being an abnormal state, obtaining the type tag of the abnormal block corresponding to the target file; the type tag is used to represent the data block type or the check block type.
[0043] In some embodiments, in a common erasure code technology-based storage system, the original data is first divided into fixed-size data blocks. Then, according to the EC erasure code principle, the data blocks are divided into N data slices, and M check data is calculated through the N+M algorithm, and finally the N+M data is stored in different hard disks of different storage nodes; at this time, for the original data block, up to M slices can be damaged and the original data can still be recovered.
[0044] When a data block slice is damaged, the state of the corresponding file will change. Assuming that the abnormal data block slice is K, the different file states are as follows:
[0045] K = 0: The file is in a normal state, and all data block slices are complete.
[0046] 0<K<=M: At this time, the file is in a recoverable state (reliability degradation state).
[0047] M<K<=N+M: The file is in a damaged state (reliability degradation state, super damage).
[0048] In order to avoid the reliability of the data being reduced, the distributed storage system generally performs data recovery action on the data in the recovery state, and recovers the damaged data block slice through the EC erasure code algorithm.
[0049] Under normal circumstances, all data block slice data is normal, and the file reading process is to directly read N data blocks and return, without reading the check block. The file reading process of the recoverable state can be divided into two types according to the type of the damaged data block: the data block does not occur abnormally, at this time, all data blocks can be directly read, combined to obtain the original data and returned; when the data block occurs abnormally, the EC data recovery operation needs to be performed depending on the erasure code algorithm at this time, which will consume CPU computing resources, and the recovery is completed and returned.
[0050] Whether the data block damage needs to trigger data reconstruction recovery immediately in the erasure code mode can be flexibly controlled by the storage system in combination with the business strategy and type. In the related technology, the distributed storage system triggers recovery after the abnormal block damage, without distinguishing the type of abnormal block. Based on this, the present application responds to the file state being in the abnormal state, acquires the type mark of the abnormal block corresponding to the target file, and uses the type mark to realize the management of the block type by the storage system, so as to realize the flexible data recovery in different scenarios.
[0051] In some embodiments, the target block that appears abnormal is defined as an abnormal block.
[0052] Since the target block is type marked when storing the target file, when the target block is abnormal, the type mark of the abnormal block can be directly acquired. For example, the data block type or the check block type.
[0053] In some embodiments, the number of abnormal blocks can be multiple, and the type mark of each abnormal block can be acquired.
[0054] Step 13: According to the type mark, a recovery operation is preferentially triggered or a recovery operation is delayed to trigger; wherein the recovery operation is used to recover the data of the abnormal block.
[0055] In some embodiments, in response to the type mark indicating the data block type, the recovery operation is preferentially triggered to recover the data of the abnormal block.
[0056] When the type mark indicates the data block type, it means that the abnormal block is at least one of the N data blocks. Since the data block is abnormal, the complete data cannot be read out subsequently. Based on this, the recovery operation is preferentially triggered to recover the data of the abnormal block. For example, it can be recovered immediately. If the abnormal block recovery needs to be performed on multiple target files, the abnormal block is recovered according to the priority.
[0057] In some embodiments, in response to the type mark indicating the check block type, the recovery operation is delayed to trigger to recover the data of the abnormal block.
[0058] When the type mark indicates the check block type, it means that the abnormal block is at least one of the M check blocks. Since the check block is abnormal, it does not affect the data integrity of the data block. Based on this, the recovery operation is delayed to trigger to recover the data of the abnormal block. For example, the recovery of the check block is performed in the system business valley period.
[0059] In some embodiments, the exception can be divided into two types: data block damage, check block damage. When maintaining the list of files to be recovered, it is divided into two queues: data block damage file queue, check block damage file queue. For files with only check block damage, there is no need to trigger data recovery operation immediately, and recovery reconstruction operation can be performed according to the type of business to select the appropriate opportunity, such as in the business trough period, reduce the impact of data recovery resource overhead on real-time business, and improve system utilization, that is, when the type mark is only check block type, the abnormal block can be delayed to recover. However, for data block damaged files, because the original file data cannot be composed by directly reading the data block slice, in the read more write less business scenario, data reconstruction recovery needs to be triggered immediately to avoid degradation reading when reading and improve data reading efficiency. That is, when the type mark indicates the data block type, the abnormal block needs to be recovered first, and then the recovery operation is triggered.
[0060] In some embodiments, when the number of abnormal blocks is multiple, multiple type marks can be obtained, and when the type mark is only check block type, the recovery operation can be delayed to recover the data of the abnormal block. When the type mark has data block type, the recovery operation can be triggered preferentially to recover the data of the abnormal block.
[0061] In some embodiments, the above technical solution can be applied in the file reading process, or can be applied in the non-file reading process.
[0062] In this embodiment, when storing the target file, the erasure coding is encoded, and each data block and each check block after encoding is marked with a type mark, so that when the file state is abnormal, the type mark of the abnormal block corresponding to the target file is obtained. Then, according to the type mark, it is decided whether to trigger the recovery operation preferentially to recover the abnormal block or to delay the trigger of the recovery operation to recover the abnormal block. In this way, it is not necessary to trigger the data recovery operation immediately every time the file state is abnormal, the flexibility of the recovery operation is improved, the damaged files of different data block types are classified and managed, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system.
[0063] Referring to Figure 2 , Figure 2 is a flowchart of another embodiment of the data processing method provided by the present application. The processing method comprises:
[0064] Step 21: obtaining the file state of the target file.
[0065] Wherein, the target file is encoded by erasure coding and has N data blocks and M check blocks, and each data block and each check block has a type mark; N and M are positive integers.
[0066] Step 22: In response to the file state being an abnormal state, obtaining a read-write mode of the target file.
[0067] In some embodiments, a corresponding read-write mode can be set for each file. The read-write mode can be used to record the number of writes and the number of reads of the file.
[0068] Step 23: In response to the read-write mode being a first read-write mode, obtaining a type tag of the abnormal block corresponding to the target file; wherein the first read-write mode indicates that the number of reads of the target file in a preset period is greater than the number of writes.
[0069] Step 24: According to the type tag, preferentially triggering a recovery operation or delaying triggering the recovery operation; wherein the recovery operation is used to recover data of the abnormal block.
[0070] In some embodiments, in response to the type tag indicating a data block type, the recovery operation is preferentially triggered.
[0071] In some embodiments, in response to the type tag indicating a check block type, the recovery operation is delayed.
[0072] In some embodiments, a virtual switch control can be made for the opening and closing of the read-write mode. When the virtual switch is opened, the file read-write state (more writes than reads, less writes than reads) of the memory state is maintained at the file level according to the hour level (1 hour, configurable) and the number of writes and reads of the entire file during the log statistics period. As long as the number of reads of the file is greater than the number of writes of the file during this period, the file is marked as a less write more read mode (first read-write mode). When the file is in an abnormal state, if the virtual switch control is opened, the recovery will be performed according to the file read-write state (read-write mode). Correspondingly, when the file is more write than read and the damaged data is of the data block type, the priority recovery task will be set to avoid the degradation of reading when reading multiple times.
[0073] In the embodiment, when a target file is stored, the target file is encoded by using the erasure code, each data block and each check block after encoding is marked with a type, and a corresponding read-write mode is set for the file, so that when the file state is abnormal, the read-write mode of the target file is acquired first, and when the read-write mode is a first read-write mode, the type of the abnormal block corresponding to the target file is acquired. Then, according to the type, it is determined whether to preferentially trigger a recovery operation to recover the abnormal block or to delay triggering the recovery operation to recover the abnormal block. In this way, the data recovery operation does not need to be triggered immediately every time the file state is abnormal, the flexibility of the recovery operation is improved, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system. In addition, by setting the read-write mode, the scenario in which the number of read times is greater than the number of write times within a preset period can be accurately identified, and the recovery operation is managed according to the read requirement, thereby further improving the flexibility of the recovery operation.
[0074] Referring to Figure 3 , Figure 3 is a flowchart of another embodiment of the data processing method provided by the present application. The processing method comprises:
[0075] Step 31: acquiring a file state of a target file.
[0076] In the embodiment, the target file is encoded by using the erasure code, has N data blocks and M check blocks, and each data block and each check block has a type mark. N and M are positive integers.
[0077] Step 32: in response to the file state being abnormal, acquiring a type mark of an abnormal block corresponding to the target file. The type mark is used to represent a data block type or a check block type.
[0078] Steps 31 to 32 have the same or similar technical solutions as the remaining embodiments of the present application, and will not be described here.
[0079] Step 33: acquiring a read-write mode of the target file.
[0080] In some embodiments, if the number of write times corresponding to file 1 is 1 and the number of read times is 29, the read-write mode corresponding to the file 1 is a first read-write mode. If the number of write times corresponding to file 2 is 1 and the number of read times is 10, the read-write mode corresponding to the file 2 is a first read-write mode. If the number of write times corresponding to file 3 is 1 and the number of read times is 0, the read-write mode corresponding to the file 3 is a second read-write mode. If the target file is file 1 or file 2, the read-write mode corresponding thereto is a first read-write mode. If the target file is file 3, the read-write mode corresponding thereto is a second read-write mode.
[0081] Step 34: preferentially triggering a recovery operation or delaying triggering the recovery operation according to the type mark and the read-write mode.
[0082] In some embodiments, in response to the type mark representing the data block type, and the read-write mode being the first read-write mode, the recovery operation for recovering the abnormal block is triggered preferentially; wherein the first read-write mode represents that the number of read times of the target file in a preset period is greater than the number of write times.
[0083] In some embodiments, in response to the type mark representing the check block type, and the read-write mode being the second read-write mode, the recovery operation for recovering the abnormal block is triggered preferentially; wherein the second read-write mode represents that the number of read times of the target file in a preset period is less than or equal to the number of write times.
[0084] In the present embodiment, when storing the target file, each data block and each check block after encoding by the erasure code is marked with a type mark, and the corresponding read-write mode is set for the file, so that when the file state is abnormal, the type mark of the abnormal block corresponding to the target file is obtained, and then the read-write mode of the target file is obtained, and then according to the type mark and the read-write mode, it is determined whether to preferentially trigger the recovery operation to recover the abnormal block or to delay the trigger of the recovery operation to recover the abnormal block. In this way, it is not necessary to immediately trigger the data recovery operation every time the file state is abnormal, the flexibility of the recovery operation is improved, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system. In addition, by setting the read-write mode, the scenario in which the number of read times of the file in a preset period is greater than the number of write times can be accurately identified, and the management of the recovery operation is further improved according to the read requirement, thereby further improving the flexibility of the recovery operation.
[0085] Referring to Figure 4 , Figure 4 is a flowchart of another embodiment of the data processing method provided by the present application. The processing method comprises:
[0086] Step 41: obtaining the file state of the target file.
[0087] Wherein, the target file is encoded by the erasure code and has N data blocks and M check blocks, and each data block and each check block has a type mark; N and M are positive integers;
[0088] Step 42: in response to the file state being abnormal, determining whether the target file meets at least one of a plurality of recovery priority conditions.
[0089] Wherein, the recovery priority includes time priority, file damage degree priority and device priority.
[0090] In some embodiments, the setting of the priority recovery of various dimensions is supported, and the recovery task meeting the recovery priority condition is also processed preferentially, thereby improving the system reliability in multiple dimensions. For example, the recovery priority includes time priority, file damage degree priority, and device priority. The time priority is mainly determined according to the creation time length of the file. The shorter the creation time length of the file, the higher the probability of being read. Based on this, the time priority of the file can be determined by the creation time length. The file damage degree priority is mainly determined according to the number of abnormal blocks of the file. The greater the number of abnormal blocks, the more abnormal data, which needs to be recovered preferentially. The device priority is mainly determined according to the file collection device of the file. If the device priority of the file collection device is high, the data collected by the file collection device needs to be recovered preferentially, so as to ensure the data integrity of the file collection device.
[0091] If yes, step 43 is performed. If no, step 44 is performed.
[0092] In some embodiments, for the time priority condition, the flow of Figure 5 may be referred to:
[0093] Step 51: Obtain the creation time length of the target file.
[0094] Step 52: When the creation time length meets the first preset condition, it is determined that the target file meets the time priority condition.
[0095] If it is determined that the target file meets the time priority condition, step 43 is performed.
[0096] In some embodiments, when the priority recovery switch is turned on, the files meeting the conditions will be recovered preferentially. The principle of time priority is that when the creation time length of the file is within 1 day (default 1 day, which can be configured, such as 86400 seconds), after the file state of the file becomes abnormal, the type of damaged blocks and the read-write mode are not judged, and the data recovery operation is directly triggered. The file reliability during this period is always required to be met without degradation.
[0097] In some embodiments, for the file damage degree priority condition, the flow of Figure 6 may be referred to:
[0098] Step 61: Obtain the number of abnormal blocks.
[0099] Step 62: When the number is greater than or equal to M, it is determined that the target file meets the file damage degree priority condition.
[0100] If it is determined that the target file meets the file damage degree priority condition, step 43 is performed.
[0101] The priority-based recovery process has a damage degree dimension in addition to the time dimension. The user's original data file is divided into N data blocks and M check blocks according to the erasure code algorithm. When M is greater than or equal to 1, the file can tolerate multiple block damage. When the priority recovery switch is turned on, the file becomes damaged when one more data block slice is damaged (super-damaged), at which time the priority recovery condition is met, and priority recovery can be performed. (Example: 12+3, 12 represents 12 data blocks, and 3 represents 3 check blocks. When 3 blocks are damaged (which can be data blocks, check blocks, or both), the file is in the highest priority damaged state, and one more data block will make the file super-damaged, at which time priority recovery is required.
[0102] At the same time, the minimum damage degree of the file is limited. When all data block slices of the file still support 3 damages (configurable), the file becomes damaged (super-damaged), at which time no data recovery action is required. (For example: 12+5, at which time 1 data block is damaged, and no immediate recovery is required. The file can still tolerate 4 block errors).
[0103] In some embodiments, for the device priority condition, the process of Figure 7 may be referred to:
[0104] Step 71: Obtain the file collection device corresponding to the target file.
[0105] Step 72: When the device priority of the file collection device is greater than the preset level, it is determined that the target file meets the device priority condition.
[0106] If it is determined that the target file meets the device priority condition, step 43 is performed.
[0107] In some embodiments, the data of some key channels is set to priority recovery. When configuring the file collection plan, high-priority channels can be specified. For high-priority file collection devices and channels, the file data written by them is executed with high-priority recovery, and the data of the key channels is always complete.
[0108] Step 43: Trigger the recovery operation to recover the abnormal block corresponding to the target file.
[0109] In some embodiments, the recovery operation is triggered to preferentially recover the abnormal block corresponding to the target file.
[0110] Step 44: Obtain the type tag of the abnormal block corresponding to the target file.
[0111] Step 45: According to the type tag, trigger the recovery operation preferentially or delay the trigger of the recovery operation.
[0112] In some embodiments, in response to the type mark representing the data block type, the recovery operation is triggered to recover the abnormal block preferentially.
[0113] In some embodiments, in response to the type mark representing the check block type, the recovery operation is triggered to recover the abnormal block with delay.
[0114] In the present embodiment, different dimensions of recovery priorities are set for the file, and when the target file is stored, the erasure coding is performed, and each data block and each check block after coding is marked with a type mark, so that when the file state is abnormal, it is judged whether the target file meets at least one of the multiple recovery priority conditions, so that when the recovery priority condition is met, the abnormal block corresponding to the target file is preferentially recovered, so as to adapt to different file storage scenarios, and further, when the recovery priority condition is not met, the type mark of the abnormal block corresponding to the target file is obtained, and then according to the type mark, it is decided whether to trigger the recovery operation to recover the abnormal block preferentially or to trigger the recovery operation to recover the abnormal block with delay, so that the data recovery operation does not need to be triggered immediately every time the file state is abnormal, the flexibility of the recovery operation is improved, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system. In addition, the recovery task that meets the priority condition is also preferentially processed when different dimensions of recovery priorities are set for the file, thereby improving the system reliability in multiple dimensions.
[0115] In some embodiments, the technical solution of the present application can be applied to a distributed storage system. The distributed storage system includes a management node and a plurality of storage nodes; N data blocks and M check blocks are stored in different storage nodes, and the management node stores the metadata of the target file; the metadata includes the storage locations and types of the N data blocks and the M check blocks. That is, the management node can be used as a metadata management node.
[0116] Because the failure of the hardware medium of the storage node server and the hard disk cannot be avoided. In order to realize accurate marking of the file recovery state, accuracy and real-time performance, the present application also sets up a plurality of data block error reporting mechanisms, such as client bad block (abnormal block) reporting, DN (Data Node, storage node) bad block reporting, and hard disk hot plug event sensing.
[0117] In some embodiments, the management node receives first data information and updates the file state corresponding to the first data information; wherein the first data information is generated when reading the target file data abnormally.
[0118] For client bad block reporting. In the normal file reading process, the client requests the data block distribution of the file to be read from the management node, the client first reads the normal EC data block, assembles the original data and returns it. When reading the error data block, read the check block, calculate the original data based on the EC encoding algorithm and return it. At this time, the client will report the abnormal data block information to the management node, and the management node will update the file state in real time to avoid the need to wait for the periodic comparison of the storage node to report the abnormality, and to improve the real-time performance and accuracy of the file state marking.
[0119] In some embodiments, the management node receives second data information sent by each storage node, and updates the file state corresponding to the second data information; wherein the second data information is that each storage node periodically scans all data blocks and check blocks on the storage node, and compares with the check data recorded by the storage node one by one, and generates when there is an abnormal block in the comparison.
[0120] For storage node bad block reporting, the storage node will periodically scan all data block fragments on the local disk, and compare with the CRC (Cyclic redundancy check, cyclic redundancy check) data (check data) recorded locally one by one, and immediately report the metadata management node for file state update once the data block is found to be damaged. The local disk can be composed of mechanical hard disk and / or solid state disk.
[0121] In some embodiments, the management node receives third data information sent by each storage node, and updates the file state corresponding to the third data information; wherein the third data information is generated by each storage node according to the data change information when detecting a change in the storage device corresponding to the storage node.
[0122] For hot plug event sensing. In the program of the storage node, the kernel-based hard disk hot plug event is registered for callback, and when the hard disk hot plug event occurs, the corresponding all data block information of the disk is scanned in time, and the block reduction or block increase information is reported to the management node, so that the management node can maintain and update the file state in time, and trigger the correct file recovery action.
[0123] In some embodiments, the management node delays the recovery of data in the target storage node in other storage nodes when detecting that the target storage node is offline.
[0124] For link anti-jitter technology. When the storage node is offline, the data recovery action is not triggered immediately to avoid data recovery storm, at this time the system will have a time to delete the metadata, such as triggering data reconstruction and recovery after 7 days (configurable) of node offline. Avoid frequent recovery storm caused by network jitter, affecting system performance.
[0125] By the above manner, the technical scheme provided by the application can consider system performance and resource utilization while combining service characteristics, and improve reliability and security of data storage.
[0126] Referring to Figure 8 , Figure 8 is a structural schematic diagram of an embodiment of the distributed storage system provided by the application. The distributed storage system comprises a management node 81 and a plurality of storage nodes 82.
[0127] The management node 81 adopts the processing method provided by any of the above embodiments to perform data processing on each storage node.
[0128] In some embodiments, the management node 81 adopts the processing method provided by any of the above embodiments to generate a recovery operation, and then sends the recovery operation to the corresponding storage node to make the storage node perform data recovery.
[0129] Among them, the file stored in the storage node 82 includes a video file.
[0130] In some embodiments, the distributed storage system can be a distributed video storage system.
[0131] In some embodiments, the distributed storage system can be a distributed video cloud storage system. The storage node 82 can store video files or image files collected by an image collection device. In some embodiments, the image collection device can continuously collect video files or image files.
[0132] In summary, the data processing method and the distributed storage system provided by the application, when storing a target file, encode the target file by using an erasure code, and mark the type of each data block and each check block after encoding, so as to obtain the type mark of the abnormal block corresponding to the target file when the file state is abnormal. Then, according to the type mark, it is determined whether to trigger the recovery operation to recover the abnormal block preferentially or to delay the trigger of the recovery operation to recover the abnormal block. In this way, it is not necessary to trigger the data recovery operation immediately every time the file state is abnormal, the flexibility of the recovery operation is improved, and the performance of the storage system is improved, thereby improving the resource utilization of the entire distributed storage system.
[0133] Further, based on the file data block role marking technology, the damaged data slice type of the file can be accurately identified. Moreover, the data recovery action can be triggered at the correct time in combination with the type of the file service, and in the scenario where only the check block is damaged, the recovery does not need to be triggered immediately, and the data writing efficiency can be improved during the service trough. Meanwhile, some priority recovery strategies are designed, and the reliability guarantee of the system flexibility is considered.
[0134] Further, the division of the recoverable state file into two types of management is supported: a data block damage file queue and a check block damage file queue, so as to realize accurate recovery capability in different scenarios.
[0135] Further, by supporting file level read-write model statistics and analysis, different recovery strategies are supported for the to-be-recovered files in different business scenarios. By counting the read-write frequency of the files in a period of time, it is determined whether the file is a write-many-read file, and different data recovery tasks are performed in combination with the two file recovery queues. For example, in a read-frequently scenario, data block damage is immediately recovered, so as to avoid additional EC calculation when data is read, and the performance of data reading can be significantly improved; check block recovery can be performed in a business trough period, so as to improve system resource utilization.
[0136] Further, flexible recovery strategies are supported according to time priority, file damage degree priority, and channel priority, so as to flexibly control the reliability requirement of data files in different periods, and the recovery of severely damaged data can be triggered in time, so as to improve system reliability.
[0137] Further, by combining the multiple error block reporting technology of the distributed nodes and the link anti-jitter strategy of the hard disks and the nodes, the abnormal state of the file can be accurately identified and marked, and at the same time, data recovery storm can be effectively avoided, so as to improve system performance and network bandwidth utilization.
[0138] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and the division of the circuit or unit is merely a logical function division, and actual implementation can be in another manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0139] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they can be located in one place, or distributed on a plurality of network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.
[0140] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically, or two or more units can be integrated into one unit. The above integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0141] The above merely describes the embodiments of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation according to the content of the present application specification and drawings, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data processing method, characterized in that, The method includes: Obtain the file status of the target file; wherein, the target file, after being encoded by erasure coding, has N data blocks and M check blocks, and each data block and each check block has a type label; N and M are positive integers; In response to the file being in an abnormal state, the type flag of the abnormal block corresponding to the target file is obtained; the type flag is used to indicate the data block type or the check block type. Based on the type flag, the recovery operation is either triggered preferentially or delayed; wherein the recovery operation is used to recover the data of the abnormal block; The step of prioritizing or delaying the triggering of the recovery operation based on the type marker includes: In response to the type flag indicating the data block type, the recovery operation is triggered first; In response to the type flag indicating the check block type, the recovery operation is delayed. Before obtaining the type flag of the exception block corresponding to the target file, the method further includes: In response to the file being in an abnormal state, it is determined whether the target file meets at least one of a plurality of recovery priority conditions; wherein, the recovery priority includes time priority, file corruption degree priority, and device priority; If so, trigger the recovery operation; If not, obtain the type flag of the exception block corresponding to the target file.
2. The processing method according to claim 1, characterized in that, The step of responding to the file status being abnormal by obtaining the type flag of the abnormal block corresponding to the target file includes: In response to the file status being abnormal, the read / write mode of the target file is obtained; In response to the read / write mode being the first read / write mode, the type flag of the abnormal block corresponding to the target file is obtained; wherein, the first read / write mode indicates that the number of reads of the target file within a preset period is greater than the number of writes.
3. The processing method according to claim 1, characterized in that, The step of prioritizing or delaying the triggering of the recovery operation based on the type marker includes: Obtain the read / write mode of the target file; Based on the type flag and the read / write mode, the recovery operation is triggered preferentially or delayed.
4. The processing method according to claim 3, characterized in that, The step of prioritizing or delaying the triggering of the recovery operation based on the type marker and the read / write mode includes: In response to the type flag indicating the data block type and the read / write mode being the first read / write mode, the recovery operation is triggered preferentially; wherein, the first read / write mode indicates that the number of reads of the target file within a preset period is greater than the number of writes; In response to the type flag indicating the check block type and the read / write mode being the second read / write mode, the recovery operation is delayed; wherein, the second read / write mode indicates that the number of reads of the target file within a preset period is less than or equal to the number of writes.
5. The processing method according to claim 1, characterized in that, The determination of whether the target file meets the time priority condition includes: Obtain the creation time of the target file; When the creation time meets the first preset condition, the target file is determined to meet the time priority condition.
6. The processing method according to claim 1, characterized in that, The determination of whether the target file meets the priority condition for file corruption includes: Obtain the number of the abnormal blocks; When the number is greater than or equal to M, the target file is determined to meet the file corruption priority condition.
7. The processing method according to claim 6, characterized in that, The step of determining whether the target file meets the device priority condition includes: Obtain the file acquisition device corresponding to the target file; If the device priority of the file acquisition device is greater than the preset level, then the target file is determined to meet the device priority condition.
8. The processing method according to any one of claims 1-7, characterized in that, The method is applied to a distributed storage system, which includes a management node and several storage nodes; the N data blocks and the M check blocks are stored on different storage nodes, and the management node stores the metadata of the target file. The metadata includes the storage location and type of the N data blocks and the M check blocks; The method further includes: The management node receives the first data information and updates the file status corresponding to the first data information; wherein, the first data information is generated when a data anomaly occurs while reading the target file; And / or, The management node receives the second data information sent by each of the storage nodes and updates the file status corresponding to the second data information; wherein, the second data information is generated when each of the storage nodes periodically scans all data blocks and check blocks on the storage node and compares them one by one with the check data recorded by the storage node; And / or, The management node receives third data information sent by each of the storage nodes and updates the file status corresponding to the third data information; wherein, the third data information is generated by each of the storage nodes based on data change information when it detects a change in the storage device corresponding to the storage node; And / or, when the management node detects that the target storage node is offline, it delays the recovery of data in the target storage node from other storage nodes.
9. A distributed storage system, characterized in that, The distributed storage system includes: Several storage nodes; A management node, wherein the management node performs data processing on each of the storage nodes using the processing method described in any one of claims 1-8.
10. The distributed storage system according to claim 9, characterized in that, The files stored in the storage node include video files.
Citation Information
Patent Citations
Storage data reconstruction method and device based on erasure code, storage node
CN107544862A
Data recovery control method and device based on erasure codes, equipment and medium
CN113190384A
Data recovery method and related device
CN114880165A
Delay data reconstruction method and device, storage node and storage medium
CN116028276A