CN111427718B - File backup method, file recovery method and file recovery device - Google Patents

File backup method, file recovery method and file recovery device Download PDF

Info

Publication number
CN111427718B
CN111427718B CN201911261688.8A CN201911261688A CN111427718B CN 111427718 B CN111427718 B CN 111427718B CN 201911261688 A CN201911261688 A CN 201911261688A CN 111427718 B CN111427718 B CN 111427718B
Authority
CN
China
Prior art keywords
file
main
files
file set
verification
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.)
Active
Application number
CN201911261688.8A
Other languages
Chinese (zh)
Other versions
CN111427718A (en
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN201911261688.8A priority Critical patent/CN111427718B/en
Publication of CN111427718A publication Critical patent/CN111427718A/en
Priority to PCT/CN2020/131216 priority patent/WO2021115117A1/en
Application granted granted Critical
Publication of CN111427718B publication Critical patent/CN111427718B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1469Backup restoration techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1474Saving, restoring, recovering or retrying in transactions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/82Solving problems relating to consistency

Abstract

The application provides a file backup method, a file recovery method and a file recovery device, wherein the file recovery method comprises the following steps: when the fact that the main files in the main file set and the first verification parameters in the first verification parameter set do not meet the consistency requirement is verified, and the fact that data rollback is conducted on the main files in the main file set is determined according to the second verification parameters in the second verification parameter set and the standby file sets of the main file set, the main files in the main file set are rolled back to be consistent with the standby files, corresponding to the main files, in the standby file sets. By applying the method, the recovery of a plurality of files by taking the collection as a unit can be realized, and the data consistency of each recovered file can be effectively ensured.

Description

File backup method, file recovery method and file recovery device
Technical Field
The present disclosure relates to the field of data processing technologies, and in particular, to a file backup method, a file restoration method, and a file restoration device.
Background
Because the program may be abnormally terminated due to accidents, such as power failure of the device, system crash, etc., during the running process of the program, if the program is abnormally terminated during the process of updating the configuration file (hereinafter referred to as file), the file may be damaged, which further causes that the system cannot run normally after the device is restarted. Based on this, a backup mode is proposed in the prior art, that is, the files are backed up to obtain the backup files, so that the backup files can be still used for recovering the main files under the condition that the main files are damaged, and therefore stability and reliability of the system in operation are ensured.
However, in the prior art, when the main files are backed up, the backup process is respectively executed for a single main file, and when the main files are damaged, the recovery process is also respectively executed for a single main file, which results in that when only part of the damaged part of the plurality of main files are damaged in a complex service scenario, only the damaged part of the plurality of main files are recovered, so that part of the plurality of main files belong to a new version, and the rest of the files belong to an old version, namely, the data consistency of the plurality of main files is damaged, and in such a case, the system is likely to still not operate normally.
Disclosure of Invention
In view of this, the present application provides a file backup method, a file recovery method and a file recovery device, so as to solve the problem that the data consistency of a plurality of main files is easily damaged by using the file backup method and the file recovery method in the prior art, thereby causing the system to fail to operate normally.
According to a first aspect of embodiments of the present application, there is provided a file recovery method, including:
when the fact that the main files in the main file set and the first verification parameters in the first verification parameter set do not meet the consistency requirement is verified, and the fact that data rollback is conducted on the main files in the main file set is determined according to the second verification parameters in the second verification parameter set and the standby file sets of the main file set, the main files in the main file set are rolled back to be consistent with the standby files, corresponding to the main files, in the standby file sets.
According to a second aspect of embodiments of the present application, there is provided a file backup method, including:
when the first verification parameter set corresponding to the main file set is detected to be absent, determining the first verification parameter set, wherein the first verification parameter set comprises first verification parameters corresponding to all main files in the main file set;
when the fact that the spare file set corresponding to the main file set does not exist is detected, a spare file set corresponding to the main file set is generated, a second check parameter set corresponding to the spare file set is determined, the spare file set comprises spare files of all main files in the main file set, and the second check parameter set comprises second check parameters corresponding to all spare files in the spare file set.
According to a third aspect of embodiments of the present application, there is provided a file recovery apparatus, the apparatus including:
the verification module is used for verifying whether the main file in the main file set and the first verification parameter in the first verification parameter set meet the consistency requirement;
the determining module is used for determining whether to roll back data of the main files in the main file set according to the second check parameters in the second check parameter set and the standby file set of the main file set;
And the file recovery module is used for rolling back the main files in the main file set to the standby files with the same file names corresponding to the main files in the standby file set when the main files in the main file set and the first verification parameters in the first verification parameter set are verified to not meet the consistency requirement and the data rolling back of the main files in the main file set is determined according to the second verification parameters in the second verification parameter set and the standby file set of the main file set.
According to a fourth aspect of embodiments of the present application, there is provided a file backup apparatus, the apparatus including:
the first verification parameter determining module is used for determining a first verification parameter set when the first verification parameter set corresponding to the main file set is detected to be absent, wherein the first verification parameter set comprises first verification parameters corresponding to all main files in the main file set;
the file backup module is used for generating a spare file set corresponding to the main file set when the fact that the spare file set corresponding to the main file set does not exist is detected, wherein the spare file set comprises spare files of all main files in the main file set;
The second verification parameter determining module is used for determining a second verification parameter set corresponding to the spare file set, wherein the second verification parameter set comprises second verification parameters corresponding to each spare file in the spare file set.
According to a fifth aspect of embodiments of the present application, there is provided an electronic device comprising a readable storage medium and a processor;
wherein the readable storage medium is for storing machine executable instructions;
the processor is configured to read the machine executable instruction on the readable storage medium and execute the instruction to implement the file restoration method or the file backup method provided in the embodiments of the present application.
According to a sixth aspect of the embodiments of the present application, there is provided a computer readable storage medium having stored therein a computer program which, when executed by a processor, implements the steps of the file restoration method or the file backup method provided by the embodiments of the present application.
By applying the embodiment of the application, when the main file in the main file set and the first check parameter in the first check parameter set are checked to not meet the consistency requirement, and the main file in the main file set is determined to be rolled back according to the second check parameter in the second check parameter set and the standby file set of the main file set, the main file in the main file set is rolled back to be consistent with the standby file with the same file name corresponding to the main file in the standby file set, so that recovery of a plurality of files by taking the set as a unit is realized, and the data consistency of each recovered file can be effectively ensured.
Drawings
FIG. 1 is a flow chart of an embodiment of a method for file backup according to an exemplary embodiment of the present application;
FIG. 2 is a flow chart of an embodiment of a file update process according to an exemplary embodiment of the present application;
FIG. 3 is a flow chart illustrating an embodiment of a method for file restoration according to an exemplary embodiment of the present application;
FIG. 4 is a flowchart of an implementation of step 302 provided in an exemplary embodiment of the present application;
FIG. 5 is a flow chart illustrating an embodiment of a method for file restoration according to another exemplary embodiment of the present application;
FIG. 6 is a block diagram of an embodiment of a file recovery device according to an exemplary embodiment of the present application;
FIG. 7 is a block diagram of an embodiment of a file backup apparatus according to an exemplary embodiment of the present application;
fig. 8 is a hardware configuration diagram of an electronic device according to an exemplary embodiment of the present application.
Detailed Description
First, in the file backup method and the file recovery method provided in the present application, a plurality of main files are categorized into the same main file set, and the main file set is regarded as a whole to perform operations such as backup, update, recovery, and the like, and each operation has atomicity, where "atomicity" is expressed in: and executing the operation on each main file in the main file set, or executing no operation.
Based on this, in the file backup method provided in the present application, corresponding backup files are generated for each primary file in the primary file set, and all the backup files are classified into the same backup file set, and in order to implement a subsequent file recovery procedure, a first check parameter set of the primary file set is generated, where the first check parameter set includes first check parameters corresponding to each primary file in the primary file set, and correspondingly, a second check parameter set of the backup file set is generated, where the second check parameter set includes second check parameters corresponding to each backup file in the backup file set.
In the file recovery method provided by the application, whether each main file in the main file set has data consistency can be checked according to the first check parameters in the first check parameter set, if the main files in the main file set are checked to have no data consistency, whether each standby file in the standby file set has data consistency can be checked according to the second check parameters in the second check parameter set, if the standby files in the standby file set have data consistency, data rollback can be carried out on each main file according to the standby files in the standby file set, so that the main files in the main file set are rolled back to be consistent with the standby files corresponding to the same file name as the main files in the standby file set, and recovery of the main files is achieved.
As one embodiment, each master file in the master file set has a business association. The term "service association" as used herein is represented by a dependency relationship or call relationship between the main files, for example, there are two C files with service association, main.c and A.c, and if a function void AAA () is included in A.c and a function exten void AAA () is included in main.c, then A.c may be invoked when main.c is executed.
In order to make the method provided in the present application clearer, the file backup method and the file recovery method provided in the present application are described below with reference to the accompanying drawings and embodiments, respectively:
for ease of understanding, the method for backing up files provided in the present application is introduced by first showing a flowchart illustrated in fig. 1, where the flowchart illustrated in fig. 1 includes the following steps:
step 101: and when the first check parameter set corresponding to the main file set is detected to be absent, determining the first check parameter set, wherein the first check parameter set comprises first check parameters corresponding to all the main files in the main file set.
As an example, when the primary file set is backed up, it may first be detected whether the first set of verification parameters corresponding to the primary file set exists. It will be appreciated by those skilled in the art that in the case of first backing up the primary file set, the first set of verification parameters does not exist, and at this time, the first set of verification parameters may be determined first.
As one example, the first verification parameters in the first set of verification parameters are master file verification parameters.
In an optional implementation manner, MD5 operation may be performed on each master file in the master file set to obtain an MD5 value of the master file, and the MD5 value is used as a master file verification parameter, and all calculated master file verification parameters are included as first verification parameters in the first verification parameter set.
Step 102: when the fact that the spare file set corresponding to the main file set does not exist is detected, the spare file set corresponding to the main file set is generated, a second check parameter set corresponding to the spare file set is determined, the spare file set comprises spare files of all main files in the main file set, and the second check parameter set comprises second check parameters corresponding to all spare files in the spare file set.
As an example, when a primary file set is backed up, it may first be detected whether a backup file set corresponding to the primary file set exists. It will be understood by those skilled in the art that, in the case of backing up the main file set for the first time, the backup file set does not exist, and at this time, the backup files of each main file in the main file set may be generated and the backup files of each main file are classified into the same backup file set.
After the backup file set corresponding to the main file set is generated, a second check parameter set corresponding to the backup file set may also be determined.
As an example, the second verification parameter of the second verification parameter set is a spare verification parameter.
In an alternative implementation manner, MD5 operation may be performed on each standby file in the standby file set to obtain an MD5 value of the standby file, the MD5 value is used as a standby file verification parameter, and all the calculated standby file verification parameters are used as second verification parameters and are included in the second verification parameter set.
Thus, the description of the flow shown in fig. 1 is completed.
According to the embodiment, the data consistency between the main file set and the standby file set can be effectively ensured by backing up a plurality of main files by taking the set as a unit; by determining the first check parameter set corresponding to the main file set and determining the second check parameter set corresponding to the standby file set, the implementation of the subsequent file recovery process can be facilitated, and as to how the first check parameter set and the second check parameter set are applied to the subsequent file recovery process, the implementation of the file recovery process is shown by way of example and is not repeated herein.
In practical applications, the updating operation of the file, for example, updating the file, is further referred to, and on the basis of the flowchart shown in fig. 1, a flowchart illustrated in fig. 2 is shown, and the updating process of the file in the present application is described, where the flowchart illustrated in fig. 2 includes the following steps:
step 201: and receiving a file updating instruction, and updating each main file in the main file set according to the file updating instruction.
In the embodiment of the application, after receiving the file update instruction, only part of the main files in the main file set are updated, but all the main files in the main file set are updated.
Step 202: after the updating of all the main files in the main file set is completed, the first check parameters corresponding to the updated main files in the main file set are recalculated, and the first check parameters are updated by using the recalculated first check parameters.
In the embodiment of the present application, after the update of all the master files in the master file set is completed, the first check parameter set corresponding to the master file set may be continuously updated.
Similar to the update process of the main file set, when the first check parameter set is updated, the first check parameter corresponding to each updated main file needs to be recalculated.
Step 203: and regenerating the backup files corresponding to each updated main file in the main file set, updating the backup file set by utilizing the regenerated backup files, recalculating second check parameters corresponding to each backup file in the backup file set, and updating the second check parameter set by utilizing the recalculated second check parameters.
Since the main file set is updated, in this step, the backup file set of the updated main file set may be regenerated, and the second verification parameter set corresponding to the updated backup file set may be redetermined. This process is similar to the backup process of the updated main file set, and thus the backup process of the updated main file set may be referred to the related description in step 102 above, and will not be repeated here.
This completes the description of the flowchart shown in fig. 2.
As can be seen from the above embodiments, by updating the plurality of master files in units of a set, data consistency among the plurality of master files can be effectively ensured, and correspondingly, the updated plurality of master files are backed up again in units of a set, data consistency among the backup files of the plurality of master files can be effectively ensured, and data consistency among the updated master file set and the backup file set of the backup can be ensured; after updating each main file in the main file set, continuously updating the first check parameter set by taking the set as a unit, and continuously re-updating the second check parameter set by taking the set as a unit after re-backing up to obtain the backup file set, so that the realization of a subsequent file recovery flow can be facilitated.
The file recovery method provided by the application is described below on the basis of the file backup method and the file update process described above:
firstly, in practical application, one of the following three situations may occur in the process of updating the file, when any one of the following situations occurs, the file is damaged, and under the condition of the file damage, the file recovery method provided by the application can be executed:
(1) Program abnormal termination occurs in the process of updating each main file in the main file set according to the file updating instruction, namely, program abnormal termination occurs when updating of all main files in the main file set is not completed;
(2) Program abnormal termination occurs in the process of recalculating the first verification parameters corresponding to each updated main file in the main file set, namely, modification of all main files in the main file set is completed, and program abnormal termination occurs when the updating of the first verification parameters set is not completed;
(3) Program abnormal termination occurs in the process of regenerating the backup files corresponding to the updated main files in the main file set, namely, the program abnormal termination occurs when the backup process of the updated main file set is not completed.
When the above situation (1) occurs, since the master files in the master file set are not yet completely updated, it can be considered that the data consistency of each master file in the master file set has been destroyed, and the master file is destroyed. Meanwhile, the first check parameter set corresponding to the main file set is not updated, so that the consistency requirement is not met by the main file in the main file set and the first check parameter in the first check parameter set.
Accordingly, since the spare file set is not modified yet, each spare file in the spare file set is normal (is an old version) and each spare file in the spare file set meets data consistency, and meanwhile, the spare file in the spare file set and the first check parameter in the first check parameter set meet consistency requirements, and the spare file in the spare file set and the second check parameter in the second check parameter set also meet the consistency requirements.
When the condition (2) occurs, the main files in the main file set are completely updated, but the first check parameter set is not completely updated, so that the main files in the main file set and the first check parameters in the first check parameter set do not meet the consistency requirement.
Accordingly, since the spare file set is not modified yet, each spare file in the spare file set is normal (is an old version) and each spare file in the spare file set meets data consistency, and meanwhile, the spare file in the spare file set and the first check parameter in the first check parameter set do not meet the consistency requirement, and the spare file in the spare file set and the second check parameter in the second check parameter set meet the consistency requirement.
When the situation (3) occurs, the main file set is updated, and the first check parameter set is updated, so that the main files in the main file set and the first check parameters in the first check parameter set meet the consistency requirement, the data consistency of each standby main file in the standby file set is destroyed, and meanwhile, the standby files in the standby file set and the first check parameters in the first check parameter set do not meet the consistency requirement, and the standby files in the standby file set and the second check parameters in the second check parameter set also do not meet the consistency requirement.
As follows, a flowchart illustrated in fig. 3 is shown, and the file recovery method provided in the present application is described, where the flowchart illustrated in fig. 3 includes the following steps:
step 301: and checking whether the main file in the main file set and the first check parameter in the first check parameter set meet the consistency requirement.
As one example, the first verification parameters in the first set of verification parameters are master file verification parameters.
Based on this, a master file verification parameter, such as an MD5 value, for each master file in the master file set may be calculated. And then, comparing whether the calculated main file check parameters of the main file are consistent with the main file check parameters of the main file in the first check parameter set or not according to each main file.
If a consistent comparison result is obtained for each main file, determining that the main file in the main file set and the main file verification parameters in the first verification parameter set meet the consistency requirement; otherwise, if the inconsistent comparison result is obtained for any master file, it can be determined that the master file in the master file set and the master file verification parameters in the first verification parameter set do not meet the consistency requirement.
Step 302: if the data rollback is not satisfied, determining whether to rollback the main files in the main file set according to the second check parameters in the second check parameter set and the standby file set of the main file set.
In this embodiment of the present application, if the step 301 is performed to obtain a result that the primary file in the primary file set and the first verification parameter in the first verification parameter set do not meet the consistency requirement, it may be considered that the data consistency of each file in the primary file set is damaged, that is, the primary file set is damaged.
Further, in order to ensure the accuracy of data rollback on the main file, whether the current standby file set is good or not can be continuously checked, and under the condition that the standby file set is good, the data rollback is performed on the main file in the main file set.
In this step 302, it may be determined whether to rollback the primary files in the primary file set based on the second set of verification parameters and the backup file set of the primary file set.
As one example, the second verification parameter of the second set of verification parameters is a master file verification parameter. In this example, it may be checked whether the standby files in the standby file set and the primary file check parameters in the secondary check parameter set meet the consistency requirement, and if it is checked that the standby files in the standby file set and the primary file check parameters in the secondary check parameter set meet the consistency requirement, it is known according to the description that the above case (1) occurs in the file update process, and further, as known from the description above, when the above case (1) occurs, each standby file in the standby file set meets the data consistency, that is, the standby file set is good, so that the primary file in the primary file set may be rolled back.
As another example, the second verification parameter in the second verification parameter set is a spare verification parameter. In this example, it may be checked whether the standby files in the standby file set and the standby file check parameters in the second check parameter set meet the consistency requirement, and if it is checked that the standby files in the standby file set and the standby file check parameters in the second check parameter set meet the consistency requirement, it is known from the above description that the above case (1) or (2) occurs in the file update process, and further, as known from the above description, when the above case (1) or (2) occurs, each standby file in the standby file set meets the data consistency, that is, the standby file set is intact, so that the data rollback may be performed on the main file in the main file set.
It should be noted that the above is merely an exemplary description of determining whether to rollback the main file in the main file set according to the second verification parameters in the second verification parameter set and the standby file set of the main file set, and in practical application, step 302 may also be implemented in other manners, for example, in the embodiment shown in fig. 4, and as to the embodiment shown in fig. 4, corresponding descriptions will be omitted herein below.
Step 303: and when determining to roll back the data of the main files in the main file set, rolling back the main files in the main file set to be consistent with the standby files with the same file names corresponding to the main files in the standby file set.
Thus, the description of the flow shown in fig. 3 is completed.
According to the embodiment, when the main file in the main file set and the first verification parameter in the first verification parameter set are verified to not meet the consistency requirement, and the main file in the main file set is determined to be rolled back according to the second verification parameter in the second verification parameter set and the standby file set of the main file set, the main file in the main file set is rolled back to be consistent with the standby file with the same file name corresponding to the main file in the standby file set, so that recovery of a plurality of files by taking the set as a unit is achieved, and the data consistency of each recovered file can be effectively ensured.
The embodiment shown in fig. 4 is described below:
referring to fig. 4, a flowchart of implementation of step 302 is provided in an exemplary embodiment of the present application. As shown in fig. 4, the flow includes the steps of:
step 401: checking whether the standby files in the standby file set and the main file check parameters in the second check parameter set meet the consistency requirement, and if so, executing step 403; if not, step 402 is performed.
Step 402: checking whether the standby files in the standby file set and the standby file check parameters in the second check parameter set meet the consistency requirement, if so, executing step 403, and if not, executing step 404.
Step 403: a determination is made to rollback data on a primary file in the primary file set.
Step 404: it is determined that no data rollback is to be performed on the primary files in the primary file set.
The following collectively describes steps 401 to 404:
as one example, the second verification parameters in the second set of verification parameters may include a master file verification parameter and a slave file verification parameter. In this example, as an alternative implementation manner, whether the standby files in the standby file set and the main file check parameters in the second check parameter set meet the consistency requirement may be checked first, if the standby files in the standby file set and the main file check parameters in the second check parameter set meet the consistency requirement, it may be determined that the data rollback is performed on the main files in the main file set according to the above description.
If the standby files in the standby file set and the main file check parameters in the second check parameter set are checked to not meet the consistency requirement, continuing to check whether the standby files in the standby file set and the standby file check parameters in the second check parameter set meet the consistency requirement.
If the standby files in the standby file set and the main file verification parameters in the second verification parameter set are verified to meet the consistency requirement, according to the description, it can be determined that the data rollback is performed on the main files in the main file set.
If the backup files in the backup file set and the main file verification parameters in the second verification parameter set do not meet the consistency requirement, it is known from the above description that the above situation (3) occurs in the file updating process, and further, from the above description, when the above situation (3) occurs, the data consistency of each backup file in the backup file set is destroyed, that is, the backup file set is damaged, and in this case, the main file in the main file set may not be data-rolled back.
Thus, the description of the flow shown in fig. 4 is completed.
Through the flow shown in fig. 4, determining whether to rollback the main file in the main file set according to the second verification parameters in the second verification parameter set and the standby file set of the main file set is finally realized.
Further, the flowchart illustrated in fig. 5 is continuously shown, and the flowchart illustrated in fig. 5 refers to the flowchart illustrated in fig. 3, and includes the following steps:
step 501: checking whether the primary file in the primary file set and the first check parameter in the first check parameter set meet the consistency requirement, if so, executing step 505, and if not, executing step 502.
Step 502: determining whether to roll back the data of the main file in the main file set according to the second check parameters in the second check parameter set and the backup file set of the main file set, if so, executing step 503, and if not, ending the flow.
Step 503: and rolling back the main files in the main file set to be consistent with the standby files with the same file names corresponding to the main files in the standby file set.
The descriptions of steps 501 to 503 may be referred to the related descriptions of steps 301 to 303 in the flow shown in fig. 3, and are not repeated here.
Step 504: calculating first check parameters corresponding to all main files in the main file set, and updating the first check parameters in the first check parameter set into the recalculated first check parameters; ending the flow.
In this step, after the recovery of each master file in the master file set is achieved by executing step 503, the first verification parameters corresponding to each master file in the recovered master file set may be recalculated, and the first verification parameter set may be updated. Through the processing, the data consistency between the main file set and the first check parameter set can be ensured.
Step 505: checking whether the standby files in the standby file set and the second check parameters in the second check parameter set meet the consistency requirement, if not, executing step 506, and if so, ending the flow.
Step 506: when the standby files in the standby file set and the second verification parameters in the second verification parameter set are verified to not meet the consistency requirement, the standby files corresponding to the main files in the main file set are regenerated, and the regenerated standby files are utilized to update the standby file set.
In this step, when it is verified that the standby files in the standby file set and the second verification parameters in the second verification parameter set do not meet the consistency requirement, it may be determined that the standby file set is damaged, and meanwhile, since it is verified by executing step 501 that the primary files in the primary file set and the first verification parameters in the first verification parameter set meet the consistency requirement, that is, the primary file set is complete, in this case, the primary file set may be backed up again to obtain the standby file set.
Step 507: and calculating second check parameters corresponding to each standby file in the standby file set, and updating the second check parameters in the second check parameter set into the recalculated second file check parameters.
Similar to step 504, after the recovery of the standby file set is achieved by performing step 506, the second verification parameter corresponding to the standby file in the recovered standby file set may be recalculated, and the second verification parameter set may be updated. Through the processing, the data consistency between the spare file set and the second checking parameter set can be ensured.
Thus, the description of the flow shown in fig. 5 is completed.
According to the embodiment, when the main file in the main file set and the main file verification parameters in the first verification parameter set are obtained through verification to meet the consistency requirement, and the standby file in the standby file set and the main file verification parameters in the first verification parameter set are obtained through verification to not meet the consistency requirement, the standby file corresponding to each main file in the main file set is regenerated, the standby file set is updated by the regenerated standby file, and data consistency between the main file set and the standby file set can be ensured.
Corresponding to the embodiment of the file recovery method, the application also provides an embodiment of the file recovery device.
Referring to fig. 6, a block diagram of an embodiment of a file recovery device according to an exemplary embodiment of the present application is provided.
As shown in fig. 6, the apparatus may include: a verification module 61, a determination module 62, and a file recovery module 63.
The verification module 61 is configured to verify whether a main file in the main file set and a first verification parameter in the first verification parameter set meet a consistency requirement;
a determining module 62, configured to determine whether to rollback data on a master file in the master file set according to a second verification parameter in the second verification parameter set and a backup file set of the master file set;
and the file recovery module 63 is configured to, when it is verified that the primary files in the primary file set and the first verification parameters in the first verification parameter set do not meet the consistency requirement, and it is determined that the data rollback is performed on the primary files in the primary file set according to the second verification parameters in the second verification parameter set and the backup file set of the primary file set, rollback the primary files in the primary file set to backup files with the same file names as those corresponding to the primary files in the backup file set.
In an embodiment, the second verification parameter is a master file verification parameter;
the determining module 62 determines, according to the second verification parameter in the second verification parameter set and the backup file set of the main file set, that the data rollback is performed on the main file in the main file set includes: and verifying that the standby files in the standby file set and the main file verification parameters in the second verification parameter set meet the consistency requirement.
In an embodiment, the second verification parameter is a spare file verification parameter;
the determining module 62 determines, according to the second verification parameter in the second verification parameter set and the backup file set of the main file set, that the data rollback is performed on the main file in the main file set includes: and verifying that the standby files in the standby file set and standby file verification parameters in the second verification parameter set meet the consistency requirement.
In an embodiment, the second verification parameters include a master file verification parameter and a slave file verification parameter;
the determining module 62 determines, according to the second verification parameter in the second verification parameter set and the backup file set of the main file set, that the data rollback is performed on the main file in the main file set includes:
checking whether the standby files in the standby file set and the main file check parameters in the second check parameter set meet the consistency requirement;
if the standby files in the standby file set and the main file verification parameters in the second verification parameter set meet the consistency requirement, determining to roll back the data of the main files in the main file set;
if the standby files in the standby file set and the main file verification parameters in the second verification parameter set do not meet the consistency requirement, verifying whether the standby files in the standby file set and the standby file verification parameters in the second verification parameter set meet the consistency requirement;
And if the standby files in the standby file set and the standby file verification parameters in the second verification parameter set meet the consistency requirement, determining to roll back the data of the main files in the main file set.
In an embodiment, the apparatus further comprises (not shown in fig. 6):
the first calculation module is used for calculating first check parameters corresponding to all the main files in the main file set, and updating the first check parameters in the first check parameter set into the recalculated first check parameters.
In an embodiment, the apparatus further comprises (not shown in fig. 6):
and the first backup module is used for regenerating the backup files corresponding to each main file in the main file set and updating the backup file set by utilizing the regenerated backup files when the backup files in the backup file set and the second check parameters in the second check parameter set are checked to not meet the consistency requirement.
In an embodiment, the apparatus further comprises (not shown in fig. 6):
the second calculation module is used for calculating second check parameters corresponding to each standby file in the standby file set, and updating the second check parameters in the second check parameter set into the recalculated second file check parameters.
In an embodiment, the apparatus further comprises (not shown in fig. 6):
the main file updating module is used for receiving a file updating instruction and updating each main file in the main file set according to the file updating instruction;
the third calculation module is used for recalculating first check parameters corresponding to each updated main file in the main file set after the update of all the main files in the main file set is completed, and updating the first check parameter set by using the recalculated first check parameters;
and the second backup module is used for regenerating the backup files corresponding to each updated main file in the main file set, updating the backup file set by using the regenerated backup files, recalculating second check parameters corresponding to each backup file in the backup file set, and updating the second check parameter set by using the recalculated second check parameters.
In an embodiment, the apparatus further comprises (not shown in fig. 6):
the failure determining module is used for stopping program exception in the process of updating each main file in the main file set according to the file updating instruction; or, program abnormal termination occurs in the process of recalculating the first check parameters corresponding to each updated main file in the main file set; or, if the program is abnormally terminated in the process of regenerating the standby files corresponding to the updated main files in the main file set, determining that the file update fails.
In an embodiment, each master file in the master file set has a business association.
Corresponding to the embodiment of the file backup method, the application also provides an embodiment of the file backup device.
Referring to fig. 7, a block diagram of an embodiment of a file backup apparatus according to an exemplary embodiment of the present application is provided.
As shown in fig. 7, the apparatus includes: a first verification parameter determination module 71, a file backup module 72, and a second verification parameter determination module 73.
The first verification parameter determining module 71 is configured to determine, when it is detected that a first verification parameter set corresponding to a main file set does not exist, the first verification parameter set, where the first verification parameter set includes first verification parameters corresponding to each main file in the main file set;
a file backup module 72, configured to generate a backup file set corresponding to the main file set when detecting that the backup file set corresponding to the main file set does not exist, where the backup file set includes backup files of each main file in the main file set;
a second verification parameter determining module 73, configured to determine a second verification parameter set corresponding to the spare file set, where the second verification parameter set includes second verification parameters corresponding to each spare file in the spare file set.
With continued reference to fig. 8, the present application also provides an electronic device including a processor 801, a communication interface 802, a memory 803, and a communication bus 804.
Wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through a communication bus 804;
a memory 803 for storing a computer program;
the processor 801 is configured to execute a computer program stored in the memory 803, where the processor 801 implements the steps of the file restoration method or the file backup method provided in the embodiments of the present application when executing the computer program.
The present application also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the file restoration method or the file backup method provided by the embodiments of the present application.
The implementation process of the functions and roles of each unit in the above device is specifically shown in the implementation process of the corresponding steps in the above method, and will not be described herein again.
For the device embodiments, reference is made to the description of the method embodiments for the relevant points, since they essentially correspond to the method embodiments. The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purposes of the present application. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing description of the preferred embodiments of the present invention is not intended to limit the invention to the precise form disclosed, and any modifications, equivalents, improvements and alternatives falling within the spirit and principles of the present invention are intended to be included within the scope of the present invention.

Claims (13)

1. A method for file restoration, the method comprising:
taking a plurality of main files with business relevance as a main file set; wherein each operation of the main file set has atomicity, and the atomicity refers to that each operation or none of the main files in the main file set is executed;
when the fact that the main files in the main file set and the first check parameters in the first check parameter set do not meet the consistency requirement is checked, and the fact that data rollback is conducted on the main files in the main file set is determined according to the second check parameters in the second check parameter set and the standby file sets of the main file set, the main files in the main file set are rolled back to be consistent with standby files, corresponding to the main files, in the standby file sets.
2. The method of claim 1, wherein the second verification parameter is a master file verification parameter;
Determining the data rollback of the main file in the main file set according to the second verification parameters in the second verification parameter set and the backup file set of the main file set comprises the following steps:
and verifying that the standby files in the standby file set and the main file verification parameters in the second verification parameter set meet the consistency requirement.
3. The method of claim 1, wherein the second verification parameter is a spare verification parameter;
determining the data rollback of the main file in the main file set according to the second verification parameters in the second verification parameter set and the backup file set of the main file set comprises the following steps:
and verifying that the standby files in the standby file set and standby file verification parameters in the second verification parameter set meet the consistency requirement.
4. The method of claim 1, wherein the second verification parameters include a master file verification parameter and a slave file verification parameter;
determining the data rollback of the main file in the main file set according to the second verification parameters in the second verification parameter set and the backup file set of the main file set comprises the following steps:
Checking whether the standby files in the standby file set and the main file check parameters in the second check parameter set meet the consistency requirement;
if the standby files in the standby file set and the main file verification parameters in the second verification parameter set meet the consistency requirement, determining to roll back the data of the main files in the main file set;
if the standby files in the standby file set and the main file verification parameters in the second verification parameter set do not meet the consistency requirement, verifying whether the standby files in the standby file set and the standby file verification parameters in the second verification parameter set meet the consistency requirement;
and if the standby files in the standby file set and the standby file verification parameters in the second verification parameter set meet the consistency requirement, determining to roll back the data of the main files in the main file set.
5. The method of claim 1, wherein after rolling back a primary file in the primary file set to be consistent with a backup file in the backup file set corresponding to the same file name as the primary file, the method further comprises:
and calculating first check parameters corresponding to all the main files in the main file set, and updating the first check parameters in the first check parameter set into recalculated first check parameters.
6. The method of claim 1, wherein when it is verified that the primary file in the primary file set and the first verification parameter in the first verification parameter set meet a consistency requirement, the method further comprises:
and when the standby files in the standby file set and the second check parameters in the second check parameter set are checked to not meet the consistency requirement, regenerating standby files corresponding to all the main files in the main file set and updating the standby file set by using the regenerated standby files.
7. The method of claim 6, wherein after the regenerating the spare file corresponding to each main file in the main file set and updating the spare file set with the regenerated spare file, the method further comprises:
calculating second check parameters corresponding to each standby file in the standby file set, and updating the second check parameters in the second check parameter set into recalculated second file check parameters.
8. The method according to claim 1, wherein the method further comprises:
receiving a file updating instruction, and updating each main file in the main file set according to the file updating instruction;
After the update of all the main files in the main file set is completed, recalculating first check parameters corresponding to each updated main file in the main file set, and updating the first check parameter set by using the recalculated first check parameters;
and regenerating the backup files corresponding to each updated main file in the main file set, updating the backup file set by using the regenerated backup files, recalculating second check parameters corresponding to each backup file in the backup file set, and updating the second check parameter set by using the recalculated second check parameters.
9. The method according to claim 8, wherein when determining that the file update fails, performing the file recovery method according to any one of claims 1 to 7, the determining that the file update fails includes:
if abnormal program termination occurs in the process of updating each main file in the main file set according to the file updating instruction; or, program abnormal termination occurs in the process of recalculating the first check parameters corresponding to each updated main file in the main file set; or, if the program is abnormally terminated in the process of regenerating the standby files corresponding to the updated main files in the main file set, determining that the file update fails.
10. A method of file backup, the method comprising:
taking a plurality of main files with business relevance as a main file set; wherein each operation of the main file set has atomicity, and the atomicity refers to that each operation or none of the main files in the main file set is executed;
when the first verification parameter set corresponding to the main file set is detected to be absent, determining the first verification parameter set, wherein the first verification parameter set comprises first verification parameters corresponding to all main files in the main file set;
when the fact that the backup file set corresponding to the main file set does not exist is detected, a backup file set corresponding to the main file set is generated, a second verification parameter set corresponding to the backup file set is determined, the backup file set comprises backup files of all main files in the main file set, the second verification parameter set comprises second verification parameters corresponding to all backup files in the backup file set, so that when the fact that the consistency requirement is not met by the main files in the main file set and the first verification parameters in the first verification parameter set is verified, and when data rollback is carried out on the main files in the main file set according to the second verification parameters in the second verification parameter set and the backup file set of the main file set, the main files in the main file set are rolled back to be consistent with the backup files with the same file names corresponding to the main files in the backup file set.
11. A document retrieval apparatus, the apparatus comprising:
the verification module is used for taking a plurality of main files with business relevance as a main file set; checking whether a main file in the main file set and a first check parameter in a first check parameter set meet a consistency requirement or not; wherein each operation of the main file set has atomicity, and the atomicity refers to that each operation or none of the main files in the main file set is executed;
the determining module is used for determining whether to roll back data of the main files in the main file set according to the second check parameters in the second check parameter set and the standby file set of the main file set;
and the file recovery module is used for rolling back the main files in the main file set to the standby files with the same file names corresponding to the main files in the standby file set when the main files in the main file set and the first verification parameters in the first verification parameter set are verified to not meet the consistency requirement and the data rolling back of the main files in the main file set is determined according to the second verification parameters in the second verification parameter set and the standby file set of the main file set.
12. A file backup apparatus, the apparatus comprising:
the first verification parameter determining module is used for taking a plurality of main files with business relevance as a main file set; wherein each operation of the main file set has atomicity, and the atomicity refers to that each operation or none of the main files in the main file set is executed; when the first verification parameter set corresponding to the main file set is detected to be absent, determining the first verification parameter set, wherein the first verification parameter set comprises first verification parameters corresponding to all main files in the main file set;
the file backup module is used for generating a spare file set corresponding to the main file set when the fact that the spare file set corresponding to the main file set does not exist is detected, wherein the spare file set comprises spare files of all main files in the main file set;
the second verification parameter determining module is configured to determine a second verification parameter set corresponding to the spare file set, where the second verification parameter set includes second verification parameters corresponding to each spare file in the spare file set, so that when it is verified that the primary files in the primary file set do not meet the consistency requirement with the first verification parameters in the first verification parameter set, and it is determined that data rollback is performed on the primary files in the primary file set according to the second verification parameters in the second verification parameter set and the spare file set of the primary file set, the primary files in the primary file set are rolled back to be consistent with the spare files corresponding to the primary files in the spare file set.
13. An electronic device comprising a readable storage medium and a processor;
wherein the readable storage medium is for storing machine executable instructions;
the processor being configured to read the machine executable instructions on the readable storage medium and execute the instructions to implement the steps of the method of any one of claims 1-9 or claim 10.
CN201911261688.8A 2019-12-10 2019-12-10 File backup method, file recovery method and file recovery device Active CN111427718B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911261688.8A CN111427718B (en) 2019-12-10 2019-12-10 File backup method, file recovery method and file recovery device
PCT/CN2020/131216 WO2021115117A1 (en) 2019-12-10 2020-11-24 File backup method and device, file recovery method and device, and file update method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911261688.8A CN111427718B (en) 2019-12-10 2019-12-10 File backup method, file recovery method and file recovery device

Publications (2)

Publication Number Publication Date
CN111427718A CN111427718A (en) 2020-07-17
CN111427718B true CN111427718B (en) 2024-01-23

Family

ID=71546899

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911261688.8A Active CN111427718B (en) 2019-12-10 2019-12-10 File backup method, file recovery method and file recovery device

Country Status (2)

Country Link
CN (1) CN111427718B (en)
WO (1) WO2021115117A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427718B (en) * 2019-12-10 2024-01-23 杭州海康威视数字技术股份有限公司 File backup method, file recovery method and file recovery device

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06236351A (en) * 1993-02-10 1994-08-23 Hitachi Ltd Backup restoring device of on-line system
CN101436138A (en) * 2007-11-16 2009-05-20 苏州科达通信技术发展有限公司 Control device and control method for software upgrade and dynamic rolling back
CN102662991A (en) * 2012-03-14 2012-09-12 北京邮电大学 File-level synchronization method based on mobile storage devices
CN102932621A (en) * 2011-08-08 2013-02-13 杭州海康威视数字技术股份有限公司 Method and device for storing data
CN106302953A (en) * 2015-05-21 2017-01-04 中兴通讯股份有限公司 Coupling verification method, device and the equipment of a kind of terminal
CN107153588A (en) * 2017-05-12 2017-09-12 成都优孚达信息技术有限公司 data encoding storage method
CN107643882A (en) * 2017-09-29 2018-01-30 昂纳信息技术(深圳)有限公司 The storage and restoration methods of a kind of data reliability, system and storage device
CN108573016A (en) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 A kind of data consistent check method, apparatus, equipment and storage medium
CN109634645A (en) * 2018-12-28 2019-04-16 深圳市有方科技股份有限公司 Firmware upgrade method and terminal
CN109784058A (en) * 2019-01-07 2019-05-21 中国银行股份有限公司 Version strong consistency method of calibration, client, server and storage medium
CN109871296A (en) * 2018-12-24 2019-06-11 航天信息股份有限公司 A kind of data back up method and system, data reconstruction method and system and mobile terminal
CN110413441A (en) * 2019-06-18 2019-11-05 平安科技(深圳)有限公司 Active and standby storage volume synchrodata method of calibration, device, equipment and storage medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7860246B2 (en) * 2006-11-01 2010-12-28 International Business Machines Corporation System and method for protecting data in a secure system
WO2011089864A1 (en) * 2010-01-21 2011-07-28 日本電気株式会社 File group matching verification system, file group matching verification method, and program for file group matching verification
CN105205074B (en) * 2014-06-25 2019-03-26 优视科技有限公司 File increment upgrade method and system
CN108108271B (en) * 2017-12-25 2020-11-03 飞天诚信科技股份有限公司 Method and device for realizing unified management of affairs and power failure protection
CN110032428B (en) * 2019-02-21 2023-06-27 创新先进技术有限公司 Method and device for executing distributed transaction
CN111427718B (en) * 2019-12-10 2024-01-23 杭州海康威视数字技术股份有限公司 File backup method, file recovery method and file recovery device

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06236351A (en) * 1993-02-10 1994-08-23 Hitachi Ltd Backup restoring device of on-line system
CN101436138A (en) * 2007-11-16 2009-05-20 苏州科达通信技术发展有限公司 Control device and control method for software upgrade and dynamic rolling back
CN102932621A (en) * 2011-08-08 2013-02-13 杭州海康威视数字技术股份有限公司 Method and device for storing data
CN102662991A (en) * 2012-03-14 2012-09-12 北京邮电大学 File-level synchronization method based on mobile storage devices
CN106302953A (en) * 2015-05-21 2017-01-04 中兴通讯股份有限公司 Coupling verification method, device and the equipment of a kind of terminal
CN107153588A (en) * 2017-05-12 2017-09-12 成都优孚达信息技术有限公司 data encoding storage method
CN107643882A (en) * 2017-09-29 2018-01-30 昂纳信息技术(深圳)有限公司 The storage and restoration methods of a kind of data reliability, system and storage device
CN108573016A (en) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 A kind of data consistent check method, apparatus, equipment and storage medium
CN109871296A (en) * 2018-12-24 2019-06-11 航天信息股份有限公司 A kind of data back up method and system, data reconstruction method and system and mobile terminal
CN109634645A (en) * 2018-12-28 2019-04-16 深圳市有方科技股份有限公司 Firmware upgrade method and terminal
CN109784058A (en) * 2019-01-07 2019-05-21 中国银行股份有限公司 Version strong consistency method of calibration, client, server and storage medium
CN110413441A (en) * 2019-06-18 2019-11-05 平安科技(深圳)有限公司 Active and standby storage volume synchrodata method of calibration, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《Oracle数据库的安全及备份恢复》;李海波;电脑知识与技术(第11期);第13-15页 *

Also Published As

Publication number Publication date
WO2021115117A1 (en) 2021-06-17
CN111427718A (en) 2020-07-17

Similar Documents

Publication Publication Date Title
KR100750132B1 (en) Method and system for booting, updating software automatically and recovering update error, and computer readable medium recording the method
CN106775610B (en) Electronic equipment starting method and electronic equipment
CN111784518A (en) Block chain cross-chain processing method and device, computer equipment and storage medium
CN110909394A (en) Configuration file monitoring method of server
CN108845866B (en) Method and apparatus for processing distributed transactions
CN108932249B (en) Method and device for managing file system
EP3474143B1 (en) Method and apparatus for incremental recovery of data
CN108255576B (en) Virtual machine live migration exception handling method and device and storage medium
CN103186390A (en) Home gateway and software upgrading method thereof
CN111182033B (en) Method and equipment for restoring switch
CN105550071A (en) System file upgrading and detecting method and communication device
CN111427718B (en) File backup method, file recovery method and file recovery device
CN114780298A (en) File data processing method and device, computer terminal and storage medium
US20120158652A1 (en) System and method for ensuring consistency in raid storage array metadata
CN105630626B (en) Transaction backup processing method and device
CN111651304A (en) Software recovery method and device based on double-core intelligent electric meter and computer equipment
CN115509815A (en) Method and device for protecting data in server
CN113467805A (en) Firmware rollback method of network equipment and related device
CN112905341A (en) Distributed load balancing service information continuous inheritance method and device
CN111427720A (en) Database repair method and device, computer equipment and storage medium
CN110795155A (en) System starting method and device, electronic equipment and storage medium
JP6481489B2 (en) Modification application information creation program, modification application information creation apparatus, and modification application information creation method
CN111176886A (en) Database mode switching method and device and electronic equipment
CN111625840A (en) Program checking method, program upgrading method and device
CN114003436A (en) Software backup method and 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
GR01 Patent grant
GR01 Patent grant