A method, system, device, and storage medium based on bitmap merged snapshots
Through the bitmap merging snapshot method, data blocks in disk snapshots can be quickly positioned, and multiple snapshots can be merged simultaneously, solving the problem of inefficiency in the existing technology, improving the merging efficiency and reducing data fragmentation.
Patent Information
- Application Number
- CN202110930876.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-13
- Publication Date
- 2025-07-11
- Estimated Expiration
- 2041-08-13
AI Technical Summary
The prior art is inefficient when merging disk snapshots, and as the number of snapshots increases exponentially, resulting in a large amount of fragmentation in the original dataset.
The bitmap merging snapshot method is adopted to quickly locate data blocks in disk snapshots through bitmap files, realize simultaneous merging of multiple snapshots, and use bitmap snapshots to shorten the merging time and improve merging efficiency.
Improve the efficiency of snapshot merging, reduce merging time, enhance the flexibility of the merging process, and avoid the generation of raw data fragments.
Smart Images

Figure CN113760823B_ABST
Abstract
Description
Technical Field
[0001] This field relates to the field of file snapshots. More specifically, it particularly refers to a method, system, device, and storage medium based on bitmap merged snapshots. Background Art
[0002] Disk snapshot is a fast file system backup for the entire disk volume. The main difference from other backup methods lies in speed. When performing a disk snapshot, no file copying actions are involved. Generally, even for a large amount of data, the backup action can usually be completed within one second. Using snapshot data for testing will not cause any damage to production data. For data mining and eDiscovery applications, snapshots are also ideal test data sources. In terms of disaster recovery, snapshots are a very effective method - even the preferred one, and are very suitable for data recovery when logical errors such as malware attacks, human errors, and data corruption occur.
[0003] There is also a complex problem here, which is the deletion of snapshots. The data on the deleted snapshot must be copied to the original data volume and a consistency rollback is performed. The more snapshots are created, the complexity of maintaining snapshots will increase exponentially. These complexities include access to the original data, tracking of snapshot data and the original data volume, and data adjustment after snapshot deletion. Another serious problem directly caused is that a large amount of fragmentation will occur in the original dataset. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of the present invention is to propose a method, system, computer device, and computer-readable storage medium based on bitmap merged snapshots. The present invention quickly locates the data in the block recorded in the disk snapshot through the bitmap file. When merging multiple snapshot files, all snapshots can be merged simultaneously, which greatly improves the merging efficiency. There is no need to merge one by one. Using bitmap snapshots shortens the time for merging snapshots. Compared with the previous solutions, it is more flexible and improves the efficiency.
[0005] For the above purposes, an aspect of an embodiment of the present invention provides a method based on bitmap merging snapshots, including the following steps: determining a snapshot to be deleted in a snapshot chain, and determining a target snapshot to be merged based on the snapshot to be deleted; performing an exclusive OR operation on the bitmap of the snapshot to be deleted and the bitmap of the target snapshot to be merged respectively, and determining the final target snapshot according to the result of the exclusive OR operation; performing an OR operation on the bitmap of the snapshot to be deleted and the bitmap of the final target snapshot to obtain a new bitmap; and merging the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot, and updating the snapshot chain with the new snapshot.
[0006] In some embodiments, the merging the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot includes: determining whether the snapshot to be deleted is before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being before the final target snapshot in the snapshot chain, importing the new bitmap into the final target snapshot.
[0007] In some embodiments, the merging the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot includes: in response to the snapshot to be deleted being after the final target snapshot in the snapshot chain, importing the new bitmap into the snapshot to be deleted.
[0008] In some embodiments, the determining the target snapshot to be merged based on the snapshot to be deleted includes: using the snapshot before and the snapshot after the snapshot to be deleted in the snapshot chain as the target snapshots to be merged.
[0009] In some embodiments, the performing an exclusive OR operation on the bitmap of the snapshot to be deleted and the bitmap of the target snapshot to be merged respectively includes: in response to there being multiple consecutive snapshots to be deleted, performing an OR operation on the bitmaps of the multiple consecutive snapshots to be deleted, and performing an exclusive OR operation on the result of the OR operation and the bitmap of the target snapshot to be merged.
[0010] In some embodiments, the determining the final target snapshot according to the result of the exclusive OR operation includes: counting the number of blocks in the result of the exclusive OR operation between the bitmap of the snapshot to be deleted and the bitmap of each target snapshot to be merged, and using the target snapshot with a smaller number of blocks as the final target snapshot.
[0011] In some embodiments, the updating the snapshot chain with the new snapshot includes: disconnecting the connection between the snapshot to be deleted and the final target snapshot and the adjacent snapshots in the snapshot chain, and connecting the new snapshot and the adjacent snapshots.
[0012] On the other hand, an embodiment of the present invention provides a system based on bitmap merged snapshots, including: a determination module configured to determine snapshots to be deleted in a snapshot chain and determine target snapshots to be merged based on the snapshots to be deleted; a first calculation module configured to perform exclusive OR operations on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshots according to the results of the exclusive OR operations; a second calculation module configured to perform OR operations on the bitmaps of the snapshots to be deleted and the bitmaps of the final target snapshots to obtain a new bitmap; and an execution module configured to merge the snapshots to be deleted and the final target snapshots according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot.
[0013] In yet another aspect of the embodiments of the present invention, a computer device is further provided, including: at least one processor; and a memory storing computer instructions executable on the processor, and when the instructions are executed by the processor, the steps of the above method are implemented.
[0014] In still another aspect of the embodiments of the present invention, a computer-readable storage medium is further provided, and the computer-readable storage medium stores a computer program that implements the steps of the above method when executed by a processor.
[0015] The present invention has the following beneficial technical effects: Through the bitmap file, the data in the blocks recorded in the disk snapshot can be quickly located. When merging multiple snapshot files, all snapshots can be merged simultaneously, which greatly improves the merging efficiency. There is no need to merge them one by one. Using the bitmap snapshot shortens the time for merging snapshots. Compared with the previous solutions, it is more flexible and the efficiency is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other embodiments can be obtained based on these drawings without creative efforts.
[0017] Figure 1 It is a schematic diagram of an embodiment of the method for merging snapshots based on bitmaps provided by the present invention;
[0018] Figure 2 It is a schematic diagram of a snapshot chain;
[0019] Figure 3 It is a schematic diagram of the bitmaps of each snapshot;
[0020] Figure 4 It is a schematic diagram after performing an exclusive OR operation on the bitmaps of different target snapshots to be merged and the bitmap of the snapshot to be deleted;
[0021] Figure 5 It is a schematic diagram after performing an OR operation on the bitmap of the final target snapshot and the bitmap of the snapshot to be deleted;
[0022] Figure 6 It is a schematic diagram of snapshot merging;
[0023] Figure 7 It is a schematic diagram of updating the snapshot chain;
[0024] Figure 8 It is a schematic diagram of an embodiment of the system for merging snapshots based on bitmaps provided by the present invention;
[0025] Figure 9 It is a schematic diagram of the hardware structure of an embodiment of a computer device for merging snapshots based on bitmaps provided by the present invention;
[0026] Figure 10 It is a schematic diagram of an embodiment of a computer storage medium for merging snapshots based on bitmaps provided by the present invention. Detailed implementation manners
[0027] To make the objectives, technical solutions, and advantages of the present invention clearer and more understandable, the following further elaborates on the embodiments of the present invention in detail with reference to specific embodiments and the accompanying drawings.
[0028] It should be noted that all the expressions using "first" and "second" in the embodiments of the present invention are for distinguishing two entities or parameters with the same name but different identities. It can be seen that "first" and "second" are only for the convenience of expression and should not be construed as a limitation on the embodiments of the present invention. This will not be elaborated one by one in the subsequent embodiments.
[0029] In the first aspect of the embodiments of the present invention, an embodiment of a method for merging snapshots based on bitmaps is proposed. Figure 1 Shown is a schematic diagram of an embodiment of the method for merging snapshots based on bitmaps provided by the present invention. As Figure 1 shown, the embodiments of the present invention include the following steps:
[0030] S1. Determine the snapshot to be deleted in the snapshot chain, and determine the target snapshots to be merged based on the snapshot to be deleted;
[0031] S2. Perform an exclusive OR operation on the bitmap of the snapshot to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshot according to the result of the exclusive OR operation;
[0032] S3. Perform an OR operation on the bitmap of the snapshot to be deleted and the bitmap of the final target snapshot to obtain a new bitmap; and
[0033] S4. Merge the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot, and use the new snapshot to update the snapshot chain.
[0034] Determine the snapshot to be deleted in the snapshot chain, and determine the target snapshot to be merged based on the snapshot to be deleted. Select the snapshot to be deleted and find the position of the snapshot to be deleted in the snapshot chain. Figure 2 The figure shows a schematic diagram of the snapshot chain. As Figure 2 shown, the snapshots are arranged in order in the snapshot chain. In this embodiment, the snapshot to be deleted is snap2.
[0035] In some embodiments, determining the target snapshot to be merged based on the snapshot to be deleted includes: using the snapshot before and the snapshot after the snapshot to be deleted in the snapshot chain as the target snapshots to be merged. For example, in this embodiment, the snapshot to be deleted is snap2, then the target snapshots to be merged are snap1 and snap3.
[0036] Perform an exclusive OR operation on the bitmap of the snapshot to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshot according to the result of the exclusive OR operation. Figure 3 The figure shows a schematic diagram of the bitmaps of each snapshot. Perform an exclusive OR operation on the bitmap of the snapshot to be deleted and the bitmaps of the target snapshots to be merged respectively, that is, perform an exclusive OR operation on the bitmap bitmap2 of snap2 and the bitmaps bitmap1 of snap1 and bitmap3 of snap3 respectively, compare the two operation results, merge snap2 with the snapshot with less difference data, and if the difference amounts are the same, merge the snapshots on the left.
[0037] In some embodiments, determining the final target snapshot according to the result of the exclusive OR operation includes: counting the number of blocks in the result of the exclusive OR operation between the bitmap of the snapshot to be deleted and the bitmaps of each target snapshot to be merged, and using the target snapshot with the smaller number of blocks as the final target snapshot. Figure 4 The figure shows a schematic diagram after performing an exclusive OR operation on the bitmaps of different target snapshots to be merged and the bitmap of the snapshot to be deleted. bitmap1` is the result of performing an exclusive OR operation on bitmap1 and bitmap2, and bitmap3` is the result of performing an exclusive OR operation on bitmap3 and bitmap2. As Figure 4As shown, the number of blocks in bitmap1` is 10, and the number of blocks in bitmap3` is 5. Since the number of blocks in bitmap3` is less than that in bitmap1`, snap2 and snap3 are merged.
[0038] Perform an OR operation on the bitmap of the snapshot to be deleted and the bitmap of the final target snapshot to obtain a new bitmap. Figure 5 The figure shows a schematic diagram of the OR operation between the bitmap of the final target snapshot and the bitmap of the snapshot to be deleted, that is, the result of the OR operation between bitmap3 and bitmap2.
[0039] In some embodiments, the merging of the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot includes: determining whether the snapshot to be deleted is ranked before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being ranked before the final target snapshot in the snapshot chain, importing the new bitmap into the final target snapshot.
[0040] In some embodiments, the merging of the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot includes: in response to the snapshot to be deleted being ranked after the final target snapshot in the snapshot chain, importing the new bitmap into the snapshot to be deleted.
[0041] Figure 6 The figure shows a schematic diagram of snapshot merging. As Figure 6 shown, if the snapshot to be deleted is ranked before the final target snapshot in the snapshot chain, then using the final target snapshot as the disk file, that is, using snap3 as the disk file, starting a process, then importing bitmap2`, and then according to the change amount of the blocks recorded in bitmap2`, exporting the corresponding data to the file snap2`. If the snapshot to be deleted is ranked after the final target snapshot in the snapshot chain, then using the snapshot to be deleted as the disk file.
[0042] Merge the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot.
[0043] In some embodiments, the updating of the snapshot chain with the new snapshot includes: disconnecting the connection between the snapshot to be deleted and the final target snapshot and the adjacent snapshots in the snapshot chain, and connecting the new snapshot and the adjacent snapshots. Figure 7 The figure shows a schematic diagram of updating the snapshot chain, as Figure 7As shown, disconnect the connection between snap1 and snap2, and disconnect the connection between snap3 and snap4, and then establish the connection between snap1 and snap4 with snap2`.
[0044] In some embodiments, the XOR operation of the bitmaps of the snapshots to be deleted with the bitmaps of the target snapshots to be merged respectively includes: in response to the existence of multiple consecutive snapshots to be deleted, performing an OR operation on the bitmaps of the multiple consecutive snapshots to be deleted, and performing an XOR operation on the result of the OR operation with the bitmap of the target snapshot to be merged.
[0045] If multiple snapshots are deleted in batches, such as snap1, snap2... snapn, first merge the bitmaps of the batch of snapshots, perform an OR operation on the bitmaps of all the snapshots to be deleted to obtain a first result, then perform an XOR operation on the first result with the bitmap of snap0 to obtain a second result, perform an XOR operation on the first result with the bitmap of snap(n + 1) to obtain a third result, compare the block difference amounts of the second result and the third result. Assume that it is merged with snap0, take the last snapshot in the snapshot chain of the snapshots deleted in batches as the disk file, start a process, import the bitmap bitmap2``, according to the data of the blocks recorded in the bitmap, and then export the snapshot file snap2``.
[0046] In the embodiment of the present invention, the data in the block recorded in the disk snapshot is quickly located through the bitmap file. When multiple snapshot files are merged, all snapshots can be merged simultaneously, which greatly improves the merging efficiency. There is no need to merge one by one. Using the bitmap snapshot shortens the time for merging snapshots. Compared with the previous solution, it is more flexible and improves the efficiency.
[0047] It should be particularly noted that each step in each embodiment of the above method for merging snapshots based on the bitmap can be crossed, replaced, added, or deleted with each other. Therefore, these reasonable permutation and combination transformations for the method for merging snapshots based on the bitmap should also fall within the protection scope of the present invention, and the protection scope of the present invention should not be limited to the embodiments.
[0048] Based on the above purpose, the second aspect of the embodiment of the present invention proposes a system for merging snapshots based on the bitmap. As Figure 8As shown, system 200 includes the following modules: a determination module configured to determine the snapshots to be deleted in the snapshot chain and determine the target snapshots to be merged based on the snapshots to be deleted; a first calculation module configured to perform an exclusive OR operation on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshots according to the results of the exclusive OR operation; a second calculation module configured to perform an OR operation on the bitmaps of the snapshots to be deleted and the bitmaps of the final target snapshots to obtain a new bitmap; and an execution module configured to merge the snapshots to be deleted and the final target snapshots according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot.
[0049] In some embodiments, the execution module is configured to: determine whether the snapshot to be deleted is before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being before the final target snapshot in the snapshot chain, import the new bitmap into the final target snapshot.
[0050] In some embodiments, the execution module is configured to: in response to the snapshot to be deleted being after the final target snapshot in the snapshot chain, import the new bitmap into the snapshot to be deleted.
[0051] In some embodiments, the determination module is configured to: use the snapshot before and the snapshot after the snapshot to be deleted in the snapshot chain as the target snapshots to be merged.
[0052] In some embodiments, the first calculation module is configured to: in response to the existence of multiple consecutive snapshots to be deleted, perform an OR operation on the bitmaps of the multiple consecutive snapshots to be deleted, and perform an exclusive OR operation on the result of the OR operation and the bitmap of the target snapshot to be merged.
[0053] In some embodiments, the first calculation module is configured to: count the number of blocks in the result of the exclusive OR operation between the bitmap of the snapshot to be deleted and the bitmap of each target snapshot to be merged, and use the target snapshot with fewer block numbers as the final target snapshot.
[0054] In some embodiments, the execution module is configured to: disconnect the connection between the snapshot to be deleted and the final target snapshot and the adjacent snapshots in the snapshot chain, and connect the new snapshot and the adjacent snapshots.
[0055] In the embodiments of the present invention, the data in the block recorded in the disk snapshot is quickly located through a bitmap file. When merging multiple snapshot files, all snapshots can be merged simultaneously, which greatly improves the merging efficiency. There is no need to merge them one by one. Using the bitmap snapshot shortens the time for merging snapshots. Compared with the previous solutions, it is more flexible and the efficiency is improved.
[0056] Based on the above object, in the third aspect of the embodiments of the present invention, a computer device is proposed, including: at least one processor; and a memory, where the memory stores computer instructions that can run on the processor, and the instructions are executed by the processor to implement the following steps: S1. Determine the snapshots to be deleted in the snapshot chain, and determine the target snapshots to be merged based on the snapshots to be deleted; S2. Perform an exclusive OR operation on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshots according to the results of the exclusive OR operation; S3. Perform an OR operation on the bitmaps of the snapshots to be deleted and the bitmaps of the final target snapshots to obtain a new bitmap; and S4. Merge the snapshots to be deleted and the final target snapshots according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot.
[0057] In some embodiments, the merging of the snapshots to be deleted and the final target snapshots according to the new bitmap to obtain a new snapshot includes: determining whether the snapshot to be deleted is ranked before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being ranked before the final target snapshot in the snapshot chain, importing the new bitmap into the final target snapshot.
[0058] In some embodiments, the merging of the snapshots to be deleted and the final target snapshots according to the new bitmap to obtain a new snapshot includes: in response to the snapshot to be deleted being ranked after the final target snapshot in the snapshot chain, importing the new bitmap into the snapshot to be deleted.
[0059] In some embodiments, the determining of the target snapshots to be merged based on the snapshots to be deleted includes: using the snapshot before and the snapshot after the snapshot to be deleted in the snapshot chain as the target snapshots to be merged.
[0060] In some embodiments, the performing of the exclusive OR operation on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively includes: in response to the existence of multiple consecutive snapshots to be deleted, performing an OR operation on the bitmaps of the multiple consecutive snapshots to be deleted, and performing an exclusive OR operation on the result of the OR operation and the bitmap of the target snapshot to be merged.
[0061] In some embodiments, determining the final target snapshot according to the result of the exclusive OR operation includes: counting the number of blocks in the result of the exclusive OR operation between the bitmap of the snapshot to be deleted and the bitmap of each target snapshot to be merged, and taking the target snapshot with fewer blocks as the final target snapshot.
[0062] In some embodiments, updating the snapshot chain with the new snapshot includes: disconnecting the connection between the snapshot to be deleted and the final target snapshot and the adjacent snapshots in the snapshot chain, and connecting the new snapshot and the adjacent snapshots.
[0063] In the embodiments of the present invention, the data in the block recorded in the disk snapshot is quickly located through the bitmap file. When merging multiple snapshot files, all snapshots can be merged simultaneously, which greatly improves the merging efficiency. There is no need to merge them one by one. Using the bitmap snapshot shortens the time for merging snapshots. Compared with the previous solutions, it is more flexible and the efficiency is improved.
[0064] As Figure 9 shown, it is a schematic diagram of the hardware structure of an embodiment of the above computer device based on bitmap merging snapshots provided by the present invention.
[0065] Taking the device as Figure 9 shown as an example, this device includes a processor 301 and a memory 302.
[0066] The processor 301 and the memory 302 can be connected through a bus or other means. Figure 9 Taking the connection through the bus as an example.
[0067] The memory 302, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the method of bitmap merging snapshots in the embodiments of the present application. The processor 301 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions, and modules stored in the memory 302, that is, implements the method of bitmap merging snapshots in the above method embodiments.
[0068] The memory 302 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system and application programs required for at least one function; the data storage area can store data created according to the use of the method based on bitmap merged snapshots, etc. In addition, the memory 302 may include high-speed random access memory and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage devices. In some embodiments, the memory 302 may optionally include a memory remotely provided with respect to the processor 301, and these remote memories can be connected to the local module through a network. Examples of the above network include but are not limited to the Internet, intranet, local area network, mobile communication network, and combinations thereof.
[0069] One or more computer instructions 303 corresponding to the method based on bitmap merged snapshots are stored in the memory 302. When executed by the processor 301, the method based on bitmap merged snapshots in any of the above method embodiments is executed.
[0070] Any embodiment of the computer device executing the above method based on bitmap merged snapshots can achieve the same or similar effects as any of the foregoing method embodiments corresponding thereto.
[0071] The present invention also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program that, when executed by a processor, executes the method based on bitmap merged snapshots as described above.
[0072] As Figure 10 shown, it is a schematic diagram of an embodiment of the above computer storage medium based on bitmap merged snapshots provided by the present invention. Taking the computer storage medium as shown in Figure 10 shown as an example, the computer-readable storage medium 401 stores a computer program 402 that, when executed by a processor, executes the above method.
[0073] Finally, it should be noted that those of ordinary skill in the art can understand that all or part of the processes in the above method embodiments can be completed by instructing relevant hardware through a computer program. The program of the method based on bitmap merged snapshots can be stored in a computer-readable storage medium. When the program is executed, it may include the processes of the above method embodiments. Among them, the storage medium of the program can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. The embodiments of the above computer program can achieve the same or similar effects as any of the foregoing method embodiments corresponding thereto.
[0074] The above are exemplary embodiments disclosed by the present invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments disclosed by the present invention as defined in the claims. The functions, steps, and / or actions of the method claims according to the disclosed embodiments herein do not need to be performed in any specific order. In addition, although the elements disclosed in the embodiments of the present invention may be described or claimed in individual form, they can also be understood as plural unless explicitly limited to the singular form.
[0075] It should be understood that, as used herein, unless the context clearly supports an exception, the singular form "a" is also intended to include the plural form. It should also be understood that the "and / or" used herein refers to any and all possible combinations including one or more of the associated listed items.
[0076] The serial numbers of the disclosed embodiments of the present invention above are only for description and do not represent the superiority or inferiority of the embodiments.
[0077] Those of ordinary skill in the art can understand that all or part of the steps of implementing the above embodiments can be completed by hardware, or can be completed by instructing relevant hardware through a program. The program can be stored in a computer-readable storage medium. The above-mentioned storage medium can be a read-only memory, a disk, an optical disc, etc.
[0078] Those of ordinary skill in the art should understand that: the discussion of any of the above embodiments is only exemplary and is not intended to imply that the scope of the embodiments disclosed by the present invention (including the claims) is limited to these examples; under the concept of the embodiments of the present invention, the technical features between the above embodiments or different embodiments can also be combined, and there are many other variations in different aspects of the embodiments of the present invention as above, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention shall be included within the protection scope of the embodiments of the present invention.
Claims
1. A method based on bitmap merged snapshots, characterized in that, It includes the following steps: Determine the snapshots to be deleted in the snapshot chain, and determine the target snapshots to be merged based on the snapshots to be deleted; perform exclusive OR operations on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshots according to the results of the exclusive OR operations; Perform an OR operation on the bitmap of the snapshot to be deleted and the bitmap of the final target snapshot to obtain a new bitmap; And Merge the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot; Wherein, determining the target snapshots to be merged based on the snapshots to be deleted includes: taking the previous snapshot and the next snapshot of the snapshot to be deleted in the snapshot chain as the target snapshots to be merged; Merging the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot includes: determining whether the snapshot to be deleted is ranked before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being ranked before the final target snapshot in the snapshot chain, importing the new bitmap into the final target snapshot; in response to the snapshot to be deleted being ranked after the final target snapshot in the snapshot chain, importing the new bitmap into the snapshot to be deleted.
2. The method according to claim 1, wherein Performing the exclusive OR operations on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively includes: In response to the existence of multiple consecutive snapshots to be deleted, performing an OR operation on the bitmaps of the multiple consecutive snapshots to be deleted, and performing an exclusive OR operation on the result of the OR operation and the bitmap of the target snapshot to be merged.
3. The method according to claim 1, characterized in that Determining the final target snapshots according to the results of the exclusive OR operations includes: Counting the number of blocks in the results of the exclusive OR operations between the bitmap of the snapshot to be deleted and the bitmaps of each target snapshot to be merged, and taking the target snapshot with the smaller number of blocks as the final target snapshot.
4. The method according to claim 1, wherein Updating the snapshot chain with the new snapshot includes: Disconnecting the connections between the snapshot to be deleted and the final target snapshot and the adjacent snapshots in the snapshot chain, and connecting the new snapshot and the adjacent snapshots.
5. A system based on bitmap merged snapshots, characterized in that, It includes: A determination module configured to determine the snapshots to be deleted in the snapshot chain and determine the target snapshots to be merged based on the snapshots to be deleted; A first calculation module configured to perform exclusive OR operations on the bitmaps of the snapshots to be deleted and the bitmaps of the target snapshots to be merged respectively, and determine the final target snapshots according to the results of the exclusive OR operations; A second calculation module configured to perform an OR operation on the bitmap of the snapshot to be deleted and the bitmap of the final target snapshot to obtain a new bitmap; And An execution module configured to merge the snapshot to be deleted and the final target snapshot according to the new bitmap to obtain a new snapshot, and update the snapshot chain with the new snapshot; Wherein, the determination module is further configured to take the previous snapshot and the next snapshot of the snapshot to be deleted in the snapshot chain as the target snapshots to be merged; The execution module is further configured to determine whether the snapshot to be deleted is before the final target snapshot in the snapshot chain; and in response to the snapshot to be deleted being before the final target snapshot in the snapshot chain, import the new bitmap into the final target snapshot; in response to the snapshot to be deleted being after the final target snapshot in the snapshot chain, import the new bitmap into the snapshot to be deleted.
6. A computer device, characterized in that, Comprising: at least one processor; and a memory storing computer instructions executable on the processor, and the instructions, when executed by the processor, implement the steps of the method according to any one of claims 1-4.
7. A computer-readable storage medium storing a computer program, characterized in that, The computer program, when executed by the processor, implements the steps of the method according to any one of claims 1-4.
Citation Information
Patent Citations
Virtual machine online snapshot generating and deleting method
CN104375877A
Asynchronous snapshot volume decoupling method and apparatus
CN107291576A