Data recovery method and device, electronic equipment, medium and program product

By splitting the source file into a data block matrix and generating verification data, the problem of large storage space occupied by backup data is solved, achieving efficient data recovery and storage space optimization.

CN115080308BActive Publication Date: 2026-01-13BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210698496.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-20
Publication Date
2026-01-13
Estimated Expiration
2042-06-20

AI Technical Summary

Technical Problem

Existing technologies require a large amount of storage space when storing backup data, especially for large text data, resulting in significant storage space loss.

Method used

The source file is cut into a data block matrix. Verification data is generated by encoding and verifying the data block matrix. Abnormal data blocks are restored using backup data with a preset compression ratio, thereby reducing the storage space occupied by the backup data.

Benefits of technology

By controlling the granularity of the data block matrix and the number of data blocks in each group, the preset compression ratio can be increased, the storage space occupied by backup data can be reduced, and a high probability of data recovery can be achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080308B_ABST
    Figure CN115080308B_ABST
Patent Text Reader

Abstract

The application relates to a data recovery method and device, electronic equipment, medium and program product, and applies to the technical field of data storage. The method comprises the following steps: when a source file is damaged, backup data corresponding to the source file and having a preset compression ratio is acquired, wherein the backup data comprises first check data corresponding to a plurality of groups of data blocks in a first data block matrix, and the first data block matrix is generated by cutting the source file; the data blocks in the first data block matrix are re-encoded and checked to obtain second check data corresponding to each first check data; the difference between the first check data and the second check data corresponding to the first check data is used to determine abnormal data blocks in the first data block matrix; and the abnormal data blocks are recovered according to the first check data and the second check data corresponding to the abnormal data blocks. The application can reduce the storage space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage technology, and in particular to a data recovery method, apparatus, electronic device, medium, and program product. Background Technology

[0002] Currently, when storing data, it's common practice to simultaneously store corresponding backup data to enable recovery in case of data loss or corruption. Related technologies include using equivalent backup or compressed backup schemes for overwrite recovery. Assuming a file size of 5GB, an equivalent backup requires 5GB of storage space for the file itself, plus an additional 5GB for the backup data. Alternatively, using lossless compression, with a compression ratio of 2:1, would require an additional 2.5GB for the backup data. It's clear that these methods require significant storage space for backup data, especially for large text data, resulting in substantial storage space loss. Summary of the Invention

[0003] To address the aforementioned technical problems, this application provides a data recovery method, apparatus, electronic device, medium, and program product.

[0004] According to a first aspect of this application, a data recovery method is provided, comprising:

[0005] When the source file is corrupted, backup data with a preset compression ratio corresponding to the source file is obtained. The backup data includes: first verification data corresponding to multiple sets of data blocks in the first data block matrix. The first data block matrix is ​​generated by cutting the source file.

[0006] The data blocks in the first data block matrix are re-encoded and verified to obtain second verification data corresponding to each of the first verification data.

[0007] Based on the difference between the first verification data and the second verification data corresponding to the first verification data, the abnormal data blocks in the first data block matrix are determined;

[0008] The abnormal data block is recovered based on the first and second verification data corresponding to it.

[0009] Optionally, before obtaining the backup data of the source file, the method includes:

[0010] Obtain the source file and divide the source file into a first data block matrix;

[0011] Each data block in the first data block matrix is ​​encoded and verified to obtain the verification data corresponding to each data block.

[0012] The first verification data is obtained based on the verification data corresponding to each group of data blocks in the first data block matrix. The first verification data is then used as backup data and stored.

[0013] Optionally, the first data block matrix is ​​an N×N matrix, and the preset compression ratio is N:2, where N is a power of 2.

[0014] The step of obtaining the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix includes:

[0015] The sum of the check data of the data blocks contained in a single row of the first data block matrix is ​​determined as the first check data; and

[0016] The sum of the verification data of the data blocks contained in a single column of the first data block matrix is ​​determined as the first verification data.

[0017] Optionally, determining the abnormal data block in the first data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data includes:

[0018] If the row difference between the first verification data corresponding to any row of data block in the first data block matrix and the second verification data corresponding to that row of data block is not equal to 0, it is determined that there is an abnormal data block in that row of data block.

[0019] If the column difference between the first verification data corresponding to any column data block in the first data block matrix and the second verification data corresponding to that column data block is not equal to 0, it is determined that there is an abnormal data block in that column data block.

[0020] Abnormal data blocks are determined based on the row difference value corresponding to each row of data blocks and the column difference value corresponding to each column of data blocks in the first data block matrix.

[0021] Optionally, the step of recovering the abnormal data block based on the first and second verification data corresponding to the abnormal data block includes:

[0022] If the number of abnormal data blocks is less than or equal to a preset number, the abnormal data blocks are recovered according to the first and second verification data corresponding to the abnormal data blocks.

[0023] If the number of abnormal data blocks is greater than the preset number, it is determined whether to recover the abnormal data blocks based on their position distribution in the first data block matrix.

[0024] Optionally, determining whether to recover the abnormal data blocks based on their position distribution in the first data block matrix includes:

[0025] If there is a first abnormal data block in the first data block matrix, the first abnormal data block is recovered according to the first and second verification data corresponding to the data block in the row where the first abnormal data block is located; wherein, the first abnormal data block is the only abnormal data block in the row where the first abnormal data block is located.

[0026] If a second abnormal data block exists in the first data block matrix, the second abnormal data block is recovered based on the first and second verification data corresponding to the data block in the column where the second abnormal data block is located; wherein, the second abnormal data block is the only abnormal data block in the column where the second abnormal data block is located;

[0027] After recovering the first abnormal data block and the second abnormal data block, if there are at least two remaining abnormal data blocks in any row of the first data block matrix and at least two remaining abnormal data blocks in any column of the first data block matrix, then it is determined that the remaining abnormal data blocks cannot be recovered.

[0028] Optionally, the backup data further includes: third verification data corresponding to multiple sets of data blocks in the second data block matrix, wherein the second data block matrix is ​​obtained by transforming the first data block matrix;

[0029] The method further includes:

[0030] After obtaining the backup data of the source file, the data blocks in the second data block matrix are re-encoded and verified to obtain the fourth verification data corresponding to each of the third verification data.

[0031] The step of determining the abnormal data block in the first data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data includes:

[0032] Based on the difference between the first verification data and the second verification data corresponding to the first verification data, and the difference between the third verification data and the fourth verification data corresponding to the third verification data, abnormal data blocks in the first data block matrix and the second data block matrix are determined;

[0033] The step of recovering the abnormal data block based on the first and second verification data corresponding to the abnormal data block includes:

[0034] Based on the first and second verification data corresponding to the abnormal data blocks in the first data block matrix, and the third and fourth verification data corresponding to the abnormal data blocks in the second data block matrix, the abnormal data blocks in the first data block matrix and the second data block matrix are recovered.

[0035] Optionally, the second data block matrix is ​​obtained by offsetting the data blocks in the first data block matrix; or

[0036] The second data block matrix is ​​obtained by adjusting the number of rows and columns of the first data block matrix.

[0037] Optionally, the first data block matrix is ​​a 256×256 data block matrix;

[0038] The step of encoding and verifying each data block in the first data block matrix to obtain verification data corresponding to each data block includes:

[0039] Using a 16-bit cyclic redundancy check algorithm, each data block in the first data block matrix is ​​encoded and checked to obtain the check data corresponding to each data block.

[0040] According to a second aspect of this application, a data recovery apparatus is provided, comprising:

[0041] The backup data acquisition module is used to acquire backup data with a preset compression ratio corresponding to the source file when the source file is corrupted. The backup data includes: first verification data corresponding to multiple sets of data blocks in the first data block matrix. The first data block matrix is ​​generated by cutting the source file.

[0042] The encoding verification module is used to re-encode and verify the data blocks in the first data block matrix to obtain second verification data corresponding to each of the first verification data.

[0043] An abnormal data block determination module is used to determine abnormal data blocks in the first data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data.

[0044] The data block repair module is used to recover the abnormal data block based on the first and second verification data corresponding to the abnormal data block.

[0045] Optionally, the data recovery device further includes:

[0046] The source file splitting module is used to acquire the source file and split the source file into a first data block matrix;

[0047] The encoding verification module is used to perform encoding verification on each data block in the first data block matrix to obtain the verification data corresponding to each data block.

[0048] The backup data storage module is used to obtain the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix, use the first verification data as backup data, and store the backup data.

[0049] Optionally, the first data block matrix is ​​an N×N matrix, and the preset compression ratio is N:2, where N is a power of 2.

[0050] The backup data storage module is specifically used to obtain the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix through the following steps:

[0051] The sum of the check data of the data blocks contained in a single row of the first data block matrix is ​​determined as the first check data; and

[0052] The sum of the verification data of the data blocks contained in a single column of the first data block matrix is ​​determined as the first verification data.

[0053] Optionally, the abnormal data block determination module is specifically used to determine that an abnormal data block exists in any row of data blocks if the row difference between the first verification data corresponding to any row of data blocks in the first data block matrix and the second verification data corresponding to that row of data blocks is not equal to 0; to determine that an abnormal data block exists in any column of data blocks if the column difference between the first verification data corresponding to any column of data blocks in the first data block matrix and the second verification data corresponding to that column of data blocks is not equal to 0; and to determine abnormal data blocks based on the row difference between each row of data blocks and the column difference between each column of data blocks in the first data block matrix.

[0054] Optionally, the data block repair module is specifically used to recover the abnormal data blocks according to the first verification data and the second verification data corresponding to the abnormal data blocks if the number of abnormal data blocks is less than or equal to a preset number; and to determine whether to recover the abnormal data blocks according to the position distribution of the abnormal data blocks in the first data block matrix if the number of abnormal data blocks is greater than the preset number.

[0055] Optionally, the data block repair module is specifically used to determine whether to recover the abnormal data blocks based on their position distribution in the first data block matrix through the following steps:

[0056] If there is a first abnormal data block in the first data block matrix, the first abnormal data block is recovered according to the first and second verification data corresponding to the data block in the row where the first abnormal data block is located; wherein, the first abnormal data block is the only abnormal data block in the row where the first abnormal data block is located.

[0057] If a second abnormal data block exists in the first data block matrix, the second abnormal data block is recovered based on the first and second verification data corresponding to the data block in the column where the second abnormal data block is located; wherein, the second abnormal data block is the only abnormal data block in the column where the second abnormal data block is located;

[0058] After recovering the first abnormal data block and the second abnormal data block, if there are at least two remaining abnormal data blocks in any row of the first data block matrix and at least two remaining abnormal data blocks in any column of the first data block matrix, then it is determined that the remaining abnormal data blocks cannot be recovered.

[0059] Optionally, the backup data further includes: third verification data corresponding to multiple sets of data blocks in the second data block matrix, wherein the second data block matrix is ​​obtained by transforming the first data block matrix;

[0060] The encoding verification module is further configured to re-encode and verify the data blocks in the second data block matrix after obtaining the backup data of the source file, so as to obtain the fourth verification data corresponding to each of the third verification data.

[0061] The abnormal data block determination module is specifically used to determine abnormal data blocks in the first data block matrix and the second data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data, and the difference between the third verification data and the fourth verification data corresponding to the third verification data.

[0062] The data block repair module is specifically used to recover abnormal data blocks in the first data block matrix and the second data block matrix based on the first and second verification data corresponding to the abnormal data blocks in the first data block matrix, and the third and fourth verification data corresponding to the abnormal data blocks in the second data block matrix.

[0063] Optionally, the second data block matrix is ​​obtained by offsetting the data blocks in the first data block matrix; or

[0064] The second data block matrix is ​​obtained by adjusting the number of rows and columns of the first data block matrix.

[0065] Optionally, the first data block matrix is ​​a 256×256 data block matrix;

[0066] The encoding verification module is specifically used to perform encoding verification on each data block in the first data block matrix using a 16-bit cyclic redundancy check algorithm to obtain the verification data corresponding to each data block.

[0067] According to a third aspect of this application, an electronic device is provided, comprising: a processor configured to execute a computer program stored in a memory, wherein the computer program, when executed by the processor, implements the method described in the first aspect.

[0068] According to a fourth aspect of this application, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0069] According to a fifth aspect of this application, a computer program product is provided that, when the computer program product is run on a computer, causes the computer to perform the method described in the first aspect.

[0070] The technical solution provided in this application has the following advantages compared with the prior art:

[0071] When backing up the source file, it can be divided into a first data block matrix, which consists of multiple data blocks. The backup data includes first checksums corresponding to each group of data blocks in the first data block matrix. The preset compression ratio of the backup data is the ratio of the source file to the backup file. When the source file is corrupted, the corresponding backup data is retrieved. The data blocks in the first data block matrix are re-encoded and checked to obtain second checksums corresponding to each first checksum. The difference between the first checksum and the corresponding second checksum is used to identify abnormal data blocks in the first data block matrix. Then, the abnormal data blocks are recovered based on their corresponding first and second checksums. Since each group of data blocks corresponds to one set of first checksums, the preset compression ratio can be increased by controlling the number of data blocks in each group, thereby reducing the storage space occupied by the backup data. Attached Figure Description

[0072] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0073] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0074] Figure 1 This is a flowchart of a data recovery method in an embodiment of this application;

[0075] Figure 2 This is a flowchart of a method for generating backup data in an embodiment of this application;

[0076] Figure 3 This is a schematic diagram of a first data block matrix in an embodiment of this application;

[0077] Figure 4 This is yet another schematic diagram of the first data block matrix in the embodiments of this application;

[0078] Figure 5 This is yet another schematic diagram of the first data block matrix in the embodiments of this application;

[0079] Figure 6 This is yet another schematic diagram of the first data block matrix in the embodiments of this application;

[0080] Figure 7 This is another flowchart of the data recovery method in the embodiments of this application;

[0081] Figure 8 This is yet another schematic diagram of the first data block matrix in the embodiments of this application;

[0082] Figure 9 This is yet another schematic diagram of the first data block matrix in the embodiments of this application;

[0083] Figure 10 This is a schematic diagram of a data recovery device in one embodiment of this application;

[0084] Figure 11 This is a schematic diagram of the structure of an electronic device in an embodiment of this application. Detailed Implementation

[0085] To better understand the above-mentioned objectives, features, and advantages of this application, the solution of this application will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described in these embodiments can be combined with each other.

[0086] Many specific details are set forth in the following description in order to provide a full understanding of this application, but this application may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of this application, and not all embodiments.

[0087] In data recovery scenarios, for large data files, such as image files or multimedia files, corresponding backup data can be stored using equivalent backups or compressed backups to enable recovery in case of data corruption. However, this method consumes a significant amount of storage space. Alternatively, for image files, they can be downloaded again over the network to overwrite the original data for recovery. However, due to image processing issues, this may result in the device failing to boot. Typically, a network connection is required during the boot process, but considering device security and the complexity of device driver support, most digital products do not support network downloads at this stage.

[0088] To address the aforementioned problems, embodiments of this application provide a data recovery method, apparatus, electronic device, medium, and program product, which can reduce the storage space occupied by backup data and reduce the computational overhead of the central processing unit. The executing entity of these embodiments is an electronic device storing data, such as a smartphone, tablet computer, head-mounted device, or drone.

[0089] See Figure 1 , Figure 1 This is a flowchart of a data recovery method in an embodiment of this application, which may include the following steps:

[0090] Step S110: When the source file is corrupted, obtain the backup data corresponding to the source file with a preset compression ratio. The backup data includes: first verification data corresponding to multiple sets of data blocks in the first data block matrix. The first data block matrix is ​​generated by cutting the source file.

[0091] Source files are files stored on electronic devices, and can include large data files, i.e., files that occupy a large amount of storage space, such as image files and multimedia files. For each source file, corresponding backup data can be stored when storing the source file, so that the source file can be recovered if it is corrupted. This will be explained using a single source file as an example.

[0092] In this embodiment, the source file can be divided into a data block matrix of a preset size, namely a first data block matrix. This first data block matrix is ​​a matrix composed of multiple data blocks, and the set of data blocks in the first data block matrix constitutes the source file. Each data block can have corresponding checksum data. If the checksum data corresponding to each data block is stored as backup data, the goal of reducing the storage space occupied by the backup data cannot be achieved. Therefore, multiple data blocks can be grouped together, with each group of data blocks corresponding to one set of checksum data, namely the first checksum data. The first checksum data corresponding to each of the multiple groups of data blocks is then used as backup data.

[0093] See Figure 2 , Figure 2 This is a flowchart of a method for generating backup data in an embodiment of this application, which may include the following steps:

[0094] Step S210: Obtain the source file and cut the source file into a first data block matrix.

[0095] Step S220: Encode and verify each data block in the first data block matrix to obtain the verification data corresponding to each data block.

[0096] The first data block matrix can be an N×N matrix, where N is a power of 2. A preset encoding and verification algorithm can be used to encode and verify each data block, obtaining the corresponding verification data. For example, the CRC (Cyclic Redundancy Check) algorithm can be used to encode and verify each data block, obtaining the corresponding verification data.

[0097] It should be noted that the granularity (i.e., the size of N) of the first data block matrix can also differ depending on the preset encoding and verification algorithm. Taking a 64-bit computer as an example, byte alignment can be used. For instance, if CRC16, CRC32, or CRC64 algorithms are used, the corresponding granularity is 2^N / N. 8 ×2 8 2 24 ×2 24 2 48 ×2 48 .

[0098] Step S230: Obtain the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix, use the first verification data as backup data, and store the backup data.

[0099] As mentioned earlier, to reduce the storage space occupied by backup data, each group of data blocks (i.e., multiple data blocks) can correspond to a first checksum. In some embodiments, each row of data blocks can be considered as a group of data blocks, and each column of data blocks can be considered as a group of data blocks. The sum of the checksums of the data blocks contained in a single row of the first data block matrix is ​​determined as the first checksum, that is, the sum of the checksums of the data blocks in each row of the first data block matrix is ​​a first checksum; and the sum of the checksums of the data blocks contained in a single column of the first data block matrix is ​​determined as the first checksum, that is, the sum of the checksums of the data blocks in each column of the first data block matrix is ​​a first checksum.

[0100] See Figure 3 , Figure 3 This is a schematic diagram of a first data block matrix in an embodiment of this application. The source file is divided into an 8×8 first data block matrix. Each data block has corresponding coordinates, and the verification data corresponding to each data block can be obtained through a preset encoding verification algorithm.

[0101] For example, the checksum data of a data block with coordinates (x0, y0) can be represented as CRC1. x0y0 The checksum data of the data block with coordinates (x1, y0) can be represented as CRC1. x1y0 .

[0102] The first checksum of the X2 column data block can be represented as:

[0103] X2_CRC1=CRC1 x2y0 +CRC1 x2y1 +CRC1 x2y2 +CRC1 x2y3 +CRC1 x2y4 +CRC1 x2y5 +CRC1 x2y6 +CRC 1x2y7 ;

[0104] The first checksum of the Y6 row data block can be represented as:

[0105] Y6_CRC1=CRC1 x0y6 +CRC1 x1y6 +CRC1 x2y6 +CRC1 x3y6 +CRC1 x4y6 +CRC1 x5y6 +CRC1 x6y6 +CRC1 x7y6 .

[0106] For an 8×8 first data block matrix containing 64 data blocks, when storing backup data as described above, the first checksum includes: the first checksum corresponding to each of the 8 rows of data blocks and the first checksum corresponding to each of the 8 columns of data blocks, for a total of 16 first checksums. Since the size of a single data block is the same as the size of a single first checksum, the ratio of source file to backup data is 64:16, i.e., a preset compression ratio of 4:1. If the first data block matrix is ​​an N×N matrix, where N is a power of 2, then the preset compression ratio for backup using the above method is N×N:N×2, i.e., N:2. It can be seen that the larger N is, the larger the preset compression ratio and the smaller the storage space occupied by the backup data.

[0107] It should be noted that the method of dividing each group of data blocks is not limited to this. For example, data blocks can also be divided diagonally, grouping multiple data blocks located on the same straight line as a group. Of course, the number of data blocks in each group will be different in this method.

[0108] Step S120: Re-encode and verify the data blocks in the first data block matrix to obtain the second verification data corresponding to each first verification data.

[0109] Understandably, the first verification data stored in the backup data is the verification data from when the source file was not corrupted. However, after the source file becomes corrupted, at least one data block in the first data block matrix is ​​corrupted. Therefore, the data blocks in the first data block matrix can be re-encoded and verified using the same method as generating the backup data to obtain the encoded data corresponding to each data block. Further, the second verification data is generated.

[0110] For example, if the first checksum is the sum of the checksums of each row of data blocks and the sum of the checksums of each column of data blocks, then the second checksum is the sum of the checksums of each row of data blocks and the sum of the checksums of each column of data blocks after the source file has been corrupted.

[0111] Step S130: Determine the abnormal data block in the first data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data.

[0112] For any set of data blocks, if every data block in the set is intact, then the first checksum and the second checksum corresponding to that set are equal. Otherwise, if any data block in the set is corrupted, the first checksum will change, meaning the recalculated second checksum will not be equal to the first checksum. Therefore, the abnormal data blocks can be identified based on the difference between each first checksum and its corresponding second checksum.

[0113] In some embodiments, when each row data block is considered as a group of data blocks, and each column data block is considered as a group of data blocks, if the row difference between the first check data corresponding to any row data block and the second check data corresponding to that row data block in the first data block matrix is ​​not equal to 0, it is determined that there is an abnormal data block in that row data block. If the column difference between the first check data corresponding to any column data block and the second check data corresponding to that column data block in the first data block matrix is ​​not equal to 0, it is determined that there is an abnormal data block in that column data block. Abnormal data blocks are determined based on the row differences corresponding to each row data block and the column differences corresponding to each column data block in the first data block matrix.

[0114] For example, Figure 3 As shown, assuming a data block at coordinates (x2, y6), the first checksum of the data block in column X2 is X2_CRC1, and the first checksum of the data block in row Y6 is Y6_CRC1. After the source file is corrupted, the second checksum of the data block in column X2 becomes X2_CRC2, and the second checksum of the data block in row Y6 becomes Y6_CRC2. Since X2_CRC1 ≠ X2_CRC2 and Y6_CRC1 ≠ Y6_CRC2, and the first and second checksums of the remaining rows and columns are equal, it can be determined that the data block at coordinates (x2, y6) is corrupted, while the remaining data blocks are not corrupted.

[0115] The difference between X2_CRC2 and X2_CRC1 is represented as Δx, and the difference between Y6_CRC2 and Y6_CRC1 is represented as Δy. Since only one data block is corrupted, that is, the check data of the data block is changed, therefore Δx = Δy.

[0116] For scenarios where only one data block is corrupted, the abnormal data block can be identified by comparing whether the first checksum and the second checksum are equal. However, for scenarios where multiple data blocks are corrupted, in addition to comparing the first checksum and the second checksum, the difference between the first checksum and the corresponding second checksum can be used to further identify the abnormal data block.

[0117] It should be noted that in some cases, when multiple data blocks are corrupted, even after comparing whether the first check data and the second check data are equal, further combining the difference between the first check data and the corresponding second check data may not be able to identify the abnormal data block.

[0118] For example, see Figure 4 , Figure 4 This is another schematic diagram of the first data block matrix in an embodiment of this application. By comparing the first check data and the second check data, we can obtain:

[0119] X2_CRC1 ≠ X2_CRC2;

[0120] X5_CRC1 ≠ X5_CRC2;

[0121] Y2_CRC1 ≠ Y2_CRC2;

[0122] Y3_CRC1 ≠ Y3_CRC2;

[0123] Y6_CRC1≠Y6_CRC2.

[0124] Based on the above information, it can be determined that columns X2 and X5, rows Y2, Y3, and Y6 contain anomalous data blocks, meaning the possible number of anomalous data blocks is 6 or less. Assuming there are 6 anomalous data blocks, the actual anomalous data blocks are determined by calculating the change value of the checksum for each anomalous data block. If the change value is 0, it indicates that the anomalous data block is not actually corrupted; if the change value is not 0, it indicates that the anomalous data block is actually corrupted, meaning it is a true anomalous data block.

[0125] Further, based on the column differences between X2_CRC2 and X2_CRC1, the column differences between X5_CRC2 and X5_CRC1, the row differences between Y2_CRC2 and Y2_CRC1, the row differences between Y3_CRC2 and Y3_CRC1, and the row differences between Y6_CRC2 and Y6_CRC1, a system of equations (containing 5 equations) can be constructed. However, there are 6 unknowns to solve, making it impossible to solve and thus impossible to identify the abnormal data block. At this point, the following... Figure 6 The method described in this embodiment identifies abnormal data blocks.

[0126] Step S140: Recover the abnormal data block according to the first and second verification data corresponding to the abnormal data block.

[0127] Once the abnormal data block is identified, it can be recovered directly using the corresponding first and second checksums through compensation. For example, Figure 3 The data block with coordinates (x2, y6) is an aberration data block, where X2_CRC1 ≠ X2_CRC2, Y6_CRC1 ≠ Y6_CRC2, and Δx = Δy. If the checksum obtained by re-encoding and verifying this aberration data block is CRC2... x2y6 After compensation, the checksum of the abnormal data block is determined to be CRC2. x2y6 -Δx (or Δy).

[0128] Understandably, when data blocks are grouped by row or column, if any row (or column) in the first data block matrix contains an anomalous data block, the above method can be used to recover that anomalous data block first. After recovering that anomalous data block, the method continues to select the unique anomalous data block in a row or column for recovery, until all anomalous data blocks have been recovered.

[0129] In some embodiments, if a first abnormal data block exists in the first data block matrix, the first abnormal data block is recovered based on the first and second check data corresponding to the data block in the row where the first abnormal data block is located; wherein, the first abnormal data block is the only abnormal data block in the row where the first abnormal data block is located. If a second abnormal data block exists in the first data block matrix, the second abnormal data block is recovered based on the first and second check data corresponding to the data block in the column where the second abnormal data block is located; wherein, the second abnormal data block is the only abnormal data block in the column where the second abnormal data block is located.

[0130] For example, such as Figure 4 As shown, assume the coordinates of the outlier data blocks are (x2, y3), (x2, y6), (x5, y6), and (x5, y2). There is one outlier data block in both row Y2 and row Y3; the data block with coordinates (x5, y2) and the data block with coordinates (x2, y3) are both the first outlier data blocks. There are two outlier data blocks in both columns X2 and X5, meaning there are no second outlier data blocks. Therefore, following the method described above, i.e. Figure 3 The data recovery method for the data block with coordinates (x2, y6) can begin by recovering the data blocks with coordinates (x2, y3) and (x5, y2). Then, an aberration data block is found in both columns X2 and X5, namely the data blocks with coordinates (x2, y6) and (x5, y6). Recovery can then proceed to these two aberration data blocks. At this point, the data recovery for the aforementioned four aberration data blocks is complete.

[0131] As can be seen, in the data recovery process, we can first recover the cases where there is a single abnormal data block in a row or column. Then, we can recover the cases where there are multiple abnormal data blocks in rows and columns, gradually converting the cases where there are multiple abnormal data blocks in rows and columns into the cases where there are a single abnormal data block in rows and columns, thereby completing the data recovery of all abnormal data blocks.

[0132] In some embodiments, if the number of abnormal data blocks is less than or equal to a preset number, the abnormal data blocks can be recovered directly based on the first and second check data corresponding to the abnormal data blocks. If the number of abnormal data blocks is greater than the preset number, it is determined whether to recover the abnormal data blocks based on their position distribution in the first data block matrix.

[0133] In this embodiment, when data blocks are grouped by row or column, the preset number can be 3. That is, if there are 3 abnormal data blocks, there will inevitably be a row or column containing only that one abnormal data block, thus data recovery for all abnormal data blocks can be completed. If there are 4 or more even-numbered abnormal data blocks, and if these even-numbered abnormal data blocks are symmetrically distributed, i.e., they form one or more rectangles, then it can be considered that recovery for these even-numbered abnormal data blocks is impossible.

[0134] See Figure 5 , Figure 5 This is another schematic diagram of the first data block matrix in an embodiment of this application. The first data block matrix contains four abnormal data blocks, which are symmetrically distributed. Since rows Y3 and Y6, as well as columns X2 and X5, each contain two abnormal data blocks, recovery cannot be performed using the method described above. Calculations show that the probability of the four abnormal data blocks forming a rectangle is:

[0135]

[0136] This probability is low, meaning the probability of no solution is low, while the probability of a solution is high.

[0137] Similarly, if the first data block matrix contains 6 or more even-numbered anomalous data blocks, and these 6 or more anomalous data blocks are symmetrically distributed, they can form one or more rectangles. In this case, there is also no solution, and the probability of having no solution is higher compared to the above 4 anomalous data blocks.

[0138] For a 3.5GB (3.5 × 1024 × 1024 × 1024 bytes) image file, in the event of data corruption, the size of the corrupted data is typically less than 100 bytes. Each byte stores an 8-bit unsigned number, with a value range of 0-255. It can be seen that the size of the corrupted data is much smaller than the size of the image file. If calculated using an 8 × 8 data block matrix, the number of anomalous data blocks will be relatively small. Given the relatively discrete distribution of these anomalous data blocks, there is a high probability of finding a solution. However, the lower the dispersion of the anomalous data blocks, the greater the probability of having no solution.

[0139] It's important to note that the larger the granularity of the first data block matrix, i.e., the larger N is, the higher the preset compression ratio and the smaller the storage space occupied by the backup data. However, a larger N also results in more finely divided source files, increasing the number of abnormal data blocks and thus raising the probability of no solution. Conversely, a smaller N results in a lower probability of no solution.

[0140] As mentioned earlier, if the CRC16, CRC32, or CRC64 algorithm is used, the corresponding granularity is 2. 8 ×2 8 2 24 ×2 24 2 48 ×2 48 The larger the granularity, the higher the probability of no solution. In some embodiments, to increase the probability of a solution, a 16-bit Cyclic Redundancy Check (CRC) algorithm can be used to encode and verify each data block in the first data block matrix, obtaining the check data corresponding to each data block. Accordingly, the first data block matrix can be a 256×256 data block matrix.

[0141] If the number of abnormal data blocks exceeds the preset number, in the above scenario, it can be determined directly from the position distribution of the abnormal data blocks in the first data block matrix that the abnormal data blocks cannot be recovered. In some scenarios, although the number of multiple abnormal data blocks is not even and they are not symmetrically distributed, if during the recovery process, the number of remaining abnormal data blocks to be recovered is 4 or more (an even number) and they are symmetrically distributed, then the abnormal data blocks cannot be recovered either.

[0142] Specifically, we can first recover the case where there is an abnormal data block in a row or column. If there is a first abnormal data block in the first data block matrix, we recover the first abnormal data block based on the first and second checksums corresponding to the data block in the row where the first abnormal data block is located. If there is a second abnormal data block in the first data block matrix, we recover the second abnormal data block based on the first and second checksums corresponding to the data block in the column where the second abnormal data block is located.

[0143] After recovering the first and second anomalous data blocks, if at least two remaining anomalous data blocks exist in any row and column of the first data block matrix, then it is determined that the remaining anomalous data blocks cannot be recovered. In other words, after recovering all recoverable anomalous data blocks, if the distribution of the remaining anomalous data blocks falls under the aforementioned symmetrical distribution scenario, then the remaining anomalous data blocks cannot be recovered. However, since the proportion of such unsolvable scenarios is relatively small, this application can achieve high-probability recovery.

[0144] The data recovery method of this application embodiment, when backing up a source file, can divide the source file into a first data block matrix, which consists of multiple data blocks. The backup data includes first verification data corresponding to multiple groups of data blocks in the first data block matrix. When the source file is corrupted, the corresponding backup data is obtained. By re-encoding and verifying the data blocks in the first data block matrix, second verification data corresponding to each first verification data is obtained. Based on the difference between the first verification data and the second verification data corresponding to the first verification data, abnormal data blocks in the first data block matrix are determined. Then, based on the first and second verification data corresponding to the abnormal data blocks, and combined with the positional distribution of the abnormal data blocks in the first data block matrix, the abnormal data blocks are recovered with a high probability. By controlling the granularity of the first data block matrix, the probability of recovering abnormal data blocks can be controlled. By controlling the granularity of the first data block matrix and the number of data blocks contained in each group of data blocks, the preset compression ratio can be increased, thereby reducing the storage space occupied by the backup data.

[0145] In the above Figure 1 In this embodiment, the source file can be recovered with a high probability using backup data. However, in some scenarios, data recovery may not be possible using the aforementioned backup data. For example... Figure 6 As shown, for the first data block matrix of 8×8, there are 4 abnormal data blocks. These 4 abnormal data blocks are not only symmetrically distributed, but also have low dispersion, so recovery is not possible.

[0146] To increase the probability of data recovery, more backup data can be stored. Consequently, the storage space occupied by the backup data will also increase, and the preset compression ratio will decrease.

[0147] See Figure 7 , Figure 7 This is another flowchart of the data recovery method in the embodiments of this application, which may include the following steps:

[0148] Step S710: When the source file is corrupted, obtain the backup data corresponding to the source file with a preset compression ratio.

[0149] In this embodiment, the backup data includes, in addition to the first verification data corresponding to multiple sets of data blocks in the first data block matrix, the backup data may also include third verification data corresponding to multiple sets of data blocks in the second data block matrix. The first data block matrix is ​​generated by splitting the source file, and the second data block matrix is ​​obtained by transforming the first data block matrix. The method for generating the third verification data is similar to the method for generating the first verification data; see [link to relevant documentation] for details. Figure 1 The method for generating the first verification data in the embodiment is sufficient and will not be described in detail here.

[0150] For a 256×256 first data block matrix, if only the first check data is backed up, the preset compression ratio is 128:1. If the third check data is backed up at the same time, the preset compression ratio will change to 64:1.

[0151] In some embodiments, the second data block matrix is ​​obtained by offsetting the data blocks in the first data block matrix. See also Figure 8 , Figure 8 This is another schematic diagram of the first data block matrix in an embodiment of this application. Figure 6 Compared to the first data block matrix shown, the second data block matrix retains the same number of rows and columns. The first data block matrix is ​​divided into two parts: the first four rows and the last four rows. The data blocks in the first four rows are offset, while the data blocks in the last four rows remain unchanged. Specifically, the first data block in the first row is moved to the end of the fourth row, and the remaining data blocks are shifted forward one position. It can be seen that after the offset processing, recovery can be performed using the backup data corresponding to the second data block matrix.

[0152] It should be noted that the method of offsetting the data blocks in the first data block matrix is ​​not limited to this. The upper part of the data block can be offset by multiple positions, or only the lower part of the data block can be offset, or both the upper and lower parts of the data block can be offset at the same time (the offset size can be different), etc. This application does not limit this.

[0153] Alternatively, the second data block matrix can be obtained by adjusting the number of rows and columns of the first data block matrix. See also Figure 9 , Figure 9 This is another schematic diagram of the first data block matrix in an embodiment of this application. Figure 6 Compared to the first data block matrix shown, the number of rows and columns in the second data block matrix has changed. It has been transformed from an 8×8 first data block matrix to a 4×16 second data block matrix. This means that rows 2, 4, 6, and 8 of the 8×8 first data block matrix are appended to rows 1, 3, 5, and 7, respectively. Alternatively, rows 5-8 can be appended directly to rows 1-4, or the 8×8 first data block matrix can be transformed into a 16×4 second data block matrix. This application does not limit the method of adjusting the number of rows and columns.

[0154] Step S720: Re-encode and verify the data blocks in the first data block matrix to obtain second verification data corresponding to each first verification data. Re-encode and verify the data blocks in the second data block matrix to obtain fourth verification data corresponding to each third verification data.

[0155] In this step, the data blocks in the second data block matrix are re-encoded and verified to obtain the fourth verification data corresponding to each third verification data. This process is similar to the process of re-encoding and verifying the data blocks in the first data block matrix to obtain the second verification data corresponding to each first verification data. See [link to details] for further information. Figure 1 The descriptions in the embodiments are sufficient and will not be repeated here.

[0156] Step S730: Based on the difference between the first verification data and the second verification data corresponding to the first verification data, and the difference between the third verification data and the fourth verification data corresponding to the third verification data, determine the abnormal data blocks in the first data block matrix and the second data block matrix.

[0157] exist Figure 1 In this embodiment, the difference between the first verification data and the corresponding second verification data may not be sufficient to identify abnormal data blocks in the first data block matrix. Therefore, given that the transformation relationship between the first and second data block matrices is known, further combining the difference between the third verification data and the corresponding fourth verification data can more probably identify abnormal data blocks in both the first and second data block matrices.

[0158] It should be noted that backing up the third checksum can increase the probability of identifying anomalous data blocks, but it may also fail to identify them. Of course, this probability is significantly lower compared to backing up only the first checksum.

[0159] Step S740: Recover the abnormal data blocks in the first data block matrix and the second data block matrix according to the first and second verification data corresponding to the abnormal data blocks in the first data block matrix, and the third and fourth verification data corresponding to the abnormal data blocks in the second data block matrix.

[0160] The method for recovering abnormal data blocks in the second data block matrix based on the third and fourth check data corresponding to the abnormal data blocks in the second data block matrix is ​​similar to the method for recovering abnormal data blocks in the first data block matrix based on the first and second check data corresponding to the abnormal data blocks in the first data block matrix. See details below. Figure 1 The description in the embodiments is sufficient and will not be repeated here. Similarly, this step can increase the probability of recovering abnormal data, but there is still a possibility that abnormal data blocks cannot be recovered. Compared with backing up only the first verification data, this probability will be significantly reduced.

[0161] The data recovery method of this application embodiment, after cutting the source file to obtain a first data block matrix, can transform the first data block matrix to obtain a second data block matrix. By backing up two sets of data (i.e., the first verification data corresponding to the first data block matrix and the third verification data corresponding to the second data block matrix) for data recovery, although the compression ratio is lost, the probability of recovering abnormal data can be significantly improved.

[0162] Corresponding to the above method embodiments, this application also provides a data recovery device, see [link to relevant documentation]. Figure 10 The data recovery device 1000 includes:

[0163] The backup data acquisition module 1010 is used to acquire backup data with a preset compression ratio corresponding to the source file when the source file is damaged. The backup data includes: first verification data corresponding to multiple sets of data blocks in the first data block matrix. The first data block matrix is ​​generated by cutting the source file.

[0164] The encoding verification module 1020 is used to re-encode and verify the data blocks in the first data block matrix to obtain the second verification data corresponding to each first verification data.

[0165] The abnormal data block determination module 1030 is used to determine the abnormal data block in the first data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data.

[0166] The data block repair module 1040 is used to recover the abnormal data block based on the first and second verification data corresponding to the abnormal data block.

[0167] Optionally, the data recovery device 1000 also includes:

[0168] The source file splitting module is used to obtain the source file and split it into a first data block matrix.

[0169] The encoding verification module is used to perform encoding verification on each data block in the first data block matrix to obtain the verification data corresponding to each data block.

[0170] The backup data storage module is used to obtain the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix, use the first verification data as backup data, and store the backup data.

[0171] Optionally, the first data block matrix is ​​an N×N matrix, with a preset compression ratio of N:2, where N is a power of 2;

[0172] The backup data storage module is specifically used to obtain the first verification data based on the verification data corresponding to each group of data blocks in the first data block matrix through the following steps:

[0173] The sum of the check data of the data blocks contained in a single row of the first data block matrix is ​​determined as the first check data; and

[0174] The sum of the check data of the data blocks contained in a single column of the first data block matrix is ​​determined as the first check data.

[0175] Optionally, the abnormal data block determination module 1030 is specifically used to determine that an abnormal data block exists in any row of data blocks if the row difference between the first check data corresponding to any row of data blocks and the second check data corresponding to that row of data blocks is not equal to 0; to determine that an abnormal data block exists in any column of data blocks if the column difference between the first check data corresponding to any column of data blocks and the second check data corresponding to that column of data blocks is not equal to 0; and to determine abnormal data blocks based on the row difference between each row of data blocks and the column difference between each column of data blocks in the first data block matrix.

[0176] Optionally, the data block repair module 1040 is specifically used to recover the abnormal data blocks according to the first and second verification data corresponding to the abnormal data blocks if the number of abnormal data blocks is less than or equal to a preset number; and to determine whether to recover the abnormal data blocks according to the position distribution of the abnormal data blocks in the first data block matrix if the number of abnormal data blocks is greater than the preset number.

[0177] Optionally, the data block repair module 1040 is specifically used to determine whether to recover the abnormal data blocks based on their position distribution in the first data block matrix through the following steps:

[0178] If a first abnormal data block exists in the first data block matrix, the first abnormal data block is recovered based on the first and second check data corresponding to the data block in the row where the first abnormal data block is located; wherein, the first abnormal data block is the only abnormal data block in the row where the first abnormal data block is located.

[0179] If a second abnormal data block exists in the first data block matrix, the second abnormal data block is recovered based on the first and second verification data corresponding to the data block in the column where the second abnormal data block is located; wherein, the second abnormal data block is the only abnormal data block in the column where the second abnormal data block is located.

[0180] After recovering the first and second abnormal data blocks, if there are at least two remaining abnormal data blocks in any row of the first data block matrix and at least two remaining abnormal data blocks in any column of the first data block matrix, then it is determined that the remaining abnormal data blocks cannot be recovered.

[0181] Optionally, the backup data also includes: third verification data corresponding to multiple sets of data blocks in the second data block matrix, wherein the second data block matrix is ​​obtained by transforming the first data block matrix;

[0182] The encoding verification module 1020 is also used to re-encode and verify the data blocks in the second data block matrix after obtaining the backup data of the source file, so as to obtain the fourth verification data corresponding to each third verification data.

[0183] The abnormal data block determination module 1030 is specifically used to determine abnormal data blocks in the first data block matrix and the second data block matrix based on the difference between the first verification data and the second verification data corresponding to the first verification data, and the difference between the third verification data and the fourth verification data corresponding to the third verification data.

[0184] The data block repair module 1040 is specifically used to recover the abnormal data blocks in the first data block matrix and the second data block matrix based on the first and second verification data corresponding to the abnormal data blocks in the first data block matrix, and the third and fourth verification data corresponding to the abnormal data blocks in the second data block matrix.

[0185] Optionally, the second data block matrix is ​​obtained by offsetting the data blocks in the first data block matrix; or

[0186] The second data block matrix is ​​obtained by adjusting the number of rows and columns of the first data block matrix.

[0187] Optionally, the first data block matrix is ​​a 256×256 data block matrix;

[0188] The encoding and verification module is specifically used to perform encoding and verification on each data block in the first data block matrix using a 16-bit cyclic redundancy check algorithm to obtain the verification data corresponding to each data block.

[0189] The specific details of each module or unit in the above-mentioned device have been described in detail in the corresponding methods, so they will not be repeated here.

[0190] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.

[0191] In an exemplary embodiment of this application, an electronic device is also provided, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured to perform the data recovery method described in this exemplary embodiment.

[0192] Figure 11 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. It should be noted that... Figure 11 The electronic device 1100 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0193] like Figure 11 As shown, the electronic device 1100 includes a central processing unit (CPU) 1101, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1102 or a program loaded from a storage section 1108 into a random access memory (RAM) 1103. The RAM 1103 also stores various programs and data required for system operation. The CPU 1101, ROM 1102, and RAM 1103 are interconnected via a bus 1104. An input / output (I / O) interface 1105 is also connected to the bus 1104.

[0194] The following components are connected to I / O interface 1105: an input section 1106 including a keyboard, mouse, etc.; an output section 1107 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1108 including a hard disk, etc.; and a communication section 1109 including a network interface card such as a local area network (LAN) card, modem, etc. The communication section 1109 performs communication processing via a network such as the Internet. A drive 1110 is also connected to I / O interface 1105 as needed. Removable media 1111, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1110 as needed so that computer programs read from them can be installed into storage section 1108 as needed.

[0195] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1109, and / or installed from removable medium 1111. When the computer program is executed by central processing unit 1101, it performs the various functions defined in the apparatus of this application.

[0196] In this embodiment of the application, a computer-readable storage medium is also provided, on which a computer program is stored, and when the computer program is executed by a processor, it implements the above-described data recovery method.

[0197] It should be noted that the computer-readable storage medium shown in this application can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory, read-only memory, erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to: wireless, wire, optical fiber, radio frequency, etc., or any suitable combination thereof.

[0198] In this embodiment of the application, a computer program product is also provided, which, when run on a computer, causes the computer to execute the above-described data recovery method.

[0199] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0200] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data recovery method, characterized by, The method comprises: When the source file is damaged, backup data corresponding to the source file and having a preset compression ratio is obtained, wherein the backup data comprises first check data corresponding to a plurality of groups of data blocks in a first data block matrix and third check data corresponding to a plurality of groups of data blocks in a second data block matrix, the first data block matrix is generated by cutting the source file, and the second data block matrix is obtained by performing deformation processing on the first data block matrix; Re-encoding and checking the data blocks in the first data block matrix to obtain second check data corresponding to each first check data; Determining abnormal data blocks in the first data block matrix according to a difference between the first check data and the second check data corresponding to the first check data; Restoring the abnormal data blocks according to the first check data and the second check data corresponding to the abnormal data blocks; The method further comprises: After obtaining the backup data of the source file, re-encoding and checking the data blocks in the second data block matrix to obtain fourth check data corresponding to each third check data; The determining of the abnormal data blocks in the first data block matrix according to the difference between the first check data and the second check data corresponding to the first check data comprises: Determining the abnormal data blocks in the first data block matrix and the second data block matrix according to the difference between the first check data and the second check data corresponding to the first check data, and the difference between the third check data and the fourth check data corresponding to the third check data; The restoring of the abnormal data blocks according to the first check data and the second check data corresponding to the abnormal data blocks comprises: Restoring the abnormal data blocks in the first data block matrix and the second data block matrix according to the first check data and the second check data corresponding to the abnormal data blocks in the first data block matrix, and the third check data and the fourth check data corresponding to the abnormal data blocks in the second data block matrix.

2. The method of claim 1, wherein, Before obtaining the backup data of the source file, the method comprises: Obtaining a source file and cutting the source file into a first data block matrix; Encoding and checking each data block in the first data block matrix to obtain check data corresponding to each data block; Obtaining the first check data according to the check data corresponding to each group of data blocks in the first data block matrix, taking the first check data as backup data, and storing the backup data.

3. The method of claim 2, wherein, The first data block matrix is an N×N matrix, the preset compression ratio is N:2, and N is a power of 2; The obtaining of the first check data according to the check data corresponding to each group of data blocks in the first data block matrix comprises: Determining a sum of the check data of the data blocks contained in a single row of the first data block matrix as the first check data; and Determining a sum of the check data of the data blocks contained in a single column of the first data block matrix as the first check data. ​ 4. The method of claim 3, wherein, The determining of the abnormal data block in the first data block matrix according to the difference between the first check data and the second check data corresponding to the first check data comprises: If the row difference between the first check data corresponding to any row data block in the first data block matrix and the second check data corresponding to the row data block is not equal to 0, it is determined that there is an abnormal data block in the any row data block; If the column difference between the first check data corresponding to any column data block in the first data block matrix and the second check data corresponding to the column data block is not equal to 0, it is determined that there is an abnormal data block in the any column data block; The determining of the abnormal data block according to the row difference corresponding to each row data block and the column difference corresponding to each column data block in the first data block matrix.

5. The method of claim 1, wherein, The recovering of the abnormal data block according to the first check data and the second check data corresponding to the abnormal data block comprises: If the number of the abnormal data block is less than or equal to a preset number, the abnormal data block is recovered according to the first check data and the second check data corresponding to the abnormal data block; If the number of the abnormal data block is greater than the preset number, whether to recover the abnormal data block is determined according to the position distribution of the abnormal data block in the first data block matrix.

6. The method of claim 5, wherein, The determining of whether to recover the abnormal data block according to the position distribution of the abnormal data block in the first data block matrix comprises: If there is a first abnormal data block in the first data block matrix, the first abnormal data block is recovered according to the first check data and the second check data corresponding to the row data block where the first abnormal data block is located; wherein the first abnormal data block is the only abnormal data block in the row where the first abnormal data block is located; If there is a second abnormal data block in the first data block matrix, the second abnormal data block is recovered according to the first check data and the second check data corresponding to the column data block where the second abnormal data block is located; wherein the second abnormal data block is the only abnormal data block in the column where the second abnormal data block is located; After the first abnormal data block and the second abnormal data block are recovered, if there are at least two remaining abnormal data blocks in any row data block in the first data block matrix and at least two remaining abnormal data blocks in any column data block, it is determined that the remaining abnormal data blocks cannot be recovered.

7. The method of claim 1, wherein, The second data block matrix is obtained by offset processing the data blocks in the first data block matrix; or The second data block matrix is obtained by adjusting the number of rows and the number of columns of the first data block matrix.

8. The method of claim 2, wherein, The first data block matrix is a 256*256 data block matrix. The encoding check of each data block in the first data block matrix to obtain the check data corresponding to each data block comprises: The encoding check of each data block in the first data block matrix to obtain the check data corresponding to each data block comprises:

9. A data recovery apparatus, characterized by comprising: The device comprises: The backup data acquisition module is configured to acquire backup data corresponding to the source file and having a preset compression ratio when the source file is damaged, wherein the backup data includes first check data corresponding to a plurality of groups of data blocks in a first data block matrix and third check data corresponding to a plurality of groups of data blocks in a second data block matrix, the first data block matrix is generated by cutting the source file, and the second data block matrix is obtained by performing deformation processing on the first data block matrix; The encoding check module is configured to perform encoding check on the data blocks in the first data block matrix again to obtain second check data corresponding to each of the first check data; The abnormal data block determination module is configured to determine abnormal data blocks in the first data block matrix according to a difference between the first check data and the second check data corresponding to the first check data; The data block repair module is configured to recover the abnormal data blocks according to the first check data and the second check data corresponding to the abnormal data blocks; The encoding check module is further configured to perform encoding check on the data blocks in the second data block matrix again to obtain fourth check data corresponding to each of the third check data after the backup data of the source file is acquired; The abnormal data block determination module is specifically configured to determine abnormal data blocks in the first data block matrix and the second data block matrix according to a difference between the first check data and the second check data corresponding to the first check data and a difference between the third check data and the fourth check data corresponding to the third check data; The data block repair module is specifically configured to recover the abnormal data blocks in the first data block matrix and the second data block matrix according to the first check data and the second check data corresponding to the abnormal data blocks in the first data block matrix and the third check data and the fourth check data corresponding to the abnormal data blocks in the second data block matrix.

10. An electronic device, comprising: The processor is configured to execute a computer program stored in the memory, and the computer program is executed by the processor to implement the data recovery method in any one of claims 1-8. The computer program is executed by the processor to implement the data recovery method in any one of claims 1-8.

11. A computer readable storage medium having stored thereon a computer program, characterized in that When the computer program product runs on the computer, the computer is caused to execute the data recovery method in any one of claims 1-8.

12. A computer program product, characterised in that, ​

Citation Information

Patent Citations

  • Method for data storage and data recovery

    CN102346693A