Data recovery method, device and equipment

By generating a new snapshot chain, the problem of inflexible data recovery in virtual machine testing scenarios is solved according to the recovery strategy of snapshot points in the virtual machine, and the precise recovery of component data and the improvement of testing efficiency is achieved.

CN119065896APending Publication Date: 2024-12-03XFUSION DIGITAL TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411035836.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-30
Publication Date
2024-12-03

Smart Images

  • Figure CN119065896A_ABST
    Figure CN119065896A_ABST
Patent Text Reader

Abstract

The invention discloses a data recovery method, device and equipment which are used for flexibly selecting data needing to be recovered. The method comprises the following steps: acquiring a data recovery task, wherein the data recovery task comprises a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain comprises a plurality of snapshot points arranged according to a creation sequence, and each snapshot point corresponds to a component snapshot created for data generated by installing the business component after the business component is installed; traversing the original snapshot chain forwards from the last snapshot point, and if the recovery strategy of the current snapshot point is deletion, generating a new snapshot chain according to the first recovery strategy before the current snapshot point as the reserved snapshot point and the first recovery strategy after the current snapshot point as the reserved snapshot point; and performing data recovery according to the new snapshot chain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a data recovery method, device and equipment. Background Art

[0002] Usually, the target system can be deployed on a virtual machine. In the business test scenario of the target system, many different components will be installed on the target system. Components are parts that make up part of the function of the target system. For example, the target system can be a big data platform, and components include database components, message queue components, middleware components, etc. Because the test process usually requires repeated retesting, data recovery is required during the test process to reset the system environment.

[0003] After each component of the target system is successfully installed, a snapshot will be created. When the system environment needs to be reset during the test process, different snapshot points can be selected for data recovery, and the system environment is restored to the location of the selected snapshot point. The restored system environment does not contain data after the snapshot point. However, the current data recovery strategy is relatively fixed, and only a certain snapshot point can be selected to restore all the data after it, making the data recovery method inflexible and unable to select the component data to be restored on demand. Summary of the invention

[0004] In view of this, embodiments of the present application provide a data recovery method, apparatus, and device to flexibly select data to be recovered.

[0005] To solve the above problems, the technical solutions provided in the embodiments of the present application are as follows:

[0006] In a first aspect, an embodiment of the present application provides a data recovery method, the method comprising:

[0007] Acquire a data recovery task, the data recovery task including a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain includes a plurality of snapshot points arranged in a creation order, each snapshot point corresponding to a component snapshot created for data generated by installing the business component after the business component is installed;

[0008] Traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, generating a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention;

[0009] Data recovery is performed according to the new snapshot chain.

[0010] In a possible implementation, traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, generating a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention, includes:

[0011] Traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, determining the first snapshot point after the current snapshot point whose recovery policy is retention as the first merge point, and determining the first snapshot point before the current snapshot point whose recovery policy is retention as the second merge point;

[0012] The first merging point and the second merging point are linked in a snapshot chain to generate a new snapshot chain.

[0013] In a possible implementation, linking the first merging point and the second merging point into a snapshot chain to generate a new snapshot chain includes:

[0014] generating a target snapshot point according to the disk bitmap of the first merge point;

[0015] The target snapshot point is linked to the second merge point, and the target snapshot point is linked to a snapshot point subsequent to the first merge point to generate a new snapshot chain.

[0016] In a possible implementation, linking the target snapshot point with the second merge point, linking the target snapshot point with a snapshot point subsequent to the first merge point, and generating a new snapshot chain includes:

[0017] The master disk of the target snapshot point is pointed to the second merge point, and the master disk of a snapshot point after the first merge point is pointed to the target snapshot point, so as to generate a new snapshot chain.

[0018] In a possible implementation, linking the first merging point and the second merging point into a snapshot chain to generate a new snapshot chain includes:

[0019] When the first merging point is vacant, the snapshot point after the second merging point is deleted to generate a new snapshot chain.

[0020] In a possible implementation, the method further includes:

[0021] After creating the component snapshot, obtaining component information of the business component;

[0022] A component view is generated according to the component information.

[0023] In a possible implementation, the acquiring data recovery task includes:

[0024] A data recovery task generated by selecting a recovery strategy of a snapshot point in the component view is obtained.

[0025] In a second aspect, an embodiment of the present application provides a data recovery device, the device comprising:

[0026] an acquisition unit, configured to acquire a data recovery task, wherein the data recovery task includes a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain includes a plurality of snapshot points arranged in a creation order, each snapshot point corresponding to a component snapshot created after a business component is installed for data generated by installing the business component;

[0027] a generating unit, configured to traverse the original snapshot chain from the last snapshot point forward, and if the recovery policy of the current snapshot point is deletion, generate a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention;

[0028] A recovery unit is used to recover data according to the new snapshot chain.

[0029] In a third aspect, an embodiment of the present application provides a data recovery device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data recovery method as described above is implemented.

[0030] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device executes the data recovery method as described above.

[0031] It can be seen that the embodiments of the present application have the following beneficial effects:

[0032] After installing the business component, the embodiment of the present application creates a component snapshot for the data generated by the installed business component. Each component snapshot is used as a snapshot point. Then, an original snapshot chain including multiple snapshot points can be formed according to the order in which the component snapshots are created. A customized data recovery task is obtained. The data recovery task may include a recovery strategy for each snapshot point in the original snapshot chain. For example, the recovery strategy of the snapshot point is to delete or retain. By traversing the original snapshot chain from the last snapshot point forward, if the recovery strategy of a snapshot point is to delete, a new snapshot chain can be generated by linking the first snapshot points that need to be retained before and after the snapshot point. Finally, data recovery is performed based on the new snapshot chain. Therefore, when recovering data, only the data corresponding to one or some snapshot points can be deleted, thereby realizing flexible and on-demand selection of data to be restored. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of an exemplary application scenario of data recovery in an embodiment of the present application;

[0034] Figure 2 A flowchart of a data recovery method provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of establishing an original snapshot chain in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of a data recovery process in an embodiment of the present application;

[0037] Figure 5 This is a flowchart of the snapshot chain traversal algorithm in an embodiment of the present application;

[0038] Figure 6 A schematic diagram of another data recovery process in an embodiment of the present application;

[0039] Figure 7 A schematic diagram of a component view in an embodiment of the present application;

[0040] Figure 8 A schematic diagram of another data recovery process in an embodiment of the present application;

[0041] Fig. 9 A schematic diagram of a data recovery device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] In order to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0043] The embodiment of the present application provides a data recovery method, device and equipment, which generates a set of snapshot point undo algorithms, which traverse the entire original snapshot chain from the last snapshot point of the original snapshot chain according to the data recovery task, verify the snapshot points that need to be retained in the original snapshot chain, and finally generate a new snapshot chain for data recovery. The recovered data includes the data corresponding to the snapshot points retained in the data recovery task, and deletes the data corresponding to the snapshot points selected for deletion, so as to realize flexible on-demand selection of data to be restored.

[0044] In order to facilitate understanding of the data recovery method provided in the embodiment of the present application, Figure 1 See the example scenario shown in the figure. Figure 1 As shown, this figure is a schematic diagram of an exemplary application scenario provided in an embodiment of the present application.

[0045] For example, deploy the target system on virtual machine A, such as deploying a big data platform on virtual machine A. The initial environment creates snapshot 1, and after component A is installed, snapshot 2 is created. After component B is installed, snapshot 3 is created. After component C is installed, snapshot 4 is created. And so on, after component N is installed, snapshot x is created. Then the original snapshot chain includes snapshot point 1, snapshot point 2, snapshot point 3, snapshot point 4, ..., snapshot point x.

[0046] In an embodiment of the present application, if one or more components affect the test results during the test and need to be reinstalled, the data of the components to be restored can be selected as needed to generate a customized data recovery task, including whether each snapshot point is deleted or retained. For example, if you want to delete only the problematic component B, then snapshot points 1, 2, 4, ..., x in the data recovery task are retained, and snapshot point 3 corresponding to component B is deleted. Through the data recovery method provided in the embodiment of the present application, a new snapshot chain can be generated based on the first retained snapshot point 2 and snapshot point 4 before and after snapshot point 3, and data recovery can be performed based on the new snapshot chain.

[0047] Therefore, accurate data recovery can be performed based on the snapshot point of the component that needs to be retained, and the data recovery process is flexible. In the test scenario of the component installation process, the test efficiency can also be improved.

[0048] Those skilled in the art will understand that Figure 1 The framework diagram shown is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of the framework.

[0049] To facilitate understanding of the embodiments of the present application, a data recovery method provided in the embodiments of the present application is described below with reference to the accompanying drawings.

[0050] See also Figure 2As shown in FIG. 1 , this figure is a flow chart of a data recovery method provided by an embodiment of the present application, such as Figure 2 As shown, the method may include S201-S203:

[0051] S201: Acquire a data recovery task, the data recovery task including a recovery strategy for a snapshot point in an original snapshot chain, wherein the original snapshot chain includes multiple snapshot points arranged in a creation order, each snapshot point corresponding to a component snapshot created for data generated by the installed business component after the business component is installed.

[0052] The embodiments of the present application can be applied to a device for data storage, so that a data recovery method can be executed. During the data storage process, snapshots of incremental data will be created as needed, for example, snapshots are created at regular intervals, or, in a business test scenario for a target system, a snapshot is created for each component installed. Multiple snapshots can form a snapshot chain, which is a relationship chain composed of multiple snapshots. These snapshots are arranged in a chain according to the creation time, and each snapshot point on the snapshot chain corresponds to a snapshot.

[0053] In a possible implementation, the data recovery method provided in the embodiment of the present application may further include:

[0054] After the business component is installed, a component snapshot is created for the data generated by the installation of the business component. The component snapshots are combined into an original snapshot chain in the order of creation, and each component snapshot corresponds to a snapshot point in the original snapshot chain.

[0055] In the embodiment of the present application, the original snapshot chain includes multiple snapshot points arranged in the order of creation, and each snapshot point corresponds to a component snapshot created for the data generated by the installation of the business component after the business component is installed. Figure 3 As shown, a schematic diagram of establishing an original snapshot chain is shown. During the test process, each time a business component (referred to as component) is installed, a component snapshot is created for the component. A component snapshot constitutes a snapshot point. The original snapshot chain is formed in the order in which the component snapshots are created. For example, when the target system is deployed on virtual machine A, snapshot 1 is created in the initial environment, snapshot 2 is created after component A is installed, snapshot 3 is created after component B is installed, snapshot 4 is created after component C is installed, and so on, snapshot x is created after component N is installed. Then the original snapshot chain includes snapshot point 1, snapshot point 2, snapshot point 3, snapshot point 4, ..., snapshot point x.

[0056] In actual applications, snapshots can be virtual machine snapshots. A virtual machine snapshot is a copy of the state of a virtual machine at a certain moment. It can save the state of the virtual machine at a specified point in time, including the working state of the operating system and installed components on the virtual machine, and is used to restore and recover virtual machine data. After upgrading the operating system or installing new components for the virtual machine, you can create a snapshot for the virtual machine. When you need to restore the data on the virtual machine, you can quickly restore the data on the virtual machine through the snapshot.

[0057] After the original snapshot chain is generated, when data recovery is required, a data recovery task for the original snapshot chain can be obtained. The data recovery task includes the recovery strategy for each snapshot point in the original snapshot chain, and the recovery strategy includes deletion or retention. For example, if the data corresponding to snapshot point 3 in the original snapshot chain needs to be recovered, the recovery strategy of snapshot point 3 in the original snapshot chain in the data recovery task is deletion, and the recovery strategy of other snapshot points is retention.

[0058] S202: traverse the original snapshot chain from the last snapshot point forward, and if the recovery policy of the current snapshot point is deletion, generate a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention.

[0059] According to the data recovery task, the original snapshot chain is traversed from the last snapshot point forward. If the recovery policy of the current snapshot point traversed is retention, the snapshot point is retained. If the recovery policy of the current snapshot point traversed is deletion, the first snapshot point with a retention recovery policy after the current snapshot point on the original snapshot chain and the first snapshot point with a retention recovery policy before the current snapshot point on the original snapshot chain are searched. The first snapshot point with a retention recovery policy after the current snapshot point and the first snapshot point with a retention recovery policy before the current snapshot point are linked. The traversal is repeated in sequence, and a new snapshot chain is finally generated. For example, the current snapshot point traversed is snapshot point 3, and the recovery policy of snapshot point 3 is deletion. The first snapshot point with a retention recovery policy after snapshot point 3 is snapshot point 4, and the first snapshot point with a retention recovery policy before snapshot point 3 is snapshot point 2. A new snapshot chain can be generated based on snapshot points 2 and 4.

[0060] It is understandable that the first snapshot point before and after the current snapshot point with a recovery strategy of retaining may not be adjacent to the current snapshot point. For example, the current snapshot point is snapshot point 3, and the recovery strategy of snapshot point 3 is deletion. The first snapshot point after snapshot point 3 with a recovery strategy of retaining is snapshot point 5, and the first snapshot point before snapshot point 3 with a recovery strategy of retaining is snapshot point 1. Then a new snapshot chain can be generated based on snapshot points 1 and 5.

[0061] The specific implementation method of generating a new snapshot chain will be further described in subsequent embodiments and will not be repeated here.

[0062] S203: Restore data according to the new snapshot chain.

[0063] Data is restored through a new snapshot chain, and the restored data is the data retained according to the data recovery task.

[0064] After installing the business component, the embodiment of the present application creates a component snapshot for the data generated by the installed business component. Each component snapshot is used as a snapshot point. Then, an original snapshot chain including multiple snapshot points can be formed according to the order in which the component snapshots are created. A customized data recovery task is obtained. The data recovery task may include a recovery policy for each snapshot point in the original snapshot chain. For example, the recovery policy of the snapshot point is deletion or retention. By traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of a snapshot point is deletion, a new snapshot chain can be generated by linking the first snapshot point that needs to be retained before and after the snapshot point. Finally, data recovery is performed based on the new snapshot chain. Therefore, when recovering data, only the data corresponding to one or some snapshot points can be deleted, which realizes flexible and on-demand selection of data to be restored.

[0065] The following describes in detail the change process of the original snapshot chain when the snapshot point is deleted, that is, how to generate a new snapshot chain.

[0066] In a possible implementation, S202 traverses the original snapshot chain from the last snapshot point forward. If the recovery policy of the current snapshot point is deletion, based on the first snapshot point whose recovery policy is retention before the current snapshot point and the first snapshot point whose recovery policy is retention after the current snapshot point, the specific implementation of generating a new snapshot chain may include:

[0067] A1: Traverse the original snapshot chain from the last snapshot point forward. If the recovery policy of the current snapshot point is delete, the first snapshot point after the current snapshot point with a recovery policy of retain is determined as the first merge point, and the first snapshot point before the current snapshot point with a recovery policy of retain is determined as the second merge point.

[0068] In the original snapshot chain, traverse forward one by one starting from the last snapshot point. For the currently traversed snapshot point, if the recovery policy of the current snapshot point is deletion, find the first snapshot point whose recovery policy is retention after the current snapshot point on the original snapshot chain as the first merge point. The snapshot point whose recovery policy is deletion can be simply referred to as the undo point, and the snapshot point whose recovery policy is retention can be simply referred to as the retention point. For example, the original snapshot chain includes snapshot point 1, snapshot point 2, snapshot point 3, and snapshot point 4 in the order of creation. Traverse forward from snapshot point 4. If the currently traversed snapshot point 3 is an undo point and snapshot point 4 is the first retention point after snapshot point 3, then snapshot point 4 can be determined as the first merge point.

[0069] Continue to traverse the original snapshot chain along the traversal direction. If a snapshot point whose recovery strategy is to be retained is found, that is, the first retained point before the above current snapshot point is found, then the snapshot point is determined as the second merge point. For example, according to the above example, snapshot point 3 is the undo point, and the traversal continues to snapshot point 2. Snapshot point 2 is the first retained point before snapshot point 3, then snapshot point 2 can be determined as the second merge point.

[0070] A2: Link the first merge point and the second merge point into a snapshot chain to generate a new snapshot chain.

[0071] The first merge point and the second merge point are the first retention points before and after the undo point. The first merge point and the second merge point are linked to form a snapshot chain, and the data corresponding to the undo point is deleted from the generated new snapshot chain, thereby achieving flexible data recovery.

[0072] In a possible implementation, A2 links the first merge point and the second merge point into a snapshot chain, and a specific implementation of generating a new snapshot chain may include:

[0073] B1: Generate the target snapshot point according to the disk bitmap of the first merge point.

[0074] B2: Link the target snapshot point with the second merge point, and link the target snapshot point with the next snapshot point after the first merge point to generate a new snapshot chain.

[0075] A disk bitmap is a data structure used to manage free and used areas of a disk. It is a bit vector or bit array that is equal to the size of the disk, and each bit represents a block or sector on the disk. Disk bitmaps are usually used in file systems or storage systems to track the allocation of each block on the disk. Each bit (usually a binary bit) can represent the status of the corresponding block, such as 0 for free and 1 for used. Through the disk bitmap, you can quickly query and manage free and used blocks on the disk. When a new block needs to be allocated, you can find the first free bit in the bitmap and set it to the used state. When you need to release a used block, you can set the corresponding bitmap position to the free state.

[0076] In actual applications, each snapshot point corresponds to a disk bitmap. In order not to modify the original snapshot chain directly, that is, not to directly delete the undo point in the original snapshot chain, causing unpredictable failures. The target snapshot point can be generated based on the disk bitmap copy of the first merge point, and the snapshot data of the generated target snapshot point is actually consistent with the snapshot data of the first merge point. Then the first merge point is replaced with the target snapshot point, and the target snapshot point is linked to the second merge point, thereby deleting the undo point between the first merge point and the second merge point. It can be understood that if the next snapshot point of the first merge point is a retention point, the target snapshot point can also be linked to the next snapshot point of the first merge point to generate a new snapshot chain.

[0077] In a possible implementation, B2 links the target snapshot point with the second merge point, and links the target snapshot point with a snapshot point after the first merge point. The specific implementation of generating a new snapshot chain may include:

[0078] The master disk of the target snapshot point is pointed to the second merge point, and the master disk of the snapshot point after the first merge point is pointed to the target snapshot point, so as to generate a new snapshot chain.

[0079] See also Figure 4As shown, a schematic diagram of the data recovery process in an embodiment of the present application is shown. For example, the original snapshot chain includes snapshot point 1, snapshot point 2, snapshot point 3, snapshot point 4, ..., snapshot point x, and in the data recovery task, snapshot point 1, snapshot point 2, snapshot point 4, ..., snapshot point x are retained, and snapshot point 3 is deleted. When traversing to snapshot point 3, it is determined that snapshot point 3 is an undo point, and the first retention point after snapshot point 3 is snapshot point 4, and snapshot point 4 is the first merge point. The first retention point before snapshot point 3 is snapshot point 2, and snapshot point 2 is the second merge point. Then the disk bitmap bitmap of snapshot point 4 is searched, and a new target snapshot point (snapshot point 4') is generated by copying the bitmap, and the base disk (mother disk) of the target snapshot point is pointed to snapshot point 2, and the base disk of the next snapshot point x of snapshot point 4 is pointed to the target snapshot point. Generate a new snapshot chain including snapshot point 1, snapshot point 2, snapshot point 4', ..., snapshot point x.

[0080] In a possible implementation, A2 links the first merge point and the second merge point into a snapshot chain, and a specific implementation of generating a new snapshot chain may include:

[0081] When the first merge point is vacant, the snapshot points after the second merge point are deleted to generate a new snapshot chain.

[0082] In one scenario, the first merge point is empty, which means that there is no retention point after the snapshot point whose recovery strategy is deletion in step A1, and then all snapshot points after the second merge point need to be deleted to generate a new snapshot chain.

[0083] Based on the above description, the present application embodiment provides a traversal algorithm for the original snapshot chain. Figure 5 , which shows a flowchart of the snapshot chain traversal algorithm.

[0084] Traverse the original snapshot chain from the last snapshot point. If the current snapshot point is a revocation point, determine whether the next snapshot point is a revocation point. The next snapshot point refers to the next snapshot point after the current snapshot point on the original snapshot point, that is, the snapshot point that is earlier than the current snapshot point in the traversal order. If the next snapshot is not a revocation point, determine the next snapshot point as the first merge point and continue to traverse the original snapshot chain. If the next snapshot point is a revocation point, update the flag bit of the current snapshot point to true (true), and continue to traverse the original snapshot chain. Each snapshot point has a flag bit to indicate whether it is a revocation point. If the flag bit is true, it means that the snapshot point is a revocation point, and if the flag bit is false, it means that the snapshot point is a retention point.

[0085] If the current snapshot point is not a revocation point, determine whether the next snapshot point is a revocation point. If the next snapshot point is not a revocation point, record the position of the current snapshot point, update the flag to false, and continue to traverse the original snapshot chain. If the next snapshot point is a revocation point, determine the current snapshot point as the second merge point, and merge the first merge point with the second merge point.

[0086] During the merging process between the first merge point and the second merge point, determine whether the first merge point is empty. If the first merge point is empty, delete the snapshot point after the second merge point, that is, roll back to the second merge point. If the first merge point is not empty, link the first merge point and the second merge point, update the flag bit of the current snapshot point to false, and continue to traverse the original snapshot chain.

[0087] Therefore, the entire original snapshot chain can be efficiently traversed according to the data recovery task, and a new snapshot chain can be generated for flexible data recovery.

[0088] Based on the above snapshot chain traversal algorithm, for example, if a snapshot point is deleted, see Figure 4 As shown, it is a schematic diagram of the data recovery process in this scenario. For related instructions, please refer to the above embodiment, which will not be repeated here.

[0089] If you want to delete two or more snapshot points, see Figure 6 The figure shows a schematic diagram of the data recovery process in this scenario. For example, the original snapshot chain includes snapshot point 1, snapshot point 2, snapshot point 3, snapshot point 4, snapshot point 5, ..., snapshot point x. In the data recovery task, snapshot point 1, snapshot point 2, snapshot point 4, ..., snapshot point x are retained, and snapshot point 3 and snapshot point 5 are deleted.

[0090] Based on the snapshot chain traversal algorithm, when traversing to snapshot point 5, it can be determined that snapshot point x is the first merge point and snapshot point 4 is the second merge point. When traversing to snapshot point 3, it can be determined that snapshot point 4 is the first merge point and snapshot point 2 is the second merge point. Find the disk bitmap bitmap of snapshot point 4, generate a new target snapshot point (snapshot point 4') by copying the bitmap, and point the base disk (mother disk) of the target snapshot point (snapshot point 4') to snapshot point 2; find the disk bitmap bitmap of snapshot point x, generate a new target snapshot point (snapshot point x') by copying the bitmap, and point the base disk (mother disk) of the target snapshot point (snapshot point x') to snapshot point 4'. Generate a new snapshot chain including snapshot point 1, snapshot point 2, snapshot point 4', ..., snapshot point x'.

[0091] Therefore, when data recovery is required, the snapshot points that need to be deleted in the snapshot chain can be deleted according to the data recovery task, which is more flexible.

[0092] The main application scenario of the embodiment of the present application is a business testing scenario based on a cloud platform. In order to minimize the number of times the testing process environment is reset and improve testing efficiency, the embodiment of the present application implements visual management of components based on snapshot points and formulates data recovery tasks on demand for data recovery.

[0093] In a possible implementation, the data recovery method provided in the embodiment of the present application may further include:

[0094] C1: After creating a component snapshot, obtain component information of the business component.

[0095] C2: Generate component view based on component information.

[0096] After creating a component snapshot, you can also obtain component information of the business component, such as the component name, corresponding snapshot point, etc., and mark the mapping relationship between the generated business component and the snapshot point to generate a component view. After all business components are installed, a component view is presented, which contains all installed business components.

[0097] The installed components can be visually presented through the component view, and the installed components can be clearly displayed to avoid incomplete component installation or repeated verification of installed components through the background.

[0098] When the test process requires resetting the environment and undoing the data generated by one or more components, you can select the components to be retained or deleted through the component view and submit a data recovery task, making the submission of data recovery tasks more convenient.

[0099] See also Figure 7 As shown, a schematic diagram of the component view is shown. The user can select the components to be retained or deleted through the component view, that is, select the recovery strategy of the snapshot point in the component view, for example, delete component B (then the recovery strategy corresponding to snapshot point 3 is deletion), thereby submitting the data recovery task.

[0100] In a possible implementation, the specific implementation of S201 acquiring the data recovery task may include:

[0101] Get the data recovery task generated by selecting the recovery policy of the snapshot point in the component view.

[0102] Based on the above description, you can obtain the data recovery tasks customized by the user through the component view to perform subsequent data recovery methods. Figure 8 As shown, the complete process of determining data recovery tasks and performing data recovery through the component view is shown.

[0103] It is understandable that the components installed during the business test are independent of each other or partially independent, and the components that need to be restored do not have dependencies on other components. Therefore, data recovery does not affect the dependencies between components and does not affect the entire test business.

[0104] In this way, when data recovery is required, a data recovery task can be formulated according to the component view to retain the data generated by the components that need to be retained. When the environment needs to be reset during the test process, the impact of the residual configuration of the previous component on the test effect can be avoided. Through the embodiment of the present application, the components that need to be deleted can be restored on demand, which maximizes the reduction of the preparation time of the test environment and the increased test attempt cost, allowing more attention to the test and improving the overall test efficiency.

[0105] Based on a data recovery method provided by the above method embodiment, the embodiment of the present application also provides a data recovery device, which will be described below in conjunction with the accompanying drawings.

[0106] See also Fig. 9 As shown in FIG. 1 , this figure is a schematic diagram of the structure of a data recovery device provided in an embodiment of the present application. Fig. 9 As shown, the data recovery device includes:

[0107] A first acquisition unit 901 is used to acquire a data recovery task, wherein the data recovery task includes a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain includes multiple snapshot points arranged in a creation order, each snapshot point corresponds to a component snapshot created after the business component is installed for data generated by the installation of the business component;

[0108] A first generating unit 902 is configured to traverse the original snapshot chain from the last snapshot point forward, and if the recovery policy of the current snapshot point is deletion, generate a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention;

[0109] The recovery unit 903 is used to recover data according to the new snapshot chain.

[0110] In a possible implementation, the generating unit includes:

[0111] a determination subunit, configured to traverse the original snapshot chain from the last snapshot point forward, and if the recovery policy of the current snapshot point is deletion, determine the first snapshot point after the current snapshot point whose recovery policy is retention as the first merge point, and determine the first snapshot point before the current snapshot point whose recovery policy is retention as the second merge point;

[0112] The first generating subunit is used to link the first merging point and the second merging point into a snapshot chain to generate a new snapshot chain.

[0113] In a possible implementation, the first generating subunit includes:

[0114] A second generating subunit, configured to generate a target snapshot point according to the disk bitmap of the first merging point;

[0115] The linking subunit is used to link the target snapshot point with the second merging point, and link the target snapshot point with a snapshot point after the first merging point, so as to generate a new snapshot chain.

[0116] In a possible implementation, the link subunit is specifically used for:

[0117] The master disk of the target snapshot point is pointed to the second merge point, and the master disk of a snapshot point after the first merge point is pointed to the target snapshot point, so as to generate a new snapshot chain.

[0118] In a possible implementation manner, the first generating subunit is specifically used for:

[0119] When the first merging point is vacant, the snapshot point after the second merging point is deleted to generate a new snapshot chain.

[0120] In a possible implementation manner, the device further includes:

[0121] A second acquisition unit, configured to acquire component information of the business component after creating a component snapshot;

[0122] The second generating unit is used to generate a component view according to the component information.

[0123] In a possible implementation manner, the first acquiring unit is specifically configured to:

[0124] A data recovery task generated by selecting a recovery strategy of a snapshot point in the component view is obtained.

[0125] In addition, an embodiment of the present application also provides a data recovery device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data recovery method as described in any one of the above items is implemented.

[0126] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device executes any of the data recovery methods described above.

[0127] An embodiment of the present application further provides a computer program product, including computer program instructions, which, when executed on a computer, enable the computer to execute any of the data recovery methods described above.

[0128] After installing the business component, the embodiment of the present application creates a component snapshot for the data generated by the installed business component. Each component snapshot is used as a snapshot point. Then, an original snapshot chain including multiple snapshot points can be formed according to the order in which the component snapshots are created. A customized data recovery task is obtained. The data recovery task may include a recovery policy for each snapshot point in the original snapshot chain. For example, the recovery policy of the snapshot point is deletion or retention. By traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of a snapshot point is deletion, a new snapshot chain can be generated by linking the first snapshot point that needs to be retained before and after the snapshot point. Finally, data recovery is performed based on the new snapshot chain. Therefore, when recovering data, only the data corresponding to one or some snapshot points can be deleted, which realizes flexible and on-demand selection of data to be restored.

[0129] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the system or device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.

[0130] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0131] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0132] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.

[0133] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A data recovery method, characterized in that: The method comprises: Acquire a data recovery task, the data recovery task including a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain includes a plurality of snapshot points arranged in a creation order, each snapshot point corresponding to a component snapshot created after the business component is installed for data generated by the installation of the business component; Traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, generating a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention; Data recovery is performed according to the new snapshot chain.

2. The method according to claim 1, characterized in that The traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, generating a new snapshot chain according to the first snapshot point whose recovery policy is retention before the current snapshot point and the first snapshot point whose recovery policy is retention after the current snapshot point, includes: Traversing the original snapshot chain from the last snapshot point forward, if the recovery policy of the current snapshot point is deletion, determining the first snapshot point after the current snapshot point whose recovery policy is retention as the first merge point, and determining the first snapshot point before the current snapshot point whose recovery policy is retention as the second merge point; The first merging point and the second merging point are linked in a snapshot chain to generate a new snapshot chain.

3. The method according to claim 2, characterized in that The linking the first merging point and the second merging point into a snapshot chain to generate a new snapshot chain includes: generating a target snapshot point according to the disk bitmap of the first merge point; The target snapshot point is linked to the second merge point, and the target snapshot point is linked to a snapshot point subsequent to the first merge point to generate a new snapshot chain.

4. The method according to claim 3, characterized in that The linking of the target snapshot point with the second merge point, and linking of the target snapshot point with a snapshot point subsequent to the first merge point, to generate a new snapshot chain, includes: The master disk of the target snapshot point is pointed to the second merge point, and the master disk of the snapshot point after the first merge point is pointed to the target snapshot point, so as to generate a new snapshot chain.

5. The method according to claim 2, characterized in that: The linking the first merging point and the second merging point into a snapshot chain to generate a new snapshot chain includes: When the first merging point is vacant, the snapshot point after the second merging point is deleted to generate a new snapshot chain.

6. The method according to claim 1, characterized in that The method further comprises: After creating the component snapshot, obtaining component information of the business component; A component view is generated according to the component information.

7. The method according to claim 6, characterized in that The task of obtaining data recovery includes: A data recovery task generated by selecting a recovery strategy of a snapshot point in the component view is obtained.

8. A data recovery device, characterized in that: The device comprises: an acquisition unit, configured to acquire a data recovery task, wherein the data recovery task includes a recovery strategy of a snapshot point in an original snapshot chain; the original snapshot chain includes a plurality of snapshot points arranged in a creation order, each snapshot point corresponding to a component snapshot created after a business component is installed for data generated by installing the business component; a generating unit, configured to traverse the original snapshot chain from the last snapshot point forward, and if the recovery policy of the current snapshot point is deletion, generate a new snapshot chain according to the first snapshot point whose recovery policy before the current snapshot point is retention and the first snapshot point whose recovery policy after the current snapshot point is retention; A recovery unit is used to recover data according to the new snapshot chain.

9. A data recovery device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the data recovery method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on the terminal device, the terminal device executes the data recovery method according to any one of claims 1 to 7.