CN115878381A - Data recovery method and device based on SRM disc, storage medium and electronic device - Google Patents

Data recovery method and device based on SRM disc, storage medium and electronic device Download PDF

Info

Publication number
CN115878381A
CN115878381A CN202211595791.8A CN202211595791A CN115878381A CN 115878381 A CN115878381 A CN 115878381A CN 202211595791 A CN202211595791 A CN 202211595791A CN 115878381 A CN115878381 A CN 115878381A
Authority
CN
China
Prior art keywords
storage area
abnormal
data
target
data block
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211595791.8A
Other languages
Chinese (zh)
Inventor
罗心
姜慧敏
王志豪
芦广苹
江文龙
周明伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202211595791.8A priority Critical patent/CN115878381A/en
Publication of CN115878381A publication Critical patent/CN115878381A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a data recovery method and device based on an SRM disc, a storage medium and an electronic device, wherein the method comprises the following steps: in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, determining the storage area written by the abnormal data block as an abnormal storage area under the condition that the abnormal data block occurs; recovering the data in the abnormal data block to obtain a target data block; and copying the target data block and the normal data block stored in the abnormal storage area into the target storage area. By the method and the device, the problem that storage space is wasted for storing the files in the related technology is solved, and the effect of reducing the waste of hard disk space is achieved.

Description

Data recovery method and device based on SRM disc, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the field of file processing, in particular to a data recovery method and device based on an SRM disk, a storage medium and an electronic device.
Background
Shingled Magnetic Recording (SMR) is a magnetic disk technology, and adjacent magnetic tracks are partially overlapped in sequence, so that the storage density of a unit storage medium can be improved, and the storage cost can be reduced. The SMR has the same reading behavior as a common disk, and has higher cost performance for cloud storage mainly based on video and picture services.
The SMR hard disk has the characteristics of only supporting continuous sequential reading and writing of the Zone and deleting the whole Zone, when partial data deletion exists in the Zone (namely the data is actually marked as invalid), but due to the characteristics of the SMR Zone, the whole Zone space cannot be reused. Space is classified as a used capacity category, resulting in a reduced space utilization.
The SMR hard disk writes data in a sequence with a Zone as a basic unit, if a data block of one file object is not completely written with one Zone, the Zone is multiplexed to continue writing the data block of the next file object in order to reduce space waste, and if an exception occurs in the writing process, file recovery is needed. In a conventional file recovery method, a damaged data block on a Zone is calculated and recovered to a new Zone in an EC manner, but since a data block storing a previous file object on an old Zone cannot be released, invalid data exists on the old Zone, and space is wasted.
Disclosure of Invention
The embodiment of the invention provides a data recovery method and device based on an SRM disc, a storage medium and an electronic device, which at least solve the problem that storage space is wasted for storing files in the related art.
According to an embodiment of the present invention, there is provided a data recovery method based on an SRM disc, including: in the process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, determining the storage area into which the abnormal data block is written as an abnormal storage area when the abnormal data block occurs, wherein the target object file is any one of a plurality of object files multiplexing the storage area set, the storage area set is arranged in an SRM disk, and M and N are natural numbers larger than 1; recovering the data in the abnormal data block to obtain a target data block; copying the target data block and the normal data block stored in the abnormal storage area into a target storage area, wherein the target storage area is a storage area except the N + M storage areas; and replacing the abnormal storage area with the target storage area so as to simultaneously store a plurality of object files in the storage area set.
According to another embodiment of the present invention, there is provided an SRM disc-based data recovery apparatus including: a first writing module, configured to determine, when an abnormal data block occurs in a process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, the storage area into which the abnormal data block is written, as an abnormal storage area, where the target object file is any one of a plurality of object files that all multiplex the storage area set, the storage area set is set in an SRM disk, and both M and N are natural numbers greater than 1; the first recovery module is used for recovering the data in the abnormal data block to obtain a target data block; a first copying module, configured to copy the target data block and a normal data block stored in the abnormal storage area into a target storage area, where the target storage area is a storage area other than the N + M storage areas; the first replacement module is used for replacing the abnormal storage area with the target storage area so as to store a plurality of object files in the storage area set at the same time.
In an exemplary embodiment, the apparatus further includes: the first establishing module is used for establishing a corresponding relation between a plurality of object files and the storage area set before determining the storage area written by the abnormal data block as the abnormal storage area under the condition that the abnormal data block occurs in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, wherein the corresponding relation comprises the storage relation between each data block of each object file and each storage block in each storage area.
In an exemplary embodiment, the apparatus further comprises: a first determining module, configured to determine, when an abnormal data block occurs during a process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, a storage area into which the abnormal data block is written as an abnormal storage area, and then determine a length of each data block of the N + M data blocks of the target object file; and the second writing module is used for writing first preset data in the abnormal storage area by using the length of each data block so as to fill up the storage area set.
In an exemplary embodiment, the first recovery module includes: and the first recovery unit is used for recovering the data in at least one abnormal data block to obtain at least one target data block under the condition that the number of the abnormal data blocks is smaller than a preset number and the data in at least one abnormal data block is in a recoverable state.
In an exemplary embodiment, the first restoring unit includes: a first determining subunit, configured to determine data in other data blocks in the target object file, where the other data blocks are data blocks in the target object file other than the abnormal data block; and the first calculating subunit is configured to calculate, based on data in other data blocks in the target object file, data in at least one abnormal data block to obtain at least one target data block.
In an exemplary embodiment, the first copy module includes: a first establishing unit, configured to establish the target storage area; a first copying unit, configured to copy data in the target data block to a target storage block in the target storage area, where a position of the target storage block in the target storage area corresponds to an abnormal storage block in the abnormal storage area; and a second copying unit configured to copy the normal data block stored in the abnormal storage area to another storage block in the target storage area, wherein a position of the other storage block in the target storage area corresponds to a storage block of the normal data block in the abnormal storage area.
In an exemplary embodiment, the apparatus further includes: and a first marking module, configured to mark second preset data in a target storage block in the target storage area when the number of the abnormal data blocks is greater than or equal to a preset number or data in the abnormal data blocks is in an unrecoverable state, where a position of the target storage block in the target storage area corresponds to an abnormal storage block of the abnormal data blocks in the abnormal storage area.
According to a further embodiment of the present invention, there is also provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to, when executed, perform the steps of any of the method embodiments described above.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
By the method, the N + M object files are simultaneously written into the corresponding N + M storage areas in the storage area set; under the condition that an abnormal data block occurs in the writing process, recovering the data in the abnormal data block to obtain a target data block, and copying the target data block and a normal data block stored in the abnormal storage area to the target storage area; and replacing the abnormal storage area with a target storage area so as to simultaneously store a plurality of object files in the storage area set. The method and the device achieve the purpose of writing a plurality of object files into the storage area set at the same time and replacing the abnormal storage area as a whole, therefore, the problem that storage space is wasted for storing the files in the related technology can be solved, and the effect of reducing the waste of hard disk space is achieved.
Drawings
Fig. 1 is a block diagram of a hardware structure of a mobile terminal of a data recovery method based on an SRM disc according to an embodiment of the present invention;
fig. 2 is a flowchart of a data recovery method based on an SRM disc according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the relationship between a plurality of object files and a Zonegroup according to an embodiment of the invention;
FIG. 4 is a diagram illustrating a file recovery process in which multiple object files multiplex the same Zone group according to an embodiment of the present invention;
FIG. 5 is a flowchart of multiplexing multiple object files on the same ZoneGroup, according to an embodiment of the invention;
fig. 6 is a block diagram of a structure of an SRM disc-based data recovery apparatus according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
First, a related art related to the present invention will be explained:
EC, erase Code is a technology that can add m parts of original data (for storing erase codes) to n parts of original data, and can restore the original data by any n parts of n + m parts of data.
LBA, logical Block Addressing mode, where the parameters such as cylinder, head, and sector set in this mode are not physical parameters of the actual hard disk. When accessing a hard disk, the logical address determined by parameters such as cylinder, head, sector, etc. is translated by the ide controller to the physical address of the actual hard disk.
The method embodiments provided in the embodiments of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Taking the operation on a mobile terminal as an example, fig. 1 is a block diagram of a hardware structure of the mobile terminal of a data recovery method based on an SRM disc according to an embodiment of the present invention. As shown in fig. 1, the mobile terminal may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those of ordinary skill in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used for storing a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to the SRM disc-based data recovery method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above-mentioned method. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the mobile terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
In this embodiment, a data recovery method based on an SRM disc is provided, and fig. 2 is a flowchart of the data recovery method based on the SRM disc according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, under the condition that abnormal data blocks occur, determining the storage area written by the abnormal data blocks as an abnormal storage area, wherein the target object file is any one of a plurality of object files of the multiplexing storage area set, the storage area set is arranged in an SRM disk, and M and N are natural numbers larger than 1;
step S204, recovering the data in the abnormal data block to obtain a target data block;
step S206, copying the target data block and the normal data block stored in the abnormal storage area into the target storage area, wherein the target storage area is a storage area except for the N + M storage areas;
step S208, replacing the abnormal storage area with a target storage area so as to store a plurality of object files in the storage area set at the same time.
In this embodiment, the values of N and M may be flexibly set based on an actual reference scene, where N may be a data block and M may be a check block. For example, one object file may be divided into 4+1 data blocks. The storage area set includes 4+1 storage areas.
In this embodiment, a file to be stored is divided into N object files, each object file is divided into 4+1 data blocks according to a redundancy mode of 4+1, each data block is written into a Zone of an SMR disk data storage area correspondingly, and a set of N + M zones is referred to as a storage area set ZoneGroup. The size of a data block may be 256M, and one data block is written to one disk of one storage area.
In this embodiment, the storage regions in the storage region set may be obtained by the cloud storage metadata service from different storage pools, different racks, different storage nodes, different SMR disks. One ZoneGroup can correspond to a plurality of objects, and in the process of recovering the abnormal data blocks, the data block fragments of all the objects on the abnormal storage area Zone can be recovered, that is, the target data blocks and the normal data blocks stored in the abnormal storage area are copied into the target storage area, and the abnormal storage area is released. The method has the advantages that invalid data in the Zone are reduced, the space utilization rate of the SMR hard disk is improved, and the object storage recovery management difficulty is reduced.
In this embodiment, the reasons for the data block write failure include, but are not limited to, the occurrence of network jitter, program crash, and other abnormal situations.
The main body of the above steps may be a terminal, a server, a specific processor provided in the terminal or the server, or a processor or a processing device provided independently from the terminal or the server, but is not limited thereto.
Through the steps, writing the N + M object files into the corresponding N + M storage areas in the storage area set at the same time; under the condition that an abnormal data block occurs in the writing process, recovering the data in the abnormal data block to obtain a target data block, and copying the target data block and a normal data block stored in the abnormal storage area to the target storage area; and replacing the abnormal storage area with a target storage area so as to simultaneously store a plurality of object files in the storage area set. The method and the device achieve the purpose of writing a plurality of object files into the storage area set at the same time and replacing the abnormal storage area as a whole, so that the problem of storage space waste caused by file storage in the related technology can be solved, and the effect of reducing hard disk space waste is achieved.
In an exemplary embodiment, in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, in the case of an abnormal data block, before determining the storage area into which the abnormal data block is written as an abnormal storage area, the method further includes: and establishing a corresponding relation between a plurality of object files and the storage area set, wherein the corresponding relation comprises a storage relation between each data block of each object file and each storage block in each storage area. In this embodiment, the correspondence between the plurality of object files and the storage area sets includes that the plurality of object files simultaneously multiplex the same storage area set. For example, as shown in fig. 3, a set of N + M zones is called a ZoneGroup. The file to be stored is divided into a plurality of Object files (Object 1, object2, \8230; object N), each Object file is divided into 4+1 data blocks according to the redundancy mode of 4+1, each data block is correspondingly written into a storage block in one Zone of an SMR disk data storage area, and a plurality of data blocks of the plurality of Object files can be simultaneously written into the storage blocks of a plurality of zones. In this embodiment, by establishing the corresponding relationship between the multiple object files and the storage area set, the multiple object files can simultaneously reuse the same storage area set, so that the waste of the disk space can be greatly reduced, and the utilization rate of the disk space is improved.
In an exemplary embodiment, in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, in the case of an abnormal data block, after determining the storage area into which the abnormal data block is written as an abnormal storage area, the method further includes: determining the length of each data block in the N + M data blocks of the target object file; and writing first preset data in the abnormal storage area by using the length of each data block so as to complete the storage area set. In this embodiment, a data block with the longest length may be written in the N + M data blocks, and the storage area Zone in which the shorter data block is stored in the ZoneGroup may be filled. The purpose of keeping the Zone lengths in the Zonegroup consistent can be achieved, and after completion of completion, the data block of the next object file is continuously written.
In an exemplary embodiment, recovering data in the abnormal data block to obtain the target data block includes: and recovering the data in the at least one abnormal data block to obtain at least one target data block under the condition that the number of the abnormal data blocks is less than the preset number and the data in the at least one abnormal data block is in a recoverable state. In the present embodiment, the preset number may be set based on an actual usage scenario, for example, the preset number is set to 1 or 2. Optionally, under the condition that the number of the abnormal data blocks is less than the preset number and the data in the at least one abnormal data block is in a recoverable state, recovering the data in the at least one abnormal data block to obtain the target data block, including: determining data in other data blocks in the target object file, wherein the other data blocks are data blocks in the target object file except for the abnormal data block; and calculating data in the at least one abnormal data block based on data in other data blocks in the target object file to obtain at least one target data block. In this embodiment, the data of the abnormal data block may be calculated according to the otherwise normal database blocks in the target object file. Therefore, the purpose of recovering the abnormal data blocks is achieved.
In one exemplary embodiment, copying both the target data block and the normal data block stored in the abnormal storage area into the target storage area includes: establishing a target storage area; copying data in the target data block into a target storage block in a target storage area, wherein the position of the target storage block in the target storage area corresponds to an abnormal storage block of the abnormal data block in the abnormal storage area; and copying the normal data block stored in the abnormal storage area to other storage blocks in the target storage area, wherein the positions of the other storage blocks in the target storage area correspond to the storage blocks of the normal data block in the abnormal storage area. In this embodiment, the target storage area may be established in advance, or may be requested from the SMR. For example, as shown in fig. 4, a plurality of Object files written by 4+1 multiplex the file recovery process of the same group ZoneGroup, the third data block of the Object file Object2 is abnormal during the writing process, and the next Object file Object3 is continuously written after completion. Since Object2 has been marked as an abnormal Object file and the requirements for file recovery are met (the number of corrupted data blocks does not exceed 1), recovery is required. The recovery method is that a new target storage area Zone is applied to be created, and the files are recovered according to the LBA (logical block addressing) and the positions of the data block blocks of the Object files on the abnormal storage area Zone in sequence, wherein Object1 and Object3 are normally written Object files, the block data are directly copied, and Object2 needs to be calculated in an EC (error correction) mode and is calculated according to the other 4 block data of Object 2; and finally replacing the abnormal storage area Zone with the recovered complete target storage area Zone, and forming a new Zonegroup with the other 4 zones. The purpose of restoring the abnormal storage area in the whole block can be realized. The Block fragments of all the objects on the Zone are recovered, so that the invalid data of the Zone are reduced, the space utilization rate of an SMR (Small form-factor memory) hard disk is improved, and the difficulty in object storage, recovery and management is reduced. All the objects Block on the Zone are migrated or restored to a new Zone, so that the whole data of the Zone is restored, the aim of releasing the whole Zone is fulfilled, the space utilization rate of the SMR hard disk is improved, and the reliability of the stored data of the whole distributed object is improved.
In one exemplary embodiment, the method further comprises: and under the condition that the number of the abnormal data blocks is greater than or equal to the preset number or the data in the abnormal data blocks are in an unrecoverable state, marking second preset data in a target storage block in the target storage area, wherein the position of the target storage block in the target storage area corresponds to the abnormal storage block of the abnormal data blocks in the abnormal storage area. In this embodiment, the object file that cannot be restored may be filled with 0 by default in the target storage area Zone, that is, the invalid object file is still invalid data after being restored, and the characteristic that the SMR hard disk Zone space can only be continuously written is satisfied.
The invention is illustrated below with reference to specific examples:
this embodiment takes as an example a scene in which a plurality of object files are multiplexed and written in the same ZoneGroup.
The embodiment is based on a distributed object system, and SMR hard disks on all storage nodes in a cloud storage cluster are managed globally; and abstracting a storage area set Zonegroup consisting of a group of N + M zones based on the SMR hard disk, wherein the storage area zones in the Zonegroup are acquired from different storage pools, different racks, different storage nodes and different SMR disks by cloud storage metadata service.
For example, as shown in fig. 3, a file to be stored is divided into a plurality of object files, each object file is divided into 4+1 data blocks according to a redundancy mode of 4+1, each data block is written into a Zone of an SMR disk data storage area correspondingly, and a set of N + M zones is called a ZoneGroup. The storage of multiple object files on a group of ZoneGroup can greatly reduce the waste of disk space. When abnormal conditions such as network jitter, program crash, etc. occur, the object being written will fail to be written. When the failure of writing the current object is detected, the object is marked as an abnormal object, and the management node in the cloud storage cluster writes a data block with the longest length in the N + M data blocks of the abnormal object, and the Zones in the Zone group, which have the shorter data blocks, are filled up, so that the consistency of the Zones in the Zone group is kept. And after completing the completion, continuing to write the next object file.
The file recovery process in the scene where multiple objects multiplex the same group ZoneGroup is as shown in fig. 4, where multiple objects written at 4+1 multiplex the file recovery process of the same group ZoneGroup, the third data block of Object2 is abnormal during the writing process, and the next Object3 is continuously written after completion. Since Object2 has been marked as an abnormal Object and meets the requirements of file recovery (the number of corrupted data blocks does not exceed M, M = 1), recovery is required. The recovery mode is to apply for a new Zone, sequentially recover files according to the LBA according to the position of the Object block data on the Zone, wherein Object1 and Object3 are objects written normally, and directly copy the block data, and Object2 needs to be calculated in an EC (arithmetic logic) mode according to the other 4 block data of Object 2; and finally replacing the recovered complete new Zone with the abnormal object, and forming a new Zonegroup with the other 4 zones.
As shown in fig. 5, this embodiment specifically includes the following steps:
s501, establishing a corresponding relation between the object file and the Zonegroup. The method comprises the steps of dividing files to be stored into a plurality of Object files (Object 1, object2, \ 8230; object N), dividing each Object file into N + M data blocks (blocks), storing each block on one Zone of one SMR disk, enabling one Object file to have the N + M blocks, needing to be written into the N + M zones of the N + M disks at the same time, enabling the set of the N + M zones to form a ZonecGroup, and establishing a corresponding relation between the Object files and the ZonecGroup.
S502, writing a plurality of object files into the same Zonegroup according to N + M, and utilizing the disk space to the maximum extent.
S503, detecting whether the abnormal condition occurs in the process of writing the object file to cause the write failure, if the write failure occurs, executing S504, otherwise, writing a plurality of object files into a ZoneGroup until the ZoneGroup is written.
S504, if abnormal write-in fails in the process of writing the object, the block of the object file which is written in the ZonecGroup and fails is supplemented with 0 according to the block with the longest write-in length, so that the write-in lengths of the object file on the ZonecGroup are consistent, and the object file is marked as an abnormal object file.
And S505, judging whether the completed Zonegroup is written, if not, executing a step II, and writing the next object file into the Zonegroup, otherwise, executing S506.
S506, the completed Zonegroup is written, and writing fails due to abnormity, so that a recoverable file is generated. And judging whether the file meets the restorable requirement, namely in the writing mode of N + M, if the damaged block number of the object file does not exceed M, meeting the file restorable requirement, otherwise, ending the process and failing to restore the object file.
S507, for the object meeting the file recovery requirement, recovering the Zone with the damaged block in the Zonegroup storing the abnormal object file to the newly applied SMR Zone in a whole block; the Block data of the normal object only needs to be directly copied to the newly applied Zone, the data marked with the abnormality is calculated in an EC mode, and the recovery sequence recovers files according to the positions of the Block data of the object on the Zone and the LBAs in sequence.
And S508, after the newly applied Zone recovers all the data on the abnormal Zone, replacing the abnormal Zone with the new Zone of the complete data, and forming a new Zoonegroup with the other zones.
And S509, after the abnormal Zone is replaced, releasing the Zone, putting the Zone into the whole cloud storage free Zone management pool, and using the Zone to construct a new ZG and write a new object file.
In summary, in the embodiment, under the object file recovery scenario in which multiple object files reuse the same ZoneGroup, the object file set unified recovery mechanism is used to achieve the purpose of writing and deleting the SMR Zone in a whole block, so that the Zone invalid data is reduced, and the overall space utilization rate of the SMR hard disk is improved. By dividing each object file into N + M Block data blocks, the corresponding relation between the object file and a Zonegroup based on an SMR hard disk is established, the individual object recovery is converted into the object data migration and recovery in batches by taking the Zone as a recovery management unit, and the recovery management difficulty of object storage is reduced.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a data recovery apparatus based on an SRM disc is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, which have already been described and are not described again. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 6 is a block diagram of a structure of an SRM disc-based data recovery apparatus according to an embodiment of the present invention, as shown in fig. 6, the apparatus including:
a first writing module 62, configured to determine, when an abnormal data block occurs in a process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, the storage area into which the abnormal data block is written, as an abnormal storage area, where the target object file is any one of a plurality of object files that all multiplex the storage area set, the storage area set is set in an SRM disk, and both M and N are natural numbers greater than 1;
a first recovery module 64, configured to recover the data in the abnormal data block to obtain a target data block;
a first copying module 66, configured to copy both the target data block and the normal data block stored in the abnormal storage area into a target storage area, where the target storage area is a storage area other than the N + M storage areas;
a first replacing module 68, configured to replace an abnormal storage area with the target storage area, so as to store multiple object files in the storage area set at the same time.
In an exemplary embodiment, the apparatus further includes:
the first establishing module is used for establishing a corresponding relation between a plurality of object files and the storage area set before determining the storage area written by the abnormal data block as the abnormal storage area under the condition that the abnormal data block occurs in the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, wherein the corresponding relation comprises the storage relation between each data block of each object file and each storage block in each storage area.
In an exemplary embodiment, the apparatus further includes:
a first determining module, configured to determine, when an abnormal data block occurs during a process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, a storage area into which the abnormal data block is written as an abnormal storage area, and then determine a length of each data block of the N + M data blocks of the target object file;
and the second writing module is used for writing first preset data in the abnormal storage area by using the length of each data block so as to fill up the storage area set.
In an exemplary embodiment, the first restoring module includes:
and the first recovery unit is used for recovering the data in at least one abnormal data block to obtain at least one target data block under the condition that the number of the abnormal data blocks is smaller than a preset number and the data in at least one abnormal data block is in a recoverable state.
In an exemplary embodiment, the first restoring unit includes:
a first determining subunit, configured to determine data in other data blocks in the target object file, where the other data blocks are data blocks in the target object file other than the abnormal data block;
and the first calculating subunit is configured to calculate, based on data in other data blocks in the target object file, data in at least one abnormal data block to obtain at least one target data block.
In an exemplary embodiment, the first copy module includes:
a first establishing unit, configured to establish the target storage area;
a first copying unit, configured to copy data in the target data block to a target storage block in the target storage area, where a position of the target storage block in the target storage area corresponds to an abnormal storage block in the abnormal storage area of the abnormal data block;
and a second copying unit configured to copy the normal data block stored in the abnormal storage area to another storage block in the target storage area, wherein a position of the other storage block in the target storage area corresponds to a storage block of the normal data block in the abnormal storage area.
In an exemplary embodiment, the apparatus further includes:
and a first marking module, configured to mark second preset data in a target storage block in the target storage area when the number of the abnormal data blocks is greater than or equal to a preset number or data in the abnormal data blocks is in an unrecoverable state, where a position of the target storage block in the target storage area corresponds to an abnormal storage block of the abnormal data blocks in the abnormal storage area.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program is arranged to perform the steps of any of the above-mentioned method embodiments when executed.
In the present embodiment, the above-described computer-readable storage medium may be configured to store a computer program for executing the above steps.
In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
In an exemplary embodiment, the processor may be configured to perform the above steps by a computer program.
For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary embodiments, and details of this embodiment are not repeated herein.
It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and they may be implemented using program code executable by the computing devices, such that they may be stored in a memory device and executed by the computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into various integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A data recovery method based on an SRM disc, comprising:
in the process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, determining the storage area into which the abnormal data block is written as an abnormal storage area under the condition that the abnormal data block occurs, wherein the target object file is any one of a plurality of object files multiplexing the storage area set, the storage area set is arranged in an SRM disk, and M and N are natural numbers larger than 1;
recovering the data in the abnormal data block to obtain a target data block;
copying the target data block and the normal data block stored in the abnormal storage area into a target storage area, wherein the target storage area is a storage area except the N + M storage areas;
replacing an abnormal storage area with the target storage area to simultaneously store a plurality of object files in the storage area set.
2. The method according to claim 1, wherein in a case that an abnormal data block occurs during the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, before determining the storage area into which the abnormal data block is written as an abnormal storage area, the method further comprises:
establishing a corresponding relation between a plurality of object files and the storage area set, wherein the corresponding relation comprises a storage relation between each data block of each object file and each storage block in each storage area.
3. The method according to claim 1, wherein in a case that an abnormal data block occurs during the process of correspondingly writing the N + M data blocks of the target object file into the N + M storage areas in the storage area set, after determining the storage area into which the abnormal data block is written as an abnormal storage area, the method further comprises:
determining the length of each data block in the N + M data blocks of the target object file;
writing first preset data in the abnormal storage area by using the length of each data block so as to complete the storage area set.
4. The method of claim 1, wherein recovering data in the abnormal data block to obtain a target data block comprises:
and under the condition that the number of the abnormal data blocks is smaller than the preset number and the data in at least one abnormal data block is in a recoverable state, recovering the data in at least one abnormal data block to obtain at least one target data block.
5. The method according to claim 4, wherein, in a case that the number of the abnormal data blocks is smaller than a preset number and data in at least one of the abnormal data blocks is in a recoverable state, recovering the data in at least one of the abnormal data blocks to obtain a target data block, the method includes:
determining data in other data blocks in the target object file, wherein the other data blocks are data blocks in the target object file except the abnormal data block;
and calculating data in at least one abnormal data block based on data in other data blocks in the target object file to obtain at least one target data block.
6. The method of claim 1, wherein copying the target data block and the normal data block stored in the abnormal storage area into a target storage area comprises:
establishing the target storage area;
copying data in the target data block into a target storage block in the target storage area, wherein the position of the target storage block in the target storage area corresponds to an abnormal storage block of the abnormal data block in the abnormal storage area;
copying the normal data blocks stored in the abnormal storage area into other storage blocks in the target storage area, wherein the positions of the other storage blocks in the target storage area correspond to the storage blocks of the normal data blocks in the abnormal storage area.
7. The method of claim 1, further comprising:
and under the condition that the number of the abnormal data blocks is greater than or equal to a preset number or the data in the abnormal data blocks are in an unrecoverable state, marking second preset data in a target storage block in the target storage area, wherein the position of the target storage block in the target storage area corresponds to the abnormal storage block of the abnormal data blocks in the abnormal storage area.
8. An SRM disc-based data recovery apparatus, comprising:
a first writing module, configured to determine, when an abnormal data block occurs in a process of correspondingly writing N + M data blocks of a target object file into N + M storage areas in a storage area set, the storage area into which the abnormal data block is written, as an abnormal storage area, where the target object file is any one of a plurality of object files that all multiplex the storage area set, the storage area set is set in an SRM disk, and M and N are both natural numbers greater than 1;
the first recovery module is used for recovering the data in the abnormal data block to obtain a target data block;
a first copying module, configured to copy the target data block and the normal data block stored in the abnormal storage area into a target storage area, where the target storage area is a storage area other than the N + M storage areas;
the first replacement module is used for replacing an abnormal storage area with the target storage area so as to store a plurality of object files in the storage area set at the same time.
9. A computer-readable storage medium, in which a computer program is stored, which computer program, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 7.
CN202211595791.8A 2022-12-13 2022-12-13 Data recovery method and device based on SRM disc, storage medium and electronic device Pending CN115878381A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211595791.8A CN115878381A (en) 2022-12-13 2022-12-13 Data recovery method and device based on SRM disc, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211595791.8A CN115878381A (en) 2022-12-13 2022-12-13 Data recovery method and device based on SRM disc, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115878381A true CN115878381A (en) 2023-03-31

Family

ID=85767225

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211595791.8A Pending CN115878381A (en) 2022-12-13 2022-12-13 Data recovery method and device based on SRM disc, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115878381A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785070A (en) * 2024-02-23 2024-03-29 杭州海康威视数字技术股份有限公司 Data storage control method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117785070A (en) * 2024-02-23 2024-03-29 杭州海康威视数字技术股份有限公司 Data storage control method and device
CN117785070B (en) * 2024-02-23 2024-05-24 杭州海康威视数字技术股份有限公司 Data storage control method and device

Similar Documents

Publication Publication Date Title
CN107844268B (en) Data distribution method, data storage method, related device and system
CN105404469B (en) A kind of storage method and system of video data
KR101758544B1 (en) Synchronous mirroring in non-volatile memory systems
EP3179359A1 (en) Data sending method, data receiving method, and storage device
US11698728B2 (en) Data updating technology
CN106407040A (en) Remote data copy method and system
US11093387B1 (en) Garbage collection based on transmission object models
CN110018783B (en) Data storage method, device and system
CN113176858B (en) Data processing method, storage system and storage device
WO2019001521A1 (en) Data storage method, storage device, client and system
US20190317872A1 (en) Database cluster architecture based on dual port solid state disk
CN107870731B (en) Management method of Redundant Array of Independent Disks (RAID) system and electronic equipment
CN109445681B (en) Data storage method, device and storage system
CN107133132B (en) Data sending method, data receiving method and storage device
CN110147203B (en) File management method and device, electronic equipment and storage medium
CN115878381A (en) Data recovery method and device based on SRM disc, storage medium and electronic device
US20190354433A1 (en) Parity log with by-pass
CN116204137B (en) Distributed storage system, control method, device and equipment based on DPU
CN115826876B (en) Data writing method, system, storage hard disk, electronic device and storage medium
US11334456B1 (en) Space efficient data protection
CN116303789A (en) Parallel synchronization method and device for multi-fragment multi-copy database and readable medium
CN115470041A (en) Data disaster recovery management method and device
CN108271420B (en) Method for managing files, file system and server system
US11163642B2 (en) Methods, devices and computer readable medium for managing a redundant array of independent disks
CN111625502B (en) Data reading method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination