Check disk data recovery method and device, electronic equipment and readable storage medium
By using the calculation performance of the data disk to calculate the initial verification value during the verification disk data recovery process, and then using the verification disk to perform the final calculation, the problem of inefficient data recovery of the verification disk is solved, and fast and efficient data recovery is achieved, and equipment performance is improved.
Patent Information
- Application Number
- CN202510558660.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-01
AI Technical Summary
In the prior art, the inefficient verification disk data recovery efficiency leads to poor equipment performance. Especially when the frequency of single node failures in distributed storage systems is high, the data transmission cost is much higher than the calculation cost.
By determining the check disk corresponding to the diagonal check chain in the target redundant array, the target data blocks corresponding to the check block are grouped, the initial check value is calculated using the calculation performance of the data disk, and the initial check value is sent to the check disk for final calculation, reducing the data transmission amount and improving the data recovery efficiency of the check disk.
It realizes faster and more efficient verification disk data recovery, effectively reducing data transmission bandwidth, and improving device performance and user experience.
Smart Images

Figure CN120407290A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of storage technology, and particularly to a method for repairing data on a parity disk, and also relates to a device for repairing data on a parity disk, an electronic device, and a computer-readable storage medium. Background Art
[0002] In a distributed storage system, node failure repair is crucial, especially for single-node failures, whose occurrence frequency is as high as 99.75%. Research shows that in a distributed storage system, the data transmission cost is much higher than the computing cost. Therefore, in order to improve the system reliability, it is crucial to reduce the amount of data transmission during the repair process. However, current research mainly focuses on improving the repair efficiency of data disks, while the repair of parity disks still adopts the traditional method, that is, directly sending the stored data of the data disk corresponding to the parity disk for realizing parity disk data recovery to the parity disk for parity disk data recovery, resulting in low efficiency.
[0003] Therefore, how to achieve faster and more efficient parity disk data recovery and ensure the device performance is an urgent problem to be solved by those skilled in the art. Summary of the Invention
[0004] The purpose of this application is to provide a method for repairing data on a parity disk, which can achieve faster and more efficient parity disk data recovery and effectively ensure the device performance; another purpose of this application is to provide a device for repairing data on a parity disk, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.
[0005] In a first aspect, this application provides a method for repairing data on a parity disk, including:
[0006] Determine the parity disk corresponding to the diagonal parity chain in the target redundant array;
[0007] For each parity block in the parity disk, group all the target data blocks corresponding to the parity block to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk;
[0008] For each data block group, use the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain the initial parity value corresponding to the data block group;
[0009] Send the initial parity values corresponding to each data block group to the parity disk, so as to use the parity disk to calculate each initial parity value to obtain the parity value corresponding to the parity block;
[0010] Obtain the recovery data of the check disk based on the check values corresponding to all the check blocks, and complete the data repair of the check disk.
[0011] Optionally, for each check block in the check disk, group all the target data blocks corresponding to the check block to obtain each data block group, including:
[0012] Determine each first data block corresponding to the adjustment factor in the target redundant array;
[0013] For each check block in the check disk, determine each second data block corresponding to the check block except the adjustment factor;
[0014] Use each of the first data blocks and each of the second data blocks as all the target data blocks corresponding to the check block;
[0015] Group all the target data blocks corresponding to the check block to obtain each data block group corresponding to the check block.
[0016] Optionally, group all the target data blocks corresponding to the check block to obtain each data block group corresponding to the check block, including:
[0017] For each target data block corresponding to the check block, determine the arrangement column number of the target data block in the target redundant array;
[0018] For all the target data blocks corresponding to the check block, combine the target data blocks with the same arrangement column number into a data block group to obtain each data block group corresponding to the check block.
[0019] Optionally, for each data block group, use the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain the initial check value corresponding to the data block group, including:
[0020] For each data block group, determine the valid data stored in each of the target data blocks in the data block group;
[0021] Use the data disk corresponding to the data block group to perform an exclusive OR operation on the valid data stored in each of the target data blocks in the data block group to obtain the initial check value corresponding to the data block group;
[0022] Correspondingly, send the initial check values corresponding to each data block group to the check disk to use the check disk to calculate each of the initial check values to obtain the check value corresponding to the check block, including:
[0023] Send the initial check values corresponding to each of the data blocks to the check disk, so as to perform the exclusive OR operation on each of the initial check values by using the check disk to obtain the check value corresponding to the check block.
[0024] Optionally, after determining the check disk corresponding to the diagonal check chain in the target redundant array, it further includes:
[0025] Determine the current repair mode; the repair mode includes a normal repair mode and a quick repair mode;
[0026] When the current repair mode is the normal repair mode, for each check block in the check disk, use the check disk to calculate all the target data blocks corresponding to the check block to obtain the check value corresponding to the check block, and obtain the recovery data of the check disk based on the check values corresponding to all the check blocks to complete the data repair of the check disk;
[0027] When the current repair mode is the quick repair mode, execute the step of grouping all the target data blocks corresponding to each check block in the check disk to obtain each data block group.
[0028] Optionally, for each check block in the check disk, using the check disk to calculate all the target data blocks corresponding to the check block to obtain the check value corresponding to the check block includes:
[0029] For each check block in the check disk, determine all the target data blocks corresponding to the check block;
[0030] Send the valid data stored in all the target data blocks to the check disk, so as to perform the exclusive OR operation on all the valid data by using the check disk to obtain the check value corresponding to the check block.
[0031] Optionally, the check disk data repair method further includes:
[0032] Determine the target check disk corresponding to the row check chain in the target redundant array;
[0033] For each target check block in the target check disk, determine each data block corresponding to the target check block;
[0034] Use the target check disk to calculate each of the data blocks corresponding to the target check block to obtain the target check value corresponding to the target check block;
[0035] Obtain the recovery data of the target check disk based on the target check values corresponding to all the target check blocks to complete the data repair of the target check disk.
[0036] In a second aspect, the present application also discloses a check disk data repair device, including:
[0037] A determination module, configured to determine a check disk corresponding to a diagonal check chain in a target redundant array;
[0038] A grouping module, configured to group all target data blocks corresponding to each check block in the check disk to obtain data block groups; wherein, all the target data blocks in each data block group belong to the same data disk;
[0039] A first calculation module, configured to calculate all the target data blocks in each data block group by using the data disk corresponding to the data block group to obtain an initial check value corresponding to the data block group;
[0040]
[0041]
[0042]
[0043]
[0044]
[0045]
[0046]
[0047] A second calculation module, configured to send the initial check values corresponding to the data block groups to the check disk to calculate the initial check values by using the check disk to obtain a check value corresponding to the check block; A combination module, configured to obtain recovery data of the check disk based on the check values corresponding to all the check blocks to complete data repair of the check disk. In a third aspect, the present application also discloses an electronic device, including:
[0043] A memory, configured to store a computer program;
[0044] A processor, configured to implement the steps of any of the above-mentioned check disk data repair methods when executing the computer program.
[0045] In a fourth aspect, the present application also discloses a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the above-mentioned check disk data repair methods are implemented.
[0046] In a fifth aspect, the present invention also discloses a computer program product, including computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any of the above-mentioned check disk data repair methods are implemented.
[0047] The present application provides a method for repairing data of a check disk, including: determining a check disk corresponding to a diagonal check chain in a target redundant array; for each check block in the check disk, grouping all target data blocks corresponding to the check block to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk; for each data block group, using the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain an initial check value corresponding to the data block group; sending the initial check values corresponding to the data block groups to the check disk to calculate the initial check values by using the check disk to obtain a check value corresponding to the check block; and obtaining recovery data of the check disk based on the check values corresponding to all the check blocks to complete data repair of the check disk.
[0048] Applying the technical solution provided by the present application, when recovering data of a check disk corresponding to a diagonal check chain in a target redundant array, for each check block in the check disk, after determining each target data block corresponding to the check block, instead of directly sending the stored data in each target data block to the check disk for data recovery, the target data blocks are first grouped according to the data disks to which the target data blocks belong, ensuring that all the target data blocks in each data block group belong to the same data disk, and then giving full play to the computing performance of the data disk, using each data disk to perform initial calculations on the data block group corresponding to it to obtain an initial check value corresponding to each data block group, and finally sending the initial check values corresponding to each data block group to the check disk for calculation to obtain the check value of the current check block, and so on, to obtain the check values of all check blocks in the check disk and complete the data recovery of the check disk. It can be seen that this technical solution first uses the computing performance of the data disk to perform preliminary check value calculations, and then uses the computing performance of the check disk to achieve the final check value calculations, effectively reducing the amount of data sent to the check disk, thereby effectively reducing the data transmission bandwidth and improving the data recovery efficiency of the check disk. Therefore, this technical solution can achieve faster and more efficient data recovery of the check disk, effectively ensuring the device performance.
[0049] In an embodiment of the present application, the redundant array device can support both a normal repair mode and a fast repair mode for the check disk at the same time, facilitating the user to make a personalized choice according to their actual needs, further improving the device performance and being more conducive to improving the user experience.
[0050] The check disk data repair device, electronic device, computer-readable storage medium, and computer program product provided by the present application also have the above technical effects, which will not be elaborated herein. Description of the Drawings
[0051] To more clearly illustrate the prior art and the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the prior art and the embodiments of the present application. Of course, the following drawings related to the embodiments of the present application only describe a part of the embodiments in the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained according to the provided drawings, and the other obtained drawings also fall within the protection scope of the present application.
[0052] Figure 1 A flowchart of a method for repairing check disk data provided by the present application;
[0053] Figure 2 An array code of a redundant array provided by the present application;
[0054] Figure 3 An array code of a redundant array with an adjustment factor added provided by the present application;
[0055] Figure 4 A schematic diagram of data recovery of the first check block in a redundant array provided by the present application;
[0056] Figure 5 A schematic diagram of data recovery of the second check block in a redundant array provided by the present application;
[0057] Figure 6 A schematic diagram of data recovery of the third check block in a redundant array provided by the present application;
[0058] Figure 7 A schematic diagram of data recovery of the fourth check block in a redundant array provided by the present application;
[0059] Figure 8 A schematic diagram of the structure of a check disk data repair device provided by the present application;
[0060] Figure 9 A schematic diagram of the structure of an electronic device provided by the present application. Detailed implementation manners
[0061] The core of the present application is to provide a method for repairing check disk data, which can achieve faster and more efficient recovery of check disk data and effectively guarantee the device performance; another core of the present application is to provide a check disk data repair device, an electronic device, a computer-readable storage medium, and a computer program product, all of which have the above beneficial effects.
[0062] To describe the technical solutions in the embodiments of the present application more clearly and completely, the following will introduce the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0063] The embodiments of the present application provide a method for repairing check disk data.
[0064] Please refer to Figure 1 , Figure 1 , which is a schematic flowchart of a method for repairing check disk data provided by the present application. The method for repairing check disk data may include the following S101 to S105.
[0065] S101: Determine the check disk corresponding to the diagonal check chain in the target redundant array.
[0066] This step aims to determine the check disk in the target redundant array. The target redundant array is the redundant array for which check disk data repair is required, such as any type of RAID (Redundant Array of Independent Disks) system, such as RAID5, RAID6, etc. Taking the RAID system as an example, the widely used array code in it is the EVENODD array code (a coding structure). VENODD can tolerate the failure of two disks at the same time, and its encoding and decoding implementation algorithms are simple and easy to implement in software and hardware. Based on the EVENODD array composition, there are two check rules inside, namely the row check chain and the diagonal check chain combined with the adjustment factor, as Figure 2 shown, Figure 2 is an array code of a redundant array provided by the present application. Among them, the sixth column (column number 5) is the check disk corresponding to the row check chain, and the seventh column (column number 6) is the check disk corresponding to the diagonal check chain. Both are used to store check data. The first five columns (column numbers 0 to 4) are data blocks in the redundant array and are used to store valid data. It should be noted that the embodiments of the present application are mainly used to implement the repair of the check disk data corresponding to the diagonal check chain combined with the adjustment factor. Based on this, after determining the target redundant array, the check disk corresponding to the diagonal check chain in it can be further determined to facilitate the data repair of this check disk.
[0067] S102: For each check block in the check disk, group all the target data blocks corresponding to the check block to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk.
[0068] S103: For each data block group, use the data disks corresponding to the data block group to calculate all the target data blocks in the data block group, and obtain the initial check value corresponding to the data block group.
[0069] S104: Send the initial check values corresponding to each data block group to the check disks, so as to use the check disks to calculate each initial check value and obtain the check value corresponding to the check block.
[0070] It can be understood that the check disks are composed of multiple check blocks. As Figure 2 shown, the check disks include check blocks C06, C16, C26, and C36. Each check block corresponds to different target data blocks. All the target data blocks belong to different data disks, and the check data in each check block is calculated based on the valid data in its corresponding target data blocks. Therefore, to implement data repair of the check disks, it is necessary to sequentially implement data repair of all the check blocks in the check disks; to implement data repair of any check block, it is necessary to first determine its corresponding target data blocks to obtain the valid data stored therein for calculation.
[0071] However, in the traditional implementation method, for any check block in the check disks, after determining its corresponding target data blocks, the valid data in each target data block is directly sent to the check disks, and the check disks calculate all the valid data to obtain the check data in the current check block, thereby implementing data recovery of the current check block. However, this implementation method needs to sequentially transmit the valid data in all the target data blocks corresponding to the current check block to the check disks, resulting in a large amount of data transmission, a large data transmission bandwidth, and more time and system resources occupied, thus causing the problem of low repair efficiency of the check disks.
[0072] Based on this, the embodiment of the present application proposes a technical solution of first using the computing performance of the data disks to perform preliminary check data calculation and then using the computing performance of the check disks to implement final check data calculation. Specifically, after determining the target data blocks corresponding to any check block, the target data blocks can be grouped first, and the grouping basis is to ensure that the target data blocks in each data block group come from the same data disk, that is to say, one data block group corresponds to one data disk. Thus, for each data block group, its corresponding data disk can be used to calculate the target data blocks in the data block group to obtain the check data corresponding to the data block group, that is, the above-mentioned initial check value, so as to give full play to the computing performance of the data disks and obtain the initial check values corresponding to each data block group. Further, send each initial check value to the check disks, and the check disks calculate each initial check value to obtain the final check data, that is, the check value in the current check block.
[0073] Furthermore, the following example can be referred to. Assume that the number of target data blocks corresponding to a certain check block is 5, namely A, B, C, D, and E. If the traditional technical solution is adopted, the valid data in these 5 target data blocks need to be sent to the check disk for calculation respectively, that is, the data transmission volume is 5. However, if the technical solution provided by the embodiments of the present application is adopted, by traversing the data disks, it can be determined that data blocks A and B belong to the same data disk 1, data blocks C and D belong to the same data disk 2, and data block E belongs to data disk 3. Thus, based on data disk 1, the initial check values of data blocks A and B can be calculated, based on data disk 2, the initial check values of data blocks C and D can be calculated, and based on data disk 3, the initial check value of data block E can be calculated, which is the valid data itself stored in data block E. Then, the initial check values calculated by data disk 1, data disk 2, and data disk 3 are sent to the check disk for calculation. At this time, the data transmission volume is 3. By comparison, it can be seen that the technical solution of the present application can effectively reduce the amount of data sent to the check disk compared with the traditional technical solution, and further effectively reduce the data transmission bandwidth, improving the data recovery efficiency of the check disk.
[0074] In an embodiment of the present application, for each check block in the check disk, grouping all the target data blocks corresponding to the check block to obtain each data block group may include:
[0075] Determining each first data block corresponding to the adjustment factor in the target redundant array;
[0076] For each check block in the check disk, determining each second data block other than the adjustment factor corresponding to the check block;
[0077] Taking each first data block and each second data block as all the target data blocks corresponding to the check block;
[0078] Grouping all the target data blocks corresponding to the check block to obtain each data block group corresponding to the check block.
[0079] The embodiments of the present application provide a method for implementing the determination of the target data blocks corresponding to the check block. As described above, the diagonal check chain in the redundant array is essentially a diagonal check chain combined with the adjustment factor. When the corresponding check disk performs check data recovery, it needs to be implemented in combination with the adjustment factor. However, the adjustment factor is also calculated based on the valid data in the corresponding data blocks in the redundant array. That is to say, the target data blocks corresponding to any check block include: the first data blocks corresponding to the adjustment factor and the second data blocks other than the adjustment factor (essentially the data blocks originally corresponding to the check block itself). As Figure 3 shown, Figure 3The array code of a redundant array with a regulator provided in this application, where S1 is the regulator, and its corresponding first data blocks include C04, C13, C22, and C31.
[0080] Among them, grouping all target data blocks corresponding to a parity block to obtain each data block group corresponding to the parity block may include: for each target data block corresponding to the parity block, determining the arranged column number of the target data block in the target redundant array; for all target data blocks corresponding to the parity block, combining target data blocks with the same arranged column number into a data block group to obtain each data block group corresponding to the parity block. Specifically, to ensure that the target data blocks in each data block group belong to the same data disk, it is only necessary to determine the data disk to which each target data block belongs with reference to the row-column structure of the target redundant array. That is to say, in the target redundant array, target data blocks with the same arranged column number belong to the same data disk. As Figure 2 shown, the data blocks C00, C10, C20, and C30 corresponding to column number 0 belong to the same data disk; the data blocks C01, C11, C21, and C31 corresponding to column number 1 belong to the same data disk, etc.
[0081] In an embodiment of this application, for each data block group, calculating all target data blocks in the data block group by using the data disk corresponding to the data block group to obtain the initial check value corresponding to the data block group may include: for each data block group, determining the valid data stored in each target data block in the data block group; using the data disk corresponding to the data block group to perform an exclusive OR operation on the valid data stored in each target data block in the data block group to obtain the initial check value corresponding to the data block group;
[0082] Correspondingly, sending the initial check values corresponding to each data block group to the parity disk to calculate each initial check value by using the parity disk to obtain the check value corresponding to the parity block may include: sending the initial check values corresponding to each data block group to the parity disk to perform an exclusive OR operation on each initial check value by using the parity disk to obtain the check value corresponding to the parity block.
[0083] The embodiment of this application provides a method for calculating check data, that is, an exclusive OR operation scheme. First, when calculating the initial check value corresponding to each data block group by using the computing performance of the data disk, the data disk may perform an exclusive OR operation on the valid data stored in each target data block in the corresponding data block group to obtain the initial check value corresponding to each data block group. Further, when calculating the final check value of the current parity block by using the computing performance of the parity disk, the parity disk may also perform an exclusive OR operation on the initial check values corresponding to all data block groups to obtain the final check value of the current parity block.
[0084] S105: The recovery data of the check disk is obtained based on the check values corresponding to all the check blocks, and the data repair of the check disk is completed.
[0085] It can be understood that based on the above S102~S104, the check value of each check block in the check disk can be calculated. Therefore, when the check values of all check blocks in the check disk are calculated, it is equivalent to obtaining the check data of the check disk, that is, the above-mentioned recovery data. At this point, the data recovery of the check disk corresponding to the diagonal check chain combined with the adjustment factor is completed.
[0086] In one embodiment of the present application, obtaining recovery data of the parity disk based on the parity values corresponding to all the parity blocks and completing data repair of the parity disk may include:
[0087] The recovery data of the check disk is obtained based on the check values corresponding to all the check blocks;
[0088] The recovered data is verified. When the recovered data passes the verification, the recovered data is written to the verification disk, completing the data repair of the verification disk.
[0089] To ensure the accuracy of data repair on the check disk, after calculating the recovered data on the check disk, you can first verify it, such as integrity and correctness. Only if the verification passes will the recovered data be written to the check disk, completing the data repair on the check disk. Conversely, if the recovered data verification fails, it indicates that the recovered data is incorrect and does not need to be written to the check disk. An exception prompt can be directly output.
[0090] As can be seen, in the method for repairing check disk data provided by the embodiments of the present application, when recovering data of the check disk corresponding to the diagonal check chain in the target redundant array, for each check block in the check disk, after determining the respective target data blocks corresponding to the check block, instead of directly sending the stored data in the respective target data blocks to the check disk for data recovery, the respective target data blocks are first grouped according to the data disks to which the target data blocks belong, ensuring that all the target data blocks in each data block group belong to the same data disk, and then the computing performance of the data disk is fully utilized to perform initial calculations on the respective data block groups corresponding to the data disks to obtain the initial check values corresponding to each data block group. Finally, the initial check values corresponding to the respective data block groups are sent to the check disk for calculation to obtain the check value of the current check block, and so on, to obtain the check values of all the check blocks in the check disk, completing the data recovery of the check disk. Thus, it can be seen that this technical solution first uses the computing performance of the data disk to perform preliminary check value calculations, and then uses the computing performance of the check disk to achieve the final check value calculations, effectively reducing the amount of data sent to the check disk, thereby effectively reducing the data transmission bandwidth and improving the data recovery efficiency of the check disk. Therefore, this technical solution can achieve faster and more efficient data recovery of the check disk, effectively ensuring the device performance.
[0091] Based on the above embodiments:
[0092] In an embodiment of the present application, after determining the check disk corresponding to the diagonal check chain in the target redundant array, it may further include:
[0093] Determine the current repair mode; the repair mode includes a normal repair mode and a fast repair mode;
[0094] When the current repair mode is the normal repair mode, for each check block in the check disk, use the check disk to calculate all the target data blocks corresponding to the check block to obtain the check value corresponding to the check block, and obtain the recovery data of the check disk based on the check values corresponding to all the check blocks, completing the data repair of the check disk;
[0095] When the current repair mode is the fast repair mode, perform the step of grouping all the target data blocks corresponding to the check block for each check block in the check disk to obtain each data block group.
[0096] In the embodiment of the present application, the redundant array device can support both the normal repair mode and the fast repair mode for the parity disk, which is convenient for the user to make a personalized choice according to their actual needs, further improving the device performance and being more conducive to improving the user experience. Among them, the normal repair mode is the traditional implementation method described above. For any parity block, after determining the corresponding target data blocks, instead of using the computing performance of the data disk, the valid data in each target data block is directly sent to the parity disk, and the parity disk directly calculates all the valid data of the target data blocks to obtain the parity data in this parity block.
[0097] Among them, for each parity block in the parity disk, using the parity disk to calculate all the target data blocks corresponding to the parity block to obtain the parity value corresponding to the parity block may include: for each parity block in the parity disk, determining all the target data blocks corresponding to the parity block; sending the valid data stored in all the target data blocks to the parity disk to use the parity disk to perform an exclusive OR operation on all the valid data to obtain the parity value corresponding to the parity block. That is to say, in the normal repair mode, the calculation scheme for the valid data of multiple target data blocks can also refer to the calculation scheme for the valid data of multiple target data blocks in the above fast repair mode, that is, both can be implemented through the exclusive OR operation scheme. It can be understood that the two schemes only have different calculation methods, but the final calculation results must be the same.
[0098] In an embodiment of the present application, the parity disk data repair method may further include:
[0099] Determine the target parity disk corresponding to the row parity chain in the target redundant array;
[0100] For each target parity block in the target parity disk, determine the data blocks corresponding to the target parity block;
[0101] Use the target parity disk to calculate the data blocks corresponding to the target parity block to obtain the target parity value corresponding to the target parity block;
[0102] Based on the target parity values corresponding to all the target parity blocks, obtain the recovery data of the target parity disk and complete the data repair of the target parity disk.
[0103] As described above, there are two parity check rules inside the EVENODD array code, namely the row parity chain and the diagonal parity chain combined with the adjustment factor, as Figure 2As shown, the sixth column (column number 5) is the check disk corresponding to the row check chain. The check disk data repair method provided in the embodiment of the present application can also realize the data repair of the check disk corresponding to the row check chain. It should be noted that the target data blocks corresponding to each check block in the check disk corresponding to the row check chain all come from different data disks, so it is impossible to combine the calculation function of the data disk. Therefore, for each check block (target check block) in the check disk corresponding to the row check chain, the corresponding data blocks are directly sent to the check disk for calculation to obtain the check value in the check block. Therefore, when the check values of all check blocks in the check disk corresponding to the row check chain are calculated, it is equivalent to obtaining the check data of the target check disk, that is, the above-mentioned recovery data. At this point, the data recovery of the check disk corresponding to the row check chain is completed.
[0104] Similarly, the above-mentioned use of the target check disk to calculate each data block corresponding to the target check block to obtain the target check value corresponding to the target check block may include: using the target check disk to perform an XOR operation on the storage data (valid data) in each data block corresponding to the target check block to obtain the target check value corresponding to the target check block.
[0105] On the basis of the above embodiments, the embodiment of the present application takes the RAID system based on the EVENODD array code as an example to provide another method for repairing parity disk data.
[0106] First, the structure of the EVENODD array code is a (m−1)×(m+2) array code, where the first m columns are the data information columns for storing data files, and the last two columns store redundant data. ij represents the data block at row i and column j, and 0≤i≤m-1, 0≤j≤m+1. For the convenience of expression, a virtual row can be added to the last row of the array, namely c m-1,j =0 (0≤j≤m-1), but is not used for actual storage, such as Figure 2 and Figure 3 The redundant array shown has m=5 and S1 is the adjustment factor.
[0107] Further, based on Figure 2 and Figure 3 The redundant array shown can be calculated as follows:
[0108] (1) Calculation formula for adjustment factor:
[0109] S1=C04⊕C13⊕C22⊕C31;
[0110] (2) Calculation formula for the check block in column m=5:
[0111] C05=C00⊕C01⊕C02⊕C03⊕C04;
[0112] C15 = C10 ⊕ C11 ⊕ C12 ⊕ C13 ⊕ C14;
[0113] C25 = C20 ⊕ C21 ⊕ C22 ⊕ C23 ⊕ C24;
[0114] C35 = C30 ⊕ C31 ⊕ C32 ⊕ C33 ⊕ C34;
[0115] (3)The calculation formula for the check block in the 6th column where m = 6:
[0116] C06 = S1 ⊕ C00 ⊕ C14 ⊕ C23 ⊕ C32;
[0117] C16 = S1 ⊕ C01 ⊕ C10 ⊕ C24 ⊕ C33;
[0118] C26 = S1 ⊕ C02 ⊕ C11 ⊕ C20 ⊕ C34;
[0119] C36 = S1 ⊕ C03 ⊕ C12 ⊕ C22 ⊕ C30.
[0120] Therefore, for the EVENODD array code of (m - 1) × (m + 2), the corresponding calculation formula is as follows:
[0121] (1)The calculation formula for the adjustment factor:
[0122] ;
[0123] (2)The calculation formula for the check disk corresponding to the row check chain in the mth column:
[0124] ;
[0125] (3)The calculation formula for the check disk corresponding to the diagonal check chain combined with the adjustment factor in the (m + 1)th column:
[0126] .
[0127] Finally, please refer to Figures 4 to 7 , Figure 4 which is the schematic diagram of data recovery for the first check block in a redundant array provided by this application, Figure 5 which is the schematic diagram of data recovery for the second check block in a redundant array provided by this application, Figure 6 which is the schematic diagram of data recovery for the third check block in a redundant array provided by this application, Figure 7 which is the schematic diagram of data recovery for the fourth check block in a redundant array provided by this application. The following takes C06 in Figure 4 as an example for illustration.
[0128] (1)The calculation formula for C06:
[0129] C06 = C00 ⊕ C32 ⊕ C23 ⊕ C14 ⊕ S1;
[0130] (2)Substitute the adjustment factor S1:
[0131] C06 = C00 ⊕ C32 ⊕ C23 ⊕ C14 ⊕ C31 ⊕ C22 ⊕ C13 ⊕ C04;
[0132] (3)First, perform the exclusive OR operation on the elements located on the same data disk within each data disk. For example, C22 and C32, C13 and C23, C04 and C14 are on the same data disk, so the exclusive OR operation is performed first. And C00 and C31 are independent elements within their respective data disks, so they can be directly passed through to the parity disk:
[0133] C06 = C00 ⊕ C31 ⊕ (C22 ⊕ C32) ⊕ (C13 ⊕ C23) ⊕ (C04 ⊕ C14).
[0134] Based on the above formula, it can be seen that before optimization, calculating C06 and directly passing it through to the parity disk requires transmitting 8 data blocks, namely C00, C32, C23, C14, C31, C22, C13, and C14. After optimization, only 5 data blocks, namely C00, C31, (C22 ⊕ C32), (C13 ⊕ C23), and (C04 ⊕ C14), need to be transmitted. Therefore, the repair bandwidth is reduced to (8 - 5) / 8 = 37.5% of the original.
[0135] Similarly, the calculation formulas for the remaining elements in the parity disk can be obtained:
[0136] C16 = C10 ⊕ C01 ⊕ C33 ⊕ C24 ⊕ S1 = C10 ⊕ C01 ⊕ C33 ⊕ C24 ⊕ C31 ⊕ C22 ⊕ C13 ⊕ C14 = C10 ⊕ (C01 ⊕ C31) ⊕ C22 ⊕ (C13 ⊕ C33) ⊕ (C04 ⊕ C24);
[0137] C26 = C20 ⊕ C11 ⊕ C02 ⊕ C34 ⊕ S1 = C20 ⊕ C11 ⊕ C02 ⊕ C34 ⊕ C31 ⊕ C22 ⊕ C13 ⊕ C14 = C20 ⊕ (C11 ⊕ C31) ⊕ (C02 ⊕ C22) ⊕ C13 ⊕ (C04 ⊕ C34);
[0138] C36 = C30 ⊕ C21 ⊕ C12 ⊕ C03 ⊕ S1 = C30 ⊕ C21 ⊕ C12 ⊕ C03 ⊕ C31 ⊕ C22 ⊕ C13 ⊕ C14 = C30 ⊕ (C21 ⊕ C31) ⊕ (C12 ⊕ C22) ⊕ (C03 ⊕ C13) ⊕ C04.
[0139] Based on the above examples, the implementation process of the parity disk data repair method provided by the embodiments of the present application can be obtained as follows:
[0140] 1. Based on the EVENODD array, combined with the diagonal parity chain of the combined adjustment factor, traverse each data disk to find all the data blocks on the same data disk that are located on the diagonal parity chain of the combined adjustment factor;
[0141] 2. For the data blocks on each data disk that are located on the diagonal parity chain of the combined adjustment factor and the number of data blocks is greater than 1, perform exclusive OR operations on all these data blocks;
[0142] 3. Transmit the operation results in step 2 and the data blocks on each data disk that are located on the diagonal parity chain of the combined adjustment factor and the number of data blocks is equal to 1 to the parity disk where the diagonal parity chain of the combined adjustment factor is located;
[0143] 4. Update the parity blocks on the parity disk corresponding to the diagonal parity chain of the combined adjustment factor according to the corresponding positions.
[0144] It can be seen that for the parity disk data repair method provided by the embodiments of the present application, when recovering data for the parity disk corresponding to the diagonal parity chain in the target redundant array, for each parity block in the parity disk, after determining the respective target data blocks corresponding to the parity block, the stored data in each target data block is not directly sent to the parity disk for data recovery. Instead, the target data blocks are first grouped according to the data disks to which the target data blocks belong, ensuring that all the target data blocks in each data block group belong to the same data disk. Then, the computing performance of the data disk is fully utilized to perform initial calculations on the respective data block groups corresponding to each data disk to obtain the initial parity values corresponding to each data block group. Finally, the initial parity values corresponding to each data block group are sent to the parity disk for calculation to obtain the parity value of the current parity block, and so on, to obtain the parity values of all parity blocks in the parity disk, completing the parity disk data recovery. Thus, it can be seen that this technical solution first uses the computing performance of the data disk to perform preliminary parity value calculations, and then uses the computing performance of the parity disk to achieve the final parity value calculations, effectively reducing the amount of data sent to the parity disk, thereby effectively reducing the data transmission bandwidth and improving the parity disk data recovery efficiency. Therefore, this technical solution can achieve faster and more efficient parity disk data recovery, effectively ensuring the device performance.
[0145] Embodiments of the present application provide a parity disk data repair device.
[0146] Please refer to Figure 8 , Figure 8 which is a schematic structural diagram of a parity disk data repair device provided by the present application. The parity disk data repair device may include:
[0147] Determination module 1, configured to determine the parity disk corresponding to the diagonal parity chain in the target redundant array;
[0148] A grouping module 2, configured to group all target data blocks corresponding to each check block in the check disk to obtain data block groups; wherein, all target data blocks in each data block group belong to the same data disk;
[0149] A first calculation module 3, configured to, for each data block group, calculate all target data blocks in the data block group by using the data disk corresponding to the data block group to obtain an initial check value corresponding to the data block group;
[0150] A second calculation module 4, configured to send the initial check values corresponding to the data block groups to the check disk, so as to calculate the initial check values by using the check disk to obtain a check value corresponding to the check block;
[0151] A combination module 5, configured to obtain recovery data of the check disk based on the check values corresponding to all check blocks, and complete data repair of the check disk.
[0152] It can be seen that for the check disk data repair device provided in the embodiment of the present application, when recovering data of the check disk corresponding to the diagonal check chain in the target redundant array, for each check block in the check disk, after determining each target data block corresponding to the check block, the stored data in each target data block is not directly sent to the check disk for data recovery. Instead, the target data blocks are first grouped according to the data disks to which the target data blocks belong, ensuring that all target data blocks in each data block group belong to the same data disk. Then, the computing performance of the data disk is fully utilized to perform an initial calculation on the data block group corresponding to each data disk to obtain an initial check value corresponding to each data block group. Finally, the initial check values corresponding to the data block groups are sent to the check disk for calculation to obtain the check value of the current check block, and so on, to obtain the check values of all check blocks in the check disk, and complete the check disk data recovery. It can be seen that this technical solution first performs a preliminary calculation of the check value by using the computing performance of the data disk, and then uses the computing performance of the check disk to implement the final calculation of the check value, effectively reducing the amount of data sent to the check disk, thereby effectively reducing the data transmission bandwidth, and thus improving the check disk data recovery efficiency. Therefore, this technical solution can achieve faster and more efficient check disk data recovery, effectively ensuring the device performance.
[0153] In an embodiment of the present application, the above-mentioned grouping module 2 may include:
[0154] A first determination unit, configured to determine each first data block corresponding to the adjustment factor in the target redundant array;
[0155] A second determination unit, configured to, for each check block in the check disk, determine each second data block corresponding to the check block except the adjustment factor;
[0156] Combination unit, used to use each first data block and each second data block as all target data blocks corresponding to the check block;
[0157] Grouping unit, used to group all target data blocks corresponding to the check block to obtain each data block group corresponding to the check block.
[0158] In an embodiment of the present application, the above grouping unit may specifically be used to, for each target data block corresponding to the check block, determine the arrangement column number of the target data block in the target redundant array; for all target data blocks corresponding to the check block, combine the target data blocks with the same arrangement column number into a data block group to obtain each data block group corresponding to the check block.
[0159] In an embodiment of the present application, the above first calculation module 3 may specifically be used to, for each data block group, determine the valid data stored in each target data block in the data block group; use the data disk corresponding to the data block group to perform an exclusive OR operation on the valid data stored in each target data block in the data block group to obtain the initial check value corresponding to the data block group;
[0160] Correspondingly, the above second calculation module 4 may specifically be used to send the initial check values corresponding to each data block group to the check disk to use the check disk to perform an exclusive OR operation on each initial check value to obtain the check value corresponding to the check block.
[0161] In an embodiment of the present application, the check disk data repair device may further include a judgment module, used to determine the current repair mode after determining the check disk corresponding to the diagonal check chain in the above target redundant array; the repair mode includes a normal repair mode and a fast repair mode; when the current repair mode is the normal repair mode, for each check block in the check disk, use the check disk to calculate all target data blocks corresponding to the check block to obtain the check value corresponding to the check block, and based on the check values corresponding to all check blocks, obtain the recovery data of the check disk to complete the data repair of the check disk; when the current repair mode is the fast repair mode, perform the step of grouping all target data blocks corresponding to each check block in the check disk to obtain each data block group.
[0162] In an embodiment of the present application, the above judgment module may specifically be used to, for each check block in the check disk, determine all target data blocks corresponding to the check block; send the valid data stored in all target data blocks to the check disk to use the check disk to perform an exclusive OR operation on all valid data to obtain the check value corresponding to the check block.
[0163] In one embodiment of the present application, the check disk data repair device may further include a repair module based on a row check chain, configured to determine a target check disk corresponding to the row check chain in the target redundant array; for each target check block in the target check disk, determine the respective data blocks corresponding to the target check block; calculate the respective data blocks corresponding to the target check block by using the target check disk to obtain a target check value corresponding to the target check block; and obtain recovery data of the target check disk based on the target check values corresponding to all the target check blocks, thereby completing the data repair of the target check disk.
[0164] For the introduction of the device provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate herein.
[0165] Embodiments of the present application provide an electronic device.
[0166] Please refer to Figure 9 , Figure 9 which is a schematic structural diagram of an electronic device provided by the present application. The electronic device may include:
[0167] A memory 11 for storing a computer program;
[0168] A processor 10, configured to implement the steps of any of the above check disk data repair methods when executing the computer program.
[0169] As Figure 9 shown, which is a schematic structural diagram of the composition of the electronic device. The electronic device may include: a processor 10, a memory 11, a communication interface 12, and a communication bus 13. The processor 10, the memory 11, and the communication interface 12 all complete communication with each other through the communication bus 13.
[0170] In the embodiments of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array, or other programmable logic devices, etc.
[0171] The processor 10 may call the program stored in the memory 11. Specifically, the processor 10 may execute the operations in the embodiments of the check disk data repair method.
[0172] The memory 11 is used to store one or more programs. The program may include program code, and the program code includes computer operation instructions. In the embodiments of the present application, the memory 11 stores at least a program for implementing the following functions:
[0173] Determine the check disk corresponding to the diagonal check chain in the target redundant array;
[0174] For each parity block in the parity disk, group all the target data blocks corresponding to the parity block to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk.
[0175] For each data block group, use the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain the initial parity value corresponding to the data block group.
[0176] Send the initial parity values corresponding to each data block group to the parity disk to calculate each initial parity value by using the parity disk to obtain the parity value corresponding to the parity block.
[0177] Obtain the recovery data of the parity disk based on the parity values corresponding to all parity blocks to complete the data repair of the parity disk.
[0178] In a possible implementation, the memory 11 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function, etc.; the data storage area may store the data created during the use process.
[0179] In addition, the memory 11 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one magnetic disk storage device or other volatile solid-state storage devices.
[0180] The communication interface 12 may be an interface of a communication module for connecting to other devices or systems.
[0181] Of course, it should be noted that Figure 9 the shown structure does not constitute a limitation on the electronic device in the embodiments of the present application. In actual applications, the electronic device may include more or fewer components than Figure 9 the shown ones, or combine some components.
[0182] The embodiments of the present application provide a computer-readable storage medium.
[0183] The computer program stored on the computer-readable storage medium provided by the embodiments of the present application can implement the steps of any of the above parity disk data repair methods when executed by a processor.
[0184] Among them, the computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or a data center that integrates one or more available media. For example, it may be various media that can store computer program codes, such as magnetic media (such as floppy disks, hard disks, magnetic tapes, etc.), optical media (such as DVDs), or semiconductor media (such as solid-state hard drives).
[0185] For the introduction of the computer-readable storage medium provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0186] The embodiments of the present application provide a computer program product.
[0187] The computer program product provided by the embodiments of the present application includes computer programs / instructions, and when the computer programs / instructions are executed by a processor, the steps of any one of the above data repair methods for verification disks can be implemented.
[0188] Specifically, in the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product.
[0189] Among them, the computer program product can include one or more computer programs / instructions. When the computer programs / instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application can be generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired manner (such as coaxial cable, optical fiber, digital subscriber line, etc.) or a wireless manner (such as infrared, wireless, microwave, etc.).
[0190] For the introduction of the computer program product provided in the embodiments of the present application, please refer to the above method embodiments, and the present application will not elaborate here.
[0191] The various embodiments in the specification are described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other. For the devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
[0192] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0193] The steps of the methods or algorithms described in combination with the embodiments disclosed herein can be directly implemented by hardware, software modules executed by a processor, or a combination of the two. The software modules can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium well-known in the technical field.
[0194] The technical solutions provided in this application have been introduced in detail above. Specific examples are used herein to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of this application.
Claims
1. A method for repairing check disk data, characterized in that, Including: Determine the parity disk corresponding to the diagonal parity chain in the target redundant array; For each parity block in the parity disk, group all the target data blocks corresponding to the parity block to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk; For each data block group, use the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain the initial parity value corresponding to the data block group; Send the initial parity values corresponding to the data block groups to the parity disk to calculate the initial parity values by using the parity disk to obtain the parity value corresponding to the parity block; Obtain the recovery data of the parity disk based on the parity values corresponding to all the parity blocks, and complete the data repair of the parity disk.
2. The method for repairing check disk data according to claim 1, wherein, For each parity block in the parity disk, grouping all the target data blocks corresponding to the parity block to obtain each data block group includes: Determine each first data block corresponding to the adjustment factor in the target redundant array; For each parity block in the parity disk, determine each second data block corresponding to the parity block except the adjustment factor; Use each first data block and each second data block as all the target data blocks corresponding to the parity block; Group all the target data blocks corresponding to the parity block to obtain each data block group corresponding to the parity block.
3. The method for repairing check disk data according to claim 2, wherein, Grouping all the target data blocks corresponding to the parity block to obtain each data block group corresponding to the parity block includes: For each target data block corresponding to the parity block, determine the arrangement column number of the target data block in the target redundant array; For all the target data blocks corresponding to the parity block, combine the target data blocks with the same arrangement column number into a data block group to obtain each data block group corresponding to the parity block.
4. The method for repairing check disk data according to claim 1, wherein For each data block group, using the data disk corresponding to the data block group to calculate all the target data blocks in the data block group to obtain the initial parity value corresponding to the data block group includes: For each data block group, determine the valid data stored in each target data block in the data block group; Use the data disk corresponding to the data block group to perform an exclusive OR operation on the valid data stored in each target data block in the data block group to obtain the initial parity value corresponding to the data block group; Correspondingly, sending the initial parity values corresponding to the data block groups to the parity disk to calculate the initial parity values by using the parity disk to obtain the parity value corresponding to the parity block includes: Send the initial parity values corresponding to the data block groups to the parity disk to perform the exclusive OR operation on the initial parity values by using the parity disk to obtain the parity value corresponding to the parity block.
5. The method for repairing check disk data according to any one of claims 1 to 4, characterized in that After determining the parity disk corresponding to the diagonal parity chain in the target redundant array, it further includes: Determine the current repair mode; the repair mode includes a normal repair mode and a quick repair mode; When the current repair mode is the normal repair mode, for each check block in the check disk, use the check disk to calculate all target data blocks corresponding to the check block to obtain the check value corresponding to the check block, and obtain the recovery data of the check disk based on the check values corresponding to all the check blocks, completing the data repair of the check disk; When the current repair mode is the quick repair mode, execute the step of grouping all target data blocks corresponding to the check block for each check block in the check disk to obtain each data block group.
6. The method for repairing check disk data according to claim 5, wherein, For each check block in the check disk, using the check disk to calculate all target data blocks corresponding to the check block to obtain the check value corresponding to the check block includes: For each check block in the check disk, determine all the target data blocks corresponding to the check block; Send the valid data stored in all the target data blocks to the check disk to use the check disk to perform an exclusive OR operation on all the valid data to obtain the check value corresponding to the check block.
7. The method for repairing check disk data according to claim 1, wherein Further included: Determine the target check disk corresponding to the row check chain in the target redundant array; For each target check block in the target check disk, determine each data block corresponding to the target check block; Use the target check disk to calculate each data block corresponding to the target check block to obtain the target check value corresponding to the target check block; Obtain the recovery data of the target check disk based on the target check values corresponding to all the target check blocks, completing the data repair of the target check disk.
8. A check disk data repair device, characterized in that, Included: A determination module, configured to determine the check disk corresponding to the diagonal check chain in the target redundant array; A grouping module, configured to group all target data blocks corresponding to the check block for each check block in the check disk to obtain each data block group; wherein, all the target data blocks in each data block group belong to the same data disk; A first calculation module, configured to calculate all target data blocks in the data block group using the data disk corresponding to the data block group for each data block group to obtain the initial check value corresponding to the data block group; A second calculation module, configured to send the initial check values corresponding to each data block group to the check disk to use the check disk to calculate each initial check value to obtain the check value corresponding to the check block; A combination module, configured to obtain the recovery data of the check disk based on the check values corresponding to all the check blocks, completing the data repair of the check disk.
9. An electronic device, characterized in that, Included: A memory, configured to store a computer program; A processor, configured to implement the steps of the check disk data repair method according to any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, it implements the steps of the check disk data repair method according to any one of claims 1 to 7.
Citation Information
Cited By
Abnormal data processing method and device, storage medium and electronic equipment
CN120723520A