CN106933699B - Snapshot deleting method and device - Google Patents

Snapshot deleting method and device Download PDF

Info

Publication number
CN106933699B
CN106933699B CN201511019157.XA CN201511019157A CN106933699B CN 106933699 B CN106933699 B CN 106933699B CN 201511019157 A CN201511019157 A CN 201511019157A CN 106933699 B CN106933699 B CN 106933699B
Authority
CN
China
Prior art keywords
node
snapshot
backup
snapshot node
deleting
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
CN201511019157.XA
Other languages
Chinese (zh)
Other versions
CN106933699A (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.)
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software Technology Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Suzhou Software 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 China Mobile Communications Group Co Ltd, China Mobile Suzhou Software Technology Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201511019157.XA priority Critical patent/CN106933699B/en
Publication of CN106933699A publication Critical patent/CN106933699A/en
Application granted granted Critical
Publication of CN106933699B publication Critical patent/CN106933699B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a data recovery method, which comprises the following steps: receiving a snapshot restoring instruction, wherein the snapshot restoring instruction is used for indicating that volume data is restored based on a first snapshot node, and restoring the volume data according to the first backup node after the first backup node corresponding to the first snapshot node is determined, wherein the first backup node is formed by copying snapshot data of the first snapshot node.

Description

Snapshot deleting method and device
Technical Field
The present invention relates to backup technologies, and in particular, to a snapshot deleting method and apparatus.
Background
With the development of cloud computing technology, storage services are also more and more widely applied as core services in Infrastructure as a Service (IaaS), wherein block storage is a large class in IaaS.
At present, data backup and recovery of block storage are mainly realized by two technologies, namely backup and snapshot. However, the backup technology needs to backup all data, and there is a problem that the backup data occupies a large space and causes resource waste, so to save resources, a snapshot technology can be used to backup and restore data, but because each time the data is saved is an increment of the previous snapshot, there is a precedence dependency relationship between snapshots, and when a snapshot is deleted, all subsequent snapshot data cannot be restored.
Therefore, a reasonable data recovery method does not exist in the prior art.
Disclosure of Invention
In view of this, embodiments of the present invention are expected to provide a method and an apparatus for data recovery, snapshot creation, and snapshot deletion, so as to improve reliability of data recovery, facilitate user operation, and provide good user experience.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
in a first aspect, an embodiment of the present invention provides a data recovery method, including: receiving a snapshot restoring instruction, wherein the snapshot restoring instruction is used for instructing to restore volume data based on a first snapshot node, and after a first backup node corresponding to the first snapshot node is determined, restoring the volume data according to the first backup node, wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the determining a first backup node corresponding to the first snapshot node includes: and determining the first backup node according to the corresponding relation between the preset snapshot node and the backup node.
Further, the restoring the volume data according to the first backup node includes: and overlapping the backup data of the first backup node with the snapshot data of all the preorder snapshot nodes of the first snapshot node, and recovering the volume data.
In a second aspect, an embodiment of the present invention provides a snapshot creating method, including: receiving a snapshot creating instruction, wherein the snapshot creating instruction is used for instructing to create a first snapshot node, create the first snapshot node, copy snapshot data of the first snapshot node to form a first backup node, and associate at least the first snapshot node and the first backup node.
Further, said associating at least the first snapshot node and the first backup node comprises: and associating the first snapshot node, the first backup node and the volume corresponding to the first snapshot node.
Further, after the creating the first snapshot node and copying the data of the first snapshot node to form a first backup node, the method includes: and marking the first snapshot node as the snapshot node of the latest backup.
In a third aspect, an embodiment of the present invention provides a snapshot deleting method, including: receiving a snapshot deleting instruction, wherein the snapshot deleting instruction is used for indicating deletion of a first snapshot node, judging whether the first snapshot node is a snapshot node which is backed up last time, obtaining a judgment result, deleting the first snapshot node, and performing corresponding processing on the first backup node according to the judgment result, wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the deleting the first snapshot node and performing corresponding processing on the first backup node according to the judgment result includes: when the first snapshot node is the snapshot node which is backed up last time, judging whether other backup nodes exist in the volume corresponding to the first snapshot node, when the other backup nodes exist in the volume corresponding to the first snapshot node, deleting the first backup node and the first snapshot node, and when the other backup nodes do not exist in the volume corresponding to the first snapshot node, deleting the first backup node, the first snapshot node and deleting the preamble node of the first snapshot node.
Further, the deleting the first snapshot node and performing corresponding processing on the first backup node according to the judgment result includes: when the first snapshot node is not the snapshot node which is backed up last time, judging whether a child node exists in the first snapshot node or not, when the child node exists in the first snapshot node, deleting the first snapshot node, reserving the first backup node, and when the child node does not exist in the first snapshot node, deleting the first snapshot node and the first backup node.
Further, the deleting the first snapshot node and the first backup node includes: and judging whether other child nodes exist in the father node of the first snapshot node, and deleting the first backup node, the first snapshot node and the father node of the first snapshot node when the other child nodes exist in the father node.
In a fourth aspect, an embodiment of the present invention provides a data recovery apparatus, including: the device comprises a first receiving module and a restoring module, wherein the first receiving module is used for receiving a snapshot restoring instruction, the snapshot restoring instruction is used for indicating that volume data are restored based on a first snapshot node, and the restoring module is used for restoring the volume data according to the first backup node after the first backup node corresponding to the first snapshot node is determined, wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the recovery module is specifically configured to: and determining the first backup node according to the corresponding relation between the preset snapshot node and the backup node.
Further, the recovery module is specifically configured to: and overlapping the backup data of the first backup node with the snapshot data of all the preorder snapshot nodes of the first snapshot node, and recovering the volume data.
In a fifth aspect, an embodiment of the present invention provides a snapshot creating apparatus, including: the snapshot creating module is used for creating the first snapshot node and copying snapshot data of the first snapshot node to form a first backup node, and the association module is used for associating at least the first snapshot node with the first backup node.
Further, the association module is specifically configured to: and associating the first snapshot node, the current backup node and the volume corresponding to the first snapshot node.
Further, the association module is specifically configured to: after the first snapshot node is created and the data of the first snapshot node is copied to form a first backup node, the first snapshot node is marked as the snapshot node which is backed up last time.
In a sixth aspect, an embodiment of the present invention provides a snapshot deleting apparatus, including: the system comprises a third receiving module, a judging module and a deleting module, wherein the snapshot deleting instruction is used for indicating to delete a first snapshot node, the judging module is used for judging whether the first snapshot node is a snapshot node which is backed up last time or not and obtaining a judgment result, and the deleting module is used for deleting the first snapshot node and correspondingly processing the first backup node according to the judgment result, wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the deletion module includes: the first judging submodule is used for judging whether other backup nodes exist in the volume corresponding to the first snapshot node or not when the first snapshot node is the snapshot node which is backed up at the latest time, the first deleting submodule is used for deleting the first backup node and the first snapshot node when the volume corresponding to the first snapshot node exists in the other backup nodes, and the second deleting submodule is used for deleting the first backup node, the first snapshot node and deleting the preorder snapshot node of the first snapshot node when the volume corresponding to the first snapshot node does not exist in the other backup nodes.
Further, the deleting module further comprises: the second judgment submodule is used for judging whether a child node exists in the first snapshot node or not when the first snapshot node is not the snapshot node which is backed up at the latest time, the third deletion submodule is used for deleting the first snapshot node and reserving the first backup node when the child node exists in the first snapshot node, and the fourth deletion submodule is used for deleting the first snapshot node and the first backup node when the child node does not exist in the first snapshot node.
Further, the fourth deletion submodule is specifically configured to determine whether there are other child nodes in the parent node of the first snapshot node; and when the parent node of the first snapshot node has the other child nodes, deleting the first backup node, the first snapshot node and the parent node.
In the data recovery method provided in the embodiment of the present invention, after receiving a snapshot recovery instruction for instructing to recover volume data based on a first snapshot node, a first backup node corresponding to the first snapshot node is determined, and then the volume data is recovered according to the first backup node, where the first backup node is formed by copying snapshot data of the first snapshot node, that is, the first backup node is obtained by copying the first snapshot node, and then, in a case where the first snapshot node is deleted, the volume data can be recovered by using the first backup node, so that reliability of data recovery is improved, user operation is facilitated, and good user experience is provided.
Drawings
FIG. 1 is a flow chart illustrating a data recovery method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating relationships between snapshot nodes in an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a snapshot creation method according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating a snapshot deletion method according to an embodiment of the present invention;
FIG. 5 is a schematic structural diagram of a data recovery apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a snapshot creation apparatus in an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a snapshot deleting apparatus in the embodiment of the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The embodiment of the invention provides a data recovery method which is applied to a data recovery device. Fig. 1 is a schematic flow chart of a data recovery method in an embodiment of the present invention, and as shown in fig. 1, the method includes:
s101: receiving a snapshot recovery instruction;
wherein the snapshot restore instruction is used for instructing to restore the volume data based on the first snapshot node;
s102: and after a first backup node corresponding to the first snapshot node is determined, restoring the volume data according to the first backup node.
Here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
In a specific implementation process, S102 may include: determining a first backup node according to a preset corresponding relation between the snapshot node and the backup node;
it should be noted that the snapshot node and the backup node of the volume are in a corresponding relationship with each other, so that a first backup node corresponding to the first snapshot node can be determined according to a preset corresponding relationship between the snapshot node and the backup node, and finally, the purpose of restoring the volume data is achieved through the first backup node.
In another embodiment, S102 may include: and overlapping the backup data of the first backup node with the snapshot data of all the preorder snapshot nodes of the first snapshot node, and recovering the volume data.
Fig. 2 is a schematic diagram of a relationship between Snapshot nodes in the embodiment of the present invention, and as shown in fig. 2, the relationship between Snapshot nodes may also be represented by table 1, table 2, and table 3, where table 1 is a relationship between Snapshot Node codes, table 2 is a relationship between Backup Node codes (BN, Backup Node), Snapshot Node codes (SN, Snapshot Node), and volume codes, and table 3 is a latest Snapshot Node code corresponding to a volume code.
For example, when a snapshot restore instruction is received, where the snapshot restore instruction is used to instruct to restore volume data based on the snapshot node a2, it is determined that the backup node corresponding to the a2 is BN2 through the lookup table 2, and volume data is restored to the volume VOL0 by overlapping the backup data of the BN2 with snapshot data of all preamble snapshot nodes a1 and a0 of the a2, so that the volume data restore operation based on the a2 is completed.
SN encoding Parent SN encoding
A0 null
A1 A0
A2 A1
B1 A1
B2 B1
C1 A1
TABLE 1
Figure BDF0000012655310000061
Figure BDF0000012655310000071
TABLE 2
Volume coding SN encoding of last backup
VOL0 C1
TABLE 3
In this embodiment, the volume data can be restored by overlapping the snapshot data of the first backup node and all the pre-order snapshot nodes of the first snapshot node, and the dependency relationship between the snapshot nodes is not relied on any more, so that the technical problem that the volume data cannot be restored when the first snapshot node is deleted by a user by mistake is solved, the reliability of data restoration is improved, the user operation is facilitated, and good user experience is provided.
In the embodiment of the invention, the first backup node is obtained by copying the first snapshot node, so that the volume data can be restored by using the first backup node even if the first snapshot node is deleted, the reliability of data restoration is improved, the operation of a user is facilitated, and good user experience is provided.
Based on the same inventive concept, the embodiment of the invention provides a snapshot creation method, which is applied to a snapshot creation device. Fig. 3 is a flowchart illustrating a snapshot creating method in an embodiment of the present invention, and as shown in fig. 3, the method includes:
s301: receiving a snapshot creating instruction;
the snapshot creating instruction is used for indicating the creation of a first snapshot node;
s302: creating a first snapshot node, and copying snapshot data of the first snapshot node to form a first backup node;
here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
S303: at least a first snapshot node and a first backup node are associated.
In another embodiment, S303 may further include: associating the first snapshot node, the first backup node and the volume corresponding to the first snapshot node;
specifically, a first snapshot node code, a first backup node code, and a volume code corresponding to the first snapshot node are associated, so that any one code can be used to find the corresponding other codes, and the backup node of the same volume is associated with the snapshot node.
In another embodiment, after S302, the method may further include: marking the first snapshot node as a snapshot node of the latest backup;
for example, when a snapshot creating instruction is received, where the snapshot creating instruction is used to instruct to create a first snapshot node, first, table 2 is looked up to determine whether the first snapshot node is a backup node created for the first time, when no backup node exists in table 2, it is described that the first snapshot node is a backup node created for the first time, first, a first snapshot node a0 is created, snapshot data of the first snapshot node a0 is copied to form a first backup node BN0, and finally, the first snapshot node a0, the first backup node BN0, and the volume VOL0 are associated, and a snapshot node encoding flag of the latest backup in table 3 is a 0; when the backup node exists in table 2, it indicates that the first snapshot node is not the backup node created for the first time, first snapshot node a1 is created, the snapshot data of first snapshot node a1 is copied to form first backup node BN1, and finally first snapshot node a1, first backup node BN1 and volume VOL0 are associated, and the snapshot node encoding of the last backup in table 3 is marked as a1, so that the snapshot creation operation is completed.
The first snapshot node is marked as the snapshot node which is backed up last time, so that the snapshot node is convenient to judge when data is deleted, the snapshot node, the backup node and the relation between the snapshot node and the backup node are recorded in real time, management of the backup node and the snapshot node is facilitated, the efficiency of fast storage is improved, and the experience degree of a user is improved.
In the implementation of the invention, in the process of creating the snapshot, the first backup node is obtained by copying the first snapshot node, and the first snapshot node is associated with the first backup node, so that the first backup node can be used for restoring the volume data under the condition that the first snapshot node is deleted, the reliability of data restoration is improved, the operation of a user is facilitated, and good user experience is provided.
Based on the same inventive concept, the embodiment of the invention provides a snapshot deleting method which is applied to a snapshot deleting device. Fig. 4 is a flowchart illustrating a snapshot deleting method in an embodiment of the present invention, and as shown in fig. 4, the method includes:
s401: receiving a snapshot deleting instruction;
the snapshot deleting instruction is used for indicating that the first snapshot node is deleted;
s402: judging whether the first snapshot node is a snapshot node which is backed up last time or not, and obtaining a judgment result;
here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
The judgment of whether the first snapshot node is the latest backup snapshot node is to acquire the code of the first snapshot node to determine how to delete the snapshot node and the backup node, so as to release more storage space.
S403: deleting the first snapshot node, and carrying out corresponding processing on the first backup node according to a judgment result;
wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Assuming that the obtained determination result is that the first snapshot node is the snapshot node that was backed up last time, it needs to further determine whether there are other backup nodes in the volume corresponding to the first snapshot node, in another embodiment, S403 may further include:
when the first snapshot node is the snapshot node which is backed up last time, judging whether other backup nodes exist in the volume corresponding to the first snapshot node;
when other backup nodes exist in the volume corresponding to the first snapshot node, deleting the first backup node and the first snapshot node;
when the first snapshot node is a snapshot node which is backed up last time and the volume corresponding to the first snapshot node has other backup nodes, it is indicated that the other backup nodes of the volume still need to perform data recovery for the user, so that only the first backup node and the first snapshot node need to be deleted.
And when the volume corresponding to the first snapshot node does not have other backup nodes, deleting the first backup node, the first snapshot node and deleting the preorder snapshot node of the first snapshot node.
When the first snapshot node is a snapshot node which is backed up last time and the volume corresponding to the first snapshot node does not have other backup nodes, it is indicated that the snapshot node of the volume is not backed up, that is, the preamble snapshot node of the first snapshot node is redundant data, so that the first backup node, the first snapshot node and the preamble snapshot node of the first snapshot node are deleted.
Assuming that the obtained determination result is that the first snapshot node is not the snapshot node that is backed up last time, in a specific implementation process, S403 may further include:
when the first snapshot node is not the snapshot node which is backed up last time, judging whether a child node exists in the first snapshot node;
when the first snapshot node has a child node, deleting the first snapshot node and reserving the first backup node;
when the first snapshot node is not the snapshot node which is backed up last time and the first snapshot node has a child node, it is indicated that the volume is in the process of restoring the child node, and the user needs to restore the data by using the first backup node, so that the user only needs to delete the first snapshot node.
And when the child node does not exist in the first snapshot node, deleting the first snapshot node and the first backup node.
In a specific implementation process, deleting the first snapshot node and the first backup node includes:
judging whether other child nodes exist in the father node of the first snapshot node;
when the father node of the first snapshot node does not have other child nodes, deleting the first backup node, the first snapshot node and the father node of the first snapshot node;
when the first snapshot node is not the snapshot node which is backed up last time and has a child node, it is described that the parent node of the first snapshot node of the volume needs to perform data recovery, so that the parent node of the first snapshot node is not operated; when the first snapshot node is not the snapshot node which is backed up last time and the first snapshot node does not have a child node, it is indicated that the first snapshot node of the volume does not need to perform data recovery any more and the parent node of the first snapshot node does not have other child nodes, that is, the parent node of the first snapshot node does not need to perform data recovery any more, so that the first backup node and the first snapshot node are deleted and the parent node of the first snapshot node is deleted.
For example, when a snapshot deletion instruction is received, where the snapshot deletion instruction is used to instruct to delete the first snapshot node, first, it is determined whether the first snapshot node is the snapshot node that was backed up last time through table 3, and a determination result is obtained, when the snapshot deletion instruction indicates that the first snapshot node is deleted as C1, it is continuously determined whether there are other backup nodes in the volume corresponding to C1, and it can be known by referring to table 2 that there are other backup nodes in the volume corresponding to C1, then the first backup node BN5 and the first snapshot node C1 are deleted; when the deletion of the first snapshot node is indicated as a2, whether a2 is a child node is continuously determined, as shown in table 1, a2 does not have a child node, and when it is continuously determined whether a parent node a1 of a2 has other child nodes, as shown in table 1, a1 also has other child nodes B1 and C1, the first snapshot node a2 and the first backup node BN2 are deleted, and thus, the snapshot deletion operation is completed.
In the implementation of the invention, in the process of deleting the snapshot, whether the first backup node obtained by copying the first snapshot node needs to be deleted or not is judged to release the storage space while the first snapshot node is deleted, so that the first backup node is correspondingly processed when the first snapshot node needs to be deleted.
Based on the same inventive concept, an embodiment of the present invention provides a data recovery apparatus, and fig. 5 is a schematic structural diagram of the data recovery apparatus in the embodiment of the present invention, as shown in fig. 5, the apparatus includes: a first receiving module 51 and a restoring module 52;
the first receiving module 51 is configured to receive a snapshot recovery instruction, where the snapshot recovery instruction is used to instruct to recover the volume data based on the first snapshot node; the restoring module 52 is configured to restore the volume data according to the first backup node after determining the first backup node corresponding to the first snapshot node, where the first backup node is formed by copying snapshot data of the first snapshot node.
Here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
In another embodiment, the recovery module 52 may further be configured to: determining a first backup node according to a preset corresponding relation between the snapshot node and the backup node;
it should be noted that the snapshot node and the backup node of the volume are in a corresponding relationship with each other, so that a first backup node corresponding to the first snapshot node can be determined according to a preset corresponding relationship between the snapshot node and the backup node, and finally, the purpose of restoring the volume data is achieved through the first backup node.
In another embodiment, the recovery module 52 may further be configured to: and overlapping the backup data of the first backup node with the snapshot data of all the preorder snapshot nodes of the first snapshot node, and recovering the volume data.
For example, when a snapshot restore instruction is received by the first receiving module 51, where the snapshot restore instruction is used to instruct to restore the volume data based on the snapshot node a2, it is determined that the backup node corresponding to the node a2 is BN2 through the lookup table 2, and the volume data is restored to the volume VOL0 by overlapping the backup data of the node b 2 with the snapshot data of all the snapshot nodes a1 and a0 of the node a2, so that the volume data restore operation based on the node a2 is completed.
In this embodiment, the volume data can be restored by overlapping the snapshot data of the first backup node and all the pre-order snapshot nodes of the first snapshot node, and the dependency relationship between the snapshot nodes is not relied on any more, so that the technical problem that the volume data cannot be restored when the first snapshot node is deleted by a user by mistake is solved, the reliability of data restoration is improved, the user operation is facilitated, and good user experience is provided.
In the embodiment of the present invention, the data recovery apparatus obtains the first backup node by copying the first snapshot node, and then, the first backup node can be used to recover the volume data even when the first snapshot node is deleted, so that the reliability of data recovery is improved, the operation by the user is facilitated, and good user experience is provided.
Based on the same inventive concept, an embodiment of the present invention provides a snapshot creating apparatus, and fig. 6 is a schematic structural diagram of the snapshot creating apparatus in the embodiment of the present invention, as shown in fig. 6, the apparatus includes: a second receiving module 61, a creating module 62 and an associating module 63;
the second receiving module 61 is configured to receive a snapshot creating instruction, where the snapshot creating instruction is used to instruct to create the first snapshot node; the creating module 62 is configured to create a first snapshot node, and copy snapshot data of the first snapshot node to form a first backup node;
here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
An associating module 63, configured to associate at least the first snapshot node and the first backup node.
In another embodiment, the association module 63 may be further configured to: associating the first snapshot node, the current backup node and the volume corresponding to the first snapshot node;
specifically, a first snapshot node code, a first backup node code, and a volume code corresponding to the first snapshot node are associated, so that any one code can be used to find the corresponding other codes, and the backup node of the same volume is associated with the snapshot node.
In another embodiment, the association module 63 may be further configured to: after the first snapshot node is created and the data of the first snapshot node is copied to form a first backup node, the first snapshot node is marked as the snapshot node which is backed up last time.
For example, the second receiving module 61 receives a snapshot creating instruction, where the snapshot creating instruction is used to instruct to create a first snapshot node, first look up table 2 to determine whether the first snapshot node is a backup node created for the first time, when there is no backup node in table 2, it indicates that the first snapshot node is a backup node created for the first time, first create a first snapshot node a0, copy snapshot data of the first snapshot node a0 to form a first backup node BN0, and finally associate the first snapshot node a0, the first backup node BN0, and the volume VOL0, and mark a snapshot node encoding of the latest backup in table 3 as a 0; when the backup node exists in table 2, it indicates that the first snapshot node is not the backup node created for the first time, first snapshot node a1 is created, the snapshot data of first snapshot node a1 is copied to form first backup node BN1, and finally first snapshot node a1, first backup node BN1 and volume VOL0 are associated, and the snapshot node encoding of the last backup in table 3 is marked as a1, so that the snapshot creation operation is completed.
The first snapshot node is marked as the snapshot node which is backed up last time, so that the snapshot node is convenient to judge when data is deleted, the snapshot node, the backup node and the relation between the snapshot node and the backup node are recorded in real time, management of the backup node and the snapshot node is facilitated, the efficiency of fast storage is improved, and the experience degree of a user is improved.
In the implementation of the present invention, the snapshot creating apparatus obtains the first backup node by copying the first snapshot node, and associates the first snapshot node with the first backup node, so that the volume data can be restored by using the first backup node even when the first snapshot node is deleted, thereby improving the reliability of data restoration, facilitating user operation, and providing good user experience.
Based on the same inventive concept, an embodiment of the present invention provides a snapshot deleting apparatus, and fig. 7 is a schematic structural diagram of the snapshot deleting apparatus in the embodiment of the present invention, as shown in fig. 7, the apparatus includes: a third receiving module 71, a judging module 72 and a deleting module 73;
the third receiving module 71 is configured to receive a snapshot deleting instruction, where the snapshot deleting instruction is used to instruct to delete the first snapshot node; the judging module 72 is configured to judge whether the first snapshot node is a snapshot node that is backed up last time, and obtain a judgment result;
here, the volume includes a snapshot node and a backup node, and the backup node is formed by copying snapshot data of the corresponding snapshot node, for example, the first backup node is formed by copying snapshot data of the first snapshot node.
Further, the backup node is used for including information of the backup data, such as a backup data code, that is, a node code and a backup data state of the backup node, in addition to the backup data; the snapshot node includes snapshot data and a code corresponding to the snapshot data when the snapshot operation is performed each time, that is, a node code of the snapshot node, a node code of a parent node of the snapshot node, a state of the snapshot data, and the like.
The judging module 72 is used for judging whether the first snapshot node is the snapshot node which is backed up last time, so as to obtain the code of the first snapshot node, to determine how to delete the snapshot node and the backup node, thereby releasing more storage space.
The deleting module 73 is configured to delete the first snapshot node, and perform corresponding processing on the first backup node according to the determination result;
wherein the first backup node is formed by copying snapshot data of the first snapshot node.
Assuming that the obtained determination result is that the first snapshot node is the snapshot node that is backed up last time, it needs to further determine whether there are other backup nodes in the volume corresponding to the first snapshot node, in another embodiment, the deleting module 72 may further include: the first judgment submodule, the first deletion submodule and the second deletion submodule;
the first judging submodule is used for judging whether other backup nodes exist in a volume corresponding to the first snapshot node or not when the first snapshot node is the snapshot node which is backed up last time; the first deleting submodule is used for deleting the first backup node and the first snapshot node when other backup nodes exist in the volume corresponding to the first snapshot node;
in the first deletion submodule, when the first snapshot node is a snapshot node which is backed up last time and the volume corresponding to the first snapshot node has other backup nodes, it is indicated that the other backup nodes of the volume still need to perform data recovery for the user, so that only the first backup node and the first snapshot node need to be deleted.
And the second deletion submodule is used for deleting the first backup node, the first snapshot node and the preorder snapshot node of the first snapshot node when no other backup node exists in the volume corresponding to the first snapshot node.
In the second deletion submodule, when the first snapshot node is a snapshot node which is backed up last time and a volume corresponding to the first snapshot node does not have other backup nodes, it is indicated that the snapshot node of the volume is not backed up, that is, the preamble snapshot node of the first snapshot node is redundant data, so that the first backup node, the first snapshot node and the preamble snapshot node of the first snapshot node are deleted.
Assuming that the obtained determination result is that the first snapshot node is not the latest backup snapshot node, in another embodiment, the deleting module 72 may further include: a second judgment submodule, a third deletion submodule and a fourth deletion submodule;
the second judging submodule is used for judging whether a child node exists in the first snapshot node or not when the first snapshot node is not the snapshot node which is backed up last time; the third deleting submodule is used for deleting the first snapshot node and reserving the first backup node when the first snapshot node has a child node;
in the third deletion sub-module, when the first snapshot node is not the snapshot node which is backed up last time and the first snapshot node has a child node, it indicates that the volume is in the process of restoring the child snapshot node, and the user needs to restore the data by using the first backup node, so that the user only needs to delete the first snapshot node.
And the fourth deleting submodule is used for deleting the first snapshot node and the first backup node when the child node does not exist in the first snapshot node.
In another embodiment, the four deletion sub-modules are further specifically configured to:
judging whether other child nodes exist in the father node of the first snapshot node, and deleting the first backup node, the first snapshot node and the father node of the first snapshot node when other child nodes do not exist in the father node of the first snapshot node;
in the fourth deletion submodule, when the first snapshot node is not the snapshot node which is backed up last time and the first snapshot node has a child node, it is described that the parent node of the first snapshot node of the volume also needs to perform data recovery, so that the parent node of the first snapshot node is not operated; when the first snapshot node is not the snapshot node which is backed up last time and the first snapshot node does not have a child node, it is indicated that the first snapshot node of the volume does not need to perform data recovery any more and the parent node of the first snapshot node does not have other child nodes, that is, the parent node of the first snapshot node does not need to perform data recovery any more, so that the first backup node and the first snapshot node are deleted and the parent node of the first snapshot node is deleted.
For example, when the third receiving module 71 receives a snapshot deleting instruction, where the snapshot deleting instruction is used to instruct to delete the first snapshot node, first, it is determined whether the first snapshot node is the snapshot node that is backed up last time through table 3, and a determination result is obtained, and when the snapshot node that instructs to delete the first snapshot node is C1, it is continuously determined whether there are other backup nodes in the volume corresponding to C1, and it can be known by referring to table 2 that there are other backup nodes in the volume corresponding to C1, the first backup node BN5 and the first snapshot node C1 are deleted; when the deletion of the first snapshot node is indicated as a2, whether a2 is a child node is continuously determined, as shown in table 1, a2 does not have a child node, and when it is continuously determined whether a parent node a1 of a2 has other child nodes, as shown in table 1, a1 also has other child nodes B1 and C1, the first snapshot node a2 and the first backup node BN2 are deleted, and thus, the snapshot deletion operation is completed.
In the implementation of the present invention, the snapshot deleting device, while deleting the first snapshot node, determines whether the first backup node obtained by copying the first snapshot node needs to be deleted to release the storage space, and then, performs corresponding processing on the first backup node when the first snapshot node needs to be deleted.
Here, it should be noted that: the descriptions of the embodiments of the apparatus are similar to the descriptions of the methods, and have the same advantages as the embodiments of the methods, and therefore are not repeated herein. For technical details that are not disclosed in the embodiments of the apparatus of the present invention, those skilled in the art should refer to the description of the embodiments of the method of the present invention to understand, and for brevity, will not be described again here.
Here, it should be noted that:
it should be appreciated that reference throughout this specification to "one embodiment" or "an embodiment" means that a particular feature, structure or characteristic described in connection with the embodiment is included in at least one embodiment of the present invention. Thus, the appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. It should be understood that, in various embodiments of the present invention, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It should be noted that, in this document, 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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (4)

1. A snapshot deletion method, comprising:
receiving a snapshot deleting instruction, wherein the snapshot deleting instruction is used for indicating that a first snapshot node is deleted;
judging whether the first snapshot node is a snapshot node which is backed up last time or not, and obtaining a judgment result;
deleting a first snapshot node, and performing corresponding processing on a first backup node according to the judgment result, wherein the first backup node is formed by copying snapshot data of the first snapshot node; the first backup node is determined according to the corresponding relation between the preset snapshot node and the backup node; the preset corresponding relation between the snapshot node and the backup node is obtained by associating the node code of the first snapshot node, the node code of the first backup node and the volume code corresponding to the first snapshot node; the node codes of the first snapshot node and the first backup node are in one-to-one correspondence; the first snapshot node further comprises a node code of the first snapshot node and a node code of a parent node of the first snapshot node;
wherein, according to the judgment result, correspondingly processing the first backup node comprises:
when the first snapshot node is the snapshot node which is backed up at the latest time, judging whether other backup nodes exist in the volume corresponding to the first snapshot node;
when the other backup nodes exist in the volume corresponding to the first snapshot node, deleting the first backup node and the first snapshot node;
when the other backup nodes do not exist in the volume corresponding to the first snapshot node, deleting the first backup node, the first snapshot node and deleting the preorder snapshot node of the first snapshot node;
when the first snapshot node is not the latest backup snapshot node, judging whether a child node exists in the first snapshot node;
when the first snapshot node has a child node, deleting the first snapshot node and reserving the first backup node;
and when the first snapshot node does not have a child node, deleting the first snapshot node and the first backup node.
2. The method of claim 1, wherein the deleting the first snapshot node and the first backup node comprises:
judging whether other child nodes exist in the father node of the first snapshot node;
and when the parent node does not have the other child nodes, deleting the first backup node, the first snapshot node and the parent node of the first snapshot node.
3. A snapshot deletion apparatus, comprising:
a third receiving module, configured to receive a snapshot deleting instruction, where the snapshot deleting instruction is used to instruct to delete the first snapshot node;
the judging module is used for judging whether the first snapshot node is a snapshot node which is backed up last time or not and obtaining a judging result;
the deleting module is used for deleting the first snapshot node and correspondingly processing the first backup node according to the judgment result, wherein the first backup node is formed by copying snapshot data of the first snapshot node; the first backup node is determined according to the corresponding relation between the preset snapshot node and the backup node; the preset corresponding relation between the snapshot node and the backup node is obtained by associating the node code of the first snapshot node, the node code of the first backup node and the volume code corresponding to the first snapshot node; the node codes of the first snapshot node and the first backup node are in one-to-one correspondence; the first snapshot node further comprises a node code of the first snapshot node and a node code of a parent node of the first snapshot node;
wherein the deletion module comprises:
the first judging submodule is used for judging whether other backup nodes exist in the volume corresponding to the first snapshot node or not when the first snapshot node is the snapshot node which is backed up at the latest time;
a first deletion submodule, configured to delete the first backup node and the first snapshot node when the other backup nodes exist in the volume corresponding to the first snapshot node;
the second deletion submodule is used for deleting the first backup node, the first snapshot node and the preorder snapshot node of the first snapshot node when the other backup nodes do not exist in the volume corresponding to the first snapshot node;
a second judging submodule, configured to judge whether a child node exists in the first snapshot node when the first snapshot node is not the snapshot node that is backed up last time;
a third deletion submodule, configured to delete the first snapshot node and reserve the first backup node when the first snapshot node has a child node;
and the fourth deletion submodule is used for deleting the first snapshot node and the first backup node when the first snapshot node does not have a child node.
4. The apparatus according to claim 3, wherein the fourth deletion submodule is specifically configured to determine whether there are other child nodes in the parent node of the first snapshot node; and when the parent node of the first snapshot node does not exist in the other child nodes, deleting the first backup node, the first snapshot node and the parent node.
CN201511019157.XA 2015-12-30 2015-12-30 Snapshot deleting method and device Active CN106933699B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201511019157.XA CN106933699B (en) 2015-12-30 2015-12-30 Snapshot deleting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201511019157.XA CN106933699B (en) 2015-12-30 2015-12-30 Snapshot deleting method and device

Publications (2)

Publication Number Publication Date
CN106933699A CN106933699A (en) 2017-07-07
CN106933699B true CN106933699B (en) 2021-11-30

Family

ID=59442251

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201511019157.XA Active CN106933699B (en) 2015-12-30 2015-12-30 Snapshot deleting method and device

Country Status (1)

Country Link
CN (1) CN106933699B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107729052A (en) * 2017-10-16 2018-02-23 郑州云海信息技术有限公司 A kind of data manipulation method, device, equipment and computer-readable recording medium
CN110750496A (en) * 2019-10-23 2020-02-04 深信服科技股份有限公司 File copying method, system, equipment and computer readable storage medium
CN112463450B (en) * 2020-11-27 2023-12-22 北京浪潮数据技术有限公司 Incremental backup management method, system, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419564A (en) * 2008-12-11 2009-04-29 杭州华三通信技术有限公司 Method and device for recovering data by employing snapshot
CN103473277A (en) * 2013-08-27 2013-12-25 华为技术有限公司 Snapshot method and device for file systems

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100478904C (en) * 2007-07-18 2009-04-15 华为技术有限公司 Method and device for protecting snapshot
US9304867B2 (en) * 2010-09-28 2016-04-05 Amazon Technologies, Inc. System and method for providing flexible storage and retrieval of snapshot archives
US8880475B2 (en) * 2011-04-08 2014-11-04 International Business Machines Corporation Reusing snapshots in a network data management protocol backup operation
CN104375877A (en) * 2014-10-15 2015-02-25 国云科技股份有限公司 Virtual machine online snapshot generating and deleting method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101419564A (en) * 2008-12-11 2009-04-29 杭州华三通信技术有限公司 Method and device for recovering data by employing snapshot
CN103473277A (en) * 2013-08-27 2013-12-25 华为技术有限公司 Snapshot method and device for file systems

Also Published As

Publication number Publication date
CN106933699A (en) 2017-07-07

Similar Documents

Publication Publication Date Title
CN108040108B (en) Communication switching method, device, coordination server and readable storage medium
CN102902600B (en) Efficient application-aware disaster recovery
CN102594849B (en) Data backup and recovery method and device, virtual machine snapshot deleting and rollback method and device
JP6087928B2 (en) Managing object life in a cyclic graph
CN103473277B (en) The Snapshot Method and device of file system
US20160006461A1 (en) Method and device for implementation data redundancy
CN106354884B (en) Data object deleting method and device based on distributed file system
CN106933699B (en) Snapshot deleting method and device
CN107229414B (en) Storage space recovery method and device
US8954793B2 (en) Method and a storage server for data redundancy
CN111858146B (en) Method, apparatus and computer program product for recovering data
EP3474143B1 (en) Method and apparatus for incremental recovery of data
CN104216793A (en) Application program backing up and restoring method and device
CN104317676A (en) Data backup disaster tolerance method
WO2018028484A1 (en) Group restoration method, server, and storage medium
CN112463437A (en) Service recovery method, system and related components of storage cluster system offline node
CN111143113B (en) Method, electronic device and computer program product for copying metadata
CN110874185B (en) Data storage method and storage device
CN104965835A (en) Method and apparatus for reading and writing files of a distributed file system
US10877994B2 (en) Identifier based data replication
CN104903865A (en) Restoring a previous version of a virtual machine image
CN103179153A (en) Mobile terminal and mobile terminal data backup method based on cloud server
US20210240350A1 (en) Method, device, and computer program product for recovering based on reverse differential recovery
WO2017054643A1 (en) Data recovery method and file server
CN104536852A (en) Data recovery 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