Snapshot deletion method and device, electronic equipment and storage medium
By judging the write protection capacity of the snapshot volume and copying data that has not been redirected in the source data volume to the snapshot volume, the problem of poor snapshot deletion performance in the prior art is solved, and efficient data in writing multiple data scenarios is achieved deal with.
Patent Information
- Application Number
- CN202411190671.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-20
- Estimated Expiration
- 2044-08-27
AI Technical Summary
When the existing ROW snapshot deletion mechanism writes a lot of data, it takes a long time to copy data to the source data volume, resulting in poor snapshot deletion performance.
By determining whether the write protection capacity of the snapshot volume exceeds the preset threshold, if it exceeds, copy the data whose pointer in the source data volume has not been redirected to the snapshot volume, and configure the full data snapshot volume as the target source data volume to reduce the The amount of data copied.
It effectively reduces the amount of data that needs to be copied and the processing volume, and improves the performance of snapshot deletion, especially in scenarios where more data is written after the snapshot.
Smart Images

Figure CN119166051A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer storage technology, and in particular to a snapshot deletion method, device, electronic device and storage medium. Background Art
[0002] In the storage field, snapshot technology is often used for data storage security. According to the definition of SNIA (Storage Networking Industry Association), a snapshot is a fully available copy of a specified data set (such as a storage volume). With the innovation of storage technology and the development of write-intensive storage systems and distributed storage systems, ROW (Redirect-On-Write) snapshot technology has been widely used.
[0003] In the existing ROW snapshot mechanism, the source data volume only stores the original data, that is, the data content before the snapshot is generated. When a ROW snapshot is created, a snapshot volume is generated, and the new data is written to this snapshot volume. The pointer is updated in the mapping table of the source data volume and redirected to the snapshot volume pointer. To delete a ROW-based snapshot, the data on the snapshot volume needs to be copied to the source data volume, and then the snapshot volume is deleted.
[0004] In actual application, there is a problem with the existing ROW snapshot mechanism: if a large amount of data is written after the snapshot is generated, that is, the snapshot protection capacity is large, it will take a long time to copy the data to the source data volume before deleting the snapshot, and the snapshot deletion performance will be worse. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a snapshot deletion method, device, electronic device and storage medium, so as to effectively reduce the amount of data that needs to be copied when deleting a snapshot, reduce write amplification in data processing and improve the performance of snapshot deletion. The specific technical solution is as follows:
[0006] In a first aspect of the present application, a snapshot deletion method is provided, the method comprising:
[0007] In response to receiving a snapshot deletion instruction, determining whether the protection capacity of the snapshot volume written exceeds a preset threshold; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW;
[0008] If yes, copy the first data in the source data volume to the snapshot volume to obtain a full data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected;
[0009] The source data volume is deleted, and the full data snapshot volume is configured as the target source data volume.
[0010] Optionally, the step of configuring the full data snapshot volume as the target source data volume includes:
[0011] The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume.
[0012] Optionally, the attribute information includes one or more of the following: an identification ID of the data volume, and a storage pool to which the data volume belongs.
[0013] Optionally, the method further includes:
[0014] If the protection capacity written to the snapshot volume is less than or equal to the preset threshold, the second data in the snapshot volume is copied to the source data volume; the second data is the data written to the snapshot volume after the snapshot is created.
[0015] Optionally, the preset threshold is related to the capacity of the source data volume;
[0016] The preset threshold is a first percentage of the capacity of the source data volume, and the first percentage is in a range of 50%-100%.
[0017] Optionally, the snapshot deletion instruction is a deletion instruction for a target snapshot; the target snapshot is: an Nth snapshot created based on ROW for a source data volume;
[0018] The method further comprises:
[0019] If it is determined that the protection capacity of the snapshot volume written to the target snapshot exceeds the preset threshold, the following steps are performed:
[0020] Copying the first data in the source data volume to the snapshot volume of the target snapshot, and copying the third data in the snapshot data volume of the i-th snapshot created before the target snapshot to the snapshot volume of the target snapshot, to obtain a full data snapshot volume of the N-th snapshot; the third data is data whose pointer is not redirected; wherein i is a positive integer greater than or equal to 1 and less than N;
[0021] The source data volume is deleted, and the full data snapshot volume of the Nth snapshot is configured as the target source data volume.
[0022] In a second aspect of the present application, a snapshot deletion device is provided, the device comprising:
[0023] A judgment module, configured to judge whether the protection capacity of the snapshot volume written to the snapshot volume exceeds a preset threshold in response to receiving a snapshot deletion instruction; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW;
[0024] A first copy module, configured to copy first data in the source data volume to the snapshot volume to obtain a full data snapshot volume if the judgment result of the judgment module is yes; the first data is data in the source data volume whose pointer is not redirected;
[0025] A configuration module is used to delete the source data volume and configure the full data snapshot volume as a target source data volume.
[0026] Optionally, the configuration module is specifically used to:
[0027] The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume.
[0028] Optionally, the attribute information includes one or more of the following: an identification ID of the data volume, and a storage pool to which the data volume belongs.
[0029] Optionally, the device further comprises:
[0030] The second copy module is used to copy the second data in the snapshot volume to the source data volume if the judgment result of the judgment module is no; the second data is the data written to the snapshot volume after the snapshot is created.
[0031] Optionally, the preset threshold is related to the capacity of the source data volume;
[0032] The preset threshold is a first percentage of the capacity of the source data volume, and the first percentage is in a range of 50%-100%.
[0033] Optionally, the snapshot deletion instruction is a deletion instruction for a target snapshot; the target snapshot is: an Nth snapshot created based on ROW for a source data volume;
[0034] The device also includes:
[0035] The third copy module is used to: copy the first data in the source data volume to the snapshot volume of the target snapshot, and copy the third data in the snapshot data volume of the i-th snapshot created before the target snapshot to the snapshot volume of the target snapshot, so as to obtain the full data snapshot volume of the N-th snapshot; the third data is the data whose pointer is not redirected; wherein i is a positive integer greater than or equal to 1 and less than N;
[0036] The second configuration module is used to delete the source data volume and configure the full data snapshot volume of the Nth snapshot as the target source data volume.
[0037] In a third aspect of the present application, an electronic device is provided, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0038] Memory, used to store computer programs;
[0039] The processor is used to implement any of the steps of the snapshot deletion method when executing the program stored in the memory.
[0040] According to a fourth aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the steps of the snapshot deletion method is implemented.
[0041] In a fifth aspect of the present application, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the snapshot deletion methods described above.
[0042] Beneficial effects of the embodiments of the present application:
[0043] By using the snapshot deletion method, device, electronic device and storage medium provided in the embodiments of the present application, the storage system receives a snapshot deletion instruction and determines whether the protection capacity of the written snapshot volume exceeds a preset threshold; the snapshot volume is generated by creating a snapshot of the source data volume based on write-time redirection ROW; if so, the first data in the source data volume is copied to the snapshot volume to obtain a full data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected; the source data volume is deleted, and the full data snapshot volume is configured as the target source data volume.
[0044] Therefore, in a storage system that uses ROW snapshot technology, when deleting a snapshot, the protection capacity of the snapshot volume is judged. If the protection capacity is large, the data in the source data volume whose pointers are not redirected is copied to the snapshot volume, and the full data snapshot volume is configured as the target source data, that is, the source data volume containing the full data, which is equivalent to executing the snapshot deletion instruction. Compared with the snapshot deletion scheme in the related art, the data that needs to be copied is greatly reduced. Since the processing volume and time required to configure the full data snapshot volume as the target source data are much less than the processing volume and time required to copy the data, in the scenario where a lot of data is written after the snapshot, the existing ROW mechanism of deleting the snapshot and only copying the data once is continued, which effectively reduces the amount of data that needs to be copied, reduces the write amplification in data processing, and improves the performance of snapshot deletion.
[0045] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0047] Figure 1 A schematic diagram of a snapshot deletion solution in the related art;
[0048] Figure 2 A schematic diagram of a flow chart of a snapshot deletion method provided in an embodiment of the present application;
[0049] Figure 3 A schematic diagram of a snapshot deletion method provided in an embodiment of the present application;
[0050] Figure 4 Another flowchart of the snapshot deletion method provided in the embodiment of the present application;
[0051] Figure 5 A schematic diagram of multiple consecutive snapshot data writing provided by an embodiment of the present application;
[0052] Figure 6 A schematic diagram of the storage location of data written by multiple consecutive snapshots in a storage space provided by an embodiment of the present application;
[0053] Figure 7 Another schematic diagram of the storage location of multiple consecutive snapshot write data in the storage space provided in the embodiment of the present application
[0054] Figure 8 A schematic diagram of a structure of a snapshot deletion device provided in an embodiment of the present application;
[0055] Fig. 9 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0056] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0057] In order to facilitate the understanding of this solution, relevant technical terms are introduced.
[0058] Snapshot: A fully usable copy of a specified set of data, which includes an image of the corresponding data at a certain point in time (the time when the copy starts). A snapshot can be a copy of the data it represents, or a replica of the data. In more specific technical details, a snapshot is a reference mark or pointer to the data stored in a storage device. A snapshot is similar to a detailed data address directory table, but in a computer, a snapshot is treated as a complete data backup.
[0059] The role of snapshot technology: It can mainly perform online data recovery. When a storage device fails or is damaged, it can perform instant data recovery and restore the storage status to the state at the snapshot time point. It can also provide another data access channel. When the source data is processed online, users can choose to access the snapshot data and apply the snapshot to testing and other work. Therefore, all storage systems, regardless of high, medium or low-end, as long as they are applied to online systems, snapshots become an indispensable function. Snapshots play an increasingly important role in the backup and data protection process.
[0060] ROW: Redirect-on-write snapshot technology redirects write requests to the data volume to the storage space reserved for the snapshot after the snapshot is created, and directly writes new data to the snapshot volume instead of overwriting the original data in the source data volume.
[0061] Source data volume: the volume where the source data for which snapshot operation is required is located.
[0062] Snapshot volume: A logical data copy generated after a snapshot is created on the source data volume.
[0063] Protected capacity of the snapshot volume: the capacity of the snapshot volume for newly written data compared to the source data volume.
[0064] See also Figure 1 , is a schematic diagram of a snapshot deletion solution in the related art. In order to intuitively reflect the capacity of the source data volume, a table is used to represent the storage space. It is assumed that the capacity of the storage space corresponding to each table is the same. Figure 1 As shown in the figure, the source data volume stores 9 copies of data, numbered 1-9, and the size of each copy of data is the same. After the snapshot is created, based on the redirect-on-write mechanism, all newly written data are redirected to the snapshot volume, such as Figure 1 As shown, there are 6 copies of data written after the snapshot, numbered 11-16. Assuming that a snapshot deletion instruction is to be executed, the data is copied to the source data volume before deleting the snapshot, that is, the 6 newly written copies of the data are copied to the corresponding positions in the source data volume respectively, and then the snapshot volume is deleted.
[0065] It can be seen that under the current ROW snapshot deletion mechanism, if the protection capacity is higher, more data will be copied to the source data volume when deleting the snapshot. Since the data that needs to be copied back to the source data volume has been written once, it needs to be written again during the process of moving to the source data volume. This process will cause write amplification. The more data that needs to be copied, the greater the write amplification and the worse the deletion performance.
[0066] In order to solve the above technical problems, the embodiments of the present application provide a snapshot deletion method, device, electronic device and storage medium. Figure 2 , is a flow chart of a snapshot deletion method provided in an embodiment of the present application, such as Figure 2 As shown, the method comprises the following steps:
[0067] S201: In response to receiving a snapshot deletion instruction, determine whether the protection capacity of the snapshot volume written exceeds a preset threshold; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write. If so, execute S202.
[0068] The snapshot deletion method provided in the embodiment of the present application can be applied to a controller in a storage system.
[0069] Those skilled in the art will understand that the object of the snapshot is a LUN (Logical Unit Number). A LUN is an independent logical unit in a storage device that can be identified and accessed by an operating system or application. A storage device can contain multiple LUNs, and each LUN can be regarded as an independent storage volume or logical disk.
[0070] The snapshot deletion method provided in the embodiment of the present application is applicable to the ROW snapshot mechanism, that is, the snapshot volume is generated by creating a snapshot of the source data volume based on the ROW mechanism.
[0071] The source data volume involved in the embodiments of the present application may be expressed as a source LUN. The source LUN includes a MetaVolume (metadata volume) and a Data Volume (data volume). The Meta Volume records the storage location of the source data in the source LUN. The Data Volume records the business data stored in the source LUN.
[0072] Meta Volume Data Volume G0 Data0 G1 Data1 G2 Data2 G3 Data3
[0073] Table 1
[0074] As an example, see Table 1, which is a schematic table of Meta Volume and Data Volume in the source data volume. G0-G3 contained in Meta Volume can also be understood as the logical address where the data is stored, and Data0-Data3 contained in Data Volume represents the data stored under the logical address.
[0075] After creating a snapshot of the source LUN, the logically generated data copy is the snapshot volume. In the embodiment of the present application, the snapshot volume involved is expressed as a snapshot LUN. The snapshot LUN includes a Snapshot Meta Volume and a Snapshot Data Volume.
[0076] After a snapshot is created, the Snapshot Meta Volume and Snapshot Data Volume are empty and do not contain any data. As shown in Table 2, the elements contained in the Snapshot Meta Volume and Snapshot Data Volume are all Null.
[0077] Snapshot Meta Volume Snapshot Data Volume Null Null Null Null Null Null Null Null
[0078] Table 2
[0079] In addition, when creating a snapshot, a copy of the source data mapping table is used as the snapshot data mapping table. At this time, the pointer records of the two tables are the same. See Table 3, which is a schematic table of the source data mapping table. The mapping table is used to record the changes of data at a certain point in time. In Table 3, G0-G3 represents the address, Time0-Time3 represents the time point, and 0 represents that the data corresponding to the address has not been changed at this time.
[0080] Address / Time Time0 Time1 Time2 Time3 G0 0 0 0 0 G1 0 0 0 0 G2 0 0 0 0 G3 0 0 0 0
[0081] Table 3
[0082] If the application server sends a write request at Time1 to modify the data "Data1" to "DataX", combined with Table 1, it can be seen that the address corresponding to "Data1" is "G1", that is, the data corresponding to address G1 is overwritten at Time1. Since the write is redirected to the snapshot volume, the data corresponding to G1 in the source data volume is not changed. However, the source data mapping table is updated and changed to Table 4. "1" in Table 4 indicates that the data corresponding to the address at this moment is redirected when written.
[0083] Address / Time Time0 Time1 Time2 Time3 G0 0 0 0 0 G1 0 1 0 0 G2 0 0 0 0 G3 0 0 0 0
[0084] Table 4
[0085] Accordingly, data "DataX" is written into the snapshot volume, as shown in Table 5. In Table 5, L0 is the address to which the newly written data DataX is redirected.
[0086] Snapshot Meta Volume Snapshot Data Volume L0 DataX Null Null Null Null Null Null
[0087] Table 5
[0088] In the above example, G1 is the redirected pointer, and a pointer can also be understood as an address. Correspondingly, G0, G2, and G3 are pointers that have not been redirected, which can be understood as: the data corresponding to G0, G2, and G3 are not overwritten and unchanged.
[0089] In an embodiment of the present application, when the storage system receives a snapshot deletion instruction, it determines whether the protection capacity of the snapshot volume written exceeds a preset threshold, wherein the preset threshold is determined according to the capacity of the source data volume, for example, the preset threshold is a specific percentage of the capacity of the source data volume.
[0090] In one embodiment of the present application, the preset threshold is a first percentage of the capacity of the source data volume, and the interval of the first percentage can be set to be greater than 50% and less than or equal to 100%. Setting based on this interval can ensure that the amount of data required to be copied during the deletion of the snapshot is reduced compared to the related art.
[0091] In the embodiment of the present application, after the snapshot is generated, if the size of the data written to the snapshot volume exceeds a preset threshold, if the data written to the snapshot volume is copied to the source data volume, the amount of data to be copied is large. In this case, S202 is executed.
[0092] S202: Copy the first data in the source data volume to the snapshot volume to obtain a full data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected.
[0093] According to the description of the ROW mechanism above, after a snapshot is created, write requests to the source data volume are redirected to the storage space reserved for the snapshot volume, and data is directly written to the snapshot volume.
[0094] When the protection capacity of the snapshot volume written exceeds the preset threshold, if the existing ROW mechanism is still used, the data written to the snapshot volume needs to be copied to the source data volume, and the data that needs to be copied is large. Therefore, in the embodiment of the present application, the first data in the source data volume is copied to the snapshot volume, thereby reducing the data that needs to be copied.
[0095] The first data is data in the source data volume whose pointer is not redirected. Under the ROW mechanism, when the data in the source data volume is overwritten, the pointer of the data will be redirected to the reserved space of the snapshot volume. Therefore, it can also be understood that: the first data is not overwritten.
[0096] To intuitively show the amount of data that needs to be copied, the following example is given.
[0097] As an example, the capacity of the source data volume is 36M, and 30M of original data has been written. After the snapshot is created, the newly written data in the snapshot volume is 25M. Among them, 20M of data is a modification of the original data, that is, an overwrite; 5M of data is newly added data and does not involve modification of the original data. Then the 20M data is the data corresponding to the redirected pointer in the source data mapping table, and the remaining 30M-20M=10M of data belongs to the data corresponding to the pointer that has not been redirected in the source data mapping table. Using the solution of the present application, since the amount of data newly written to the snapshot volume is large and exceeds the preset threshold, the above 10M data can be copied to the snapshot volume. If the existing ROW mechanism is used, all data (25M) newly written to the snapshot volume after the snapshot is created needs to be copied to the source data volume.
[0098] After the first data in the source data volume is copied to the snapshot volume, the snapshot volume includes the unchanged data in the source data volume and the data newly written into the snapshot volume, and thus includes the full amount of data. The snapshot volume obtained after the copying is completed is recorded as the full amount of data snapshot volume.
[0099] Those skilled in the art can understand that the full data refers to: data that should be obtained after executing the data write instruction based on the original data, which does not include the data that is overwritten in the original data.
[0100] In addition, those skilled in the art can understand that copying the first data in the source data to the snapshot volume means copying the first data to the free storage space in the storage space allocated for the snapshot volume, so that the storage space allocated for the snapshot volume contains the above-mentioned full amount of data.
[0101] S203: Delete the source data volume, and configure the full data snapshot volume as the target source data volume.
[0102] The purpose of deleting the snapshot is to synchronize the data changes after the snapshot is created to the source data volume, that is, to obtain the source data volume of the full data. After executing step S202, the full data snapshot volume is obtained, not the source data volume. Therefore, it is necessary to change the identity of the full data snapshot volume and change it to the source data volume.
[0103] Specifically, in the storage system, the source data volume and the snapshot volume have their own attribute information, and the storage system identifies the identity of the data volume through this attribute information. If the attribute information of the full data snapshot volume is changed to the attribute information corresponding to the source data volume, the full data snapshot volume can achieve identity conversion, that is, the storage system can regard the full data snapshot volume with changed attribute information as the source data volume containing the full data, and record it as the target source data volume.
[0104] By changing the attribute information in the above manner, the full data snapshot volume can be configured as the target source data volume.
[0105] As an example, the attribute information of the source data volume is recorded as the first attribute information, and the attribute information of the full data snapshot volume is recorded as the second attribute information. The second attribute information is changed to the first attribute information, and then the full data snapshot volume after the attribute information is changed can be regarded as the target source data volume.
[0106] Since the target source data volume is obtained by replacing the attribute information, the source data volume needs to be deleted, which is equivalent to deleting the snapshot.
[0107] That is to say, by using the snapshot deletion method provided in the embodiment of the present application, the target source data volume obtained is the same as the source data volume obtained by using the snapshot deletion solution of the related art, but the data that needs to be copied is greatly reduced.
[0108] For ease of understanding, combined Figure 3 Provide further explanation. Figure 3 A schematic diagram of the snapshot deletion method provided in the embodiment of the present application. In order to intuitively reflect the capacity of the source data volume, a table is used to represent the storage space. It is assumed that the capacity of the storage space corresponding to each table is the same, and the size of each piece of data written to each storage space is also the same. Figure 3 As shown in the figure, the source data volume stores 9 copies of data, numbered 1 to 9. After the snapshot is created, based on the redirect-on-write mechanism, all newly written data are redirected to the snapshot volume, as shown in the figure. Figure 3 As shown, the newly written data is 6 copies, numbered 11-16. Assuming that the snapshot deletion instruction is to be executed, the first data is copied to the snapshot volume before deleting the snapshot. The first data is the data whose pointer is not redirected (i.e. Figure 3 7-9 shown in the figure), and then replace the attribute information corresponding to the snapshot volume based on the attribute information of the source data volume, change the identity of the snapshot volume to the source data volume, obtain the source data volume containing the full data, and then delete the original source data volume, which is equivalent to deleting the snapshot.
[0109] By adopting the snapshot deletion method provided in the embodiment of the present application, the storage system receives a snapshot deletion instruction and determines whether the protection capacity written to the snapshot volume exceeds a preset threshold; the preset threshold is related to the capacity of the source data volume; the snapshot volume is generated by creating a snapshot of the source data volume based on write-time redirection ROW; if so, the first data in the source data volume is copied to the snapshot volume to obtain a full-data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected; the source data volume is deleted, and the full-data snapshot volume is configured as the target source data volume.
[0110] Therefore, in a storage system that uses ROW snapshot technology, when deleting a snapshot, the protection capacity of the snapshot volume is judged. If the protection capacity is large, the data in the source data volume whose pointers are not redirected is copied to the snapshot volume, and the full data snapshot volume is configured as the target source data, that is, the source data volume containing the full data, which is equivalent to executing the snapshot deletion instruction. Compared with the snapshot deletion scheme in the related art, the data that needs to be copied is greatly reduced. Since the processing volume and time required to configure the full data snapshot volume as the target source data are much less than the processing volume and time required to copy the data, in the scenario where a lot of data is written after the snapshot, the existing ROW mechanism of deleting the snapshot and only copying the data once is continued, which effectively reduces the amount of data that needs to be copied, reduces the write amplification in data processing, and improves the performance of snapshot deletion.
[0111] In one embodiment of the present application, the above step S203 specifically includes:
[0112] The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume. The attribute information of the source data volume is recorded as the first attribute information, and the attribute information of the full data snapshot volume is recorded as the second attribute information.
[0113] Specifically, first attribute information of the source data volume used to represent identity information is saved. As an example, the attribute information includes: an identification ID of the data volume and a storage pool to which the data volume belongs.
[0114] In this step, only the first attribute information of the source data volume is saved, and the first attribute information is not effective, so it will not affect the existing source data volume.
[0115] After the first attribute information of the source data volume is saved, the source data volume can be deleted.
[0116] In addition, in this embodiment, it is also feasible to first replace the attribute information and then delete the source data volume, and there is no restriction on the order.
[0117] The second attribute information of the full data snapshot volume is changed based on the first attribute information to obtain the target source data volume.
[0118] In this step, the second attribute information of the full data snapshot volume is updated using the first attribute information of the backed-up source data volume, which may specifically include: replacing the identification ID of the full data snapshot volume with the identification ID of the source data volume, and replacing the storage pool identification of the full data snapshot volume with the storage pool identification of the source data volume.
[0119] After the update is completed, the information of the source data volume is inherited, and the full data snapshot volume is changed to the source data volume containing the full data. For the storage system and users, the snapshot volume can be considered to have been deleted.
[0120] It is worth noting that for different storage systems, the attribute information used to identify the identity of the data volume may be different. Accordingly, in the process of changing the full data snapshot volume to the target source data volume, the replaced attribute information may also be different. The embodiments of the present application do not strictly limit this. Any method of replacing the identity of the snapshot volume and changing it to the source data volume based on the attribute information of the data volume is within the scope of protection of this application.
[0121] It can be seen that the embodiment of the present application also provides a process for replacing the source data volume with a snapshot volume. After the first attribute data in the source data volume is copied to the snapshot volume, the above process can be executed to obtain the source data volume containing the full data, which is equivalent to deleting the snapshot volume and saving the source data volume.
[0122] Since the processing volume and time required to change the attribute information of the snapshot volume are much smaller than the processing volume and time required to copy the data, in the scenario where a lot of data is written after the snapshot, the existing ROW mechanism of deleting the snapshot and only copying the data once is continued, which effectively reduces the amount of data that needs to be copied, reduces the write amplification in data processing, and improves the performance of snapshot deletion.
[0123] In one embodiment of the present application, see Figure 4 After executing S201, if the judgment result is no, execute S401.
[0124] S401: Copy second data in the snapshot volume to the source data volume; the second data is data written to the snapshot volume after the snapshot is created.
[0125] Specifically, if the protection capacity written to the snapshot volume does not exceed a preset threshold, the existing deletion mechanism is executed to copy the data written to the snapshot volume to the source data volume, and then delete the snapshot volume.
[0126] It can be seen that the present application proposes a mechanism for judging the snapshot protection capacity to execute different snapshot deletion processes when deleting ROW snapshots. By judging the snapshot protection capacity and adopting different snapshot data processing methods, it is possible to effectively reduce the amount of data that needs to be copied when deleting snapshots, significantly improve snapshot deletion performance, and reduce data write amplification.
[0127] In one embodiment of the present application, if multiple snapshots are continuously created based on ROW for a source data volume, when a target snapshot needs to be deleted, it is determined whether the protection capacity of the snapshot volume written to the target snapshot exceeds a preset threshold. If not, the snapshot is deleted according to the existing mechanism; if so, the following steps are performed:
[0128] Copy the first data in the source data volume to the snapshot volume of the target snapshot, and copy the third data in the snapshot data volume of the i-th snapshot created before the target snapshot to the snapshot volume of the target snapshot, to obtain the full data snapshot volume of the N-th snapshot; the third data is the data whose pointer is not redirected; wherein i is a positive integer greater than or equal to 1 and less than N;
[0129] Delete the source data volume and configure the full data snapshot volume of the Nth snapshot as the target source data volume.
[0130] Specifically, the target snapshot is the Nth snapshot created based on ROW for the source data volume. The target snapshot is deleted. In essence, the full and latest data before the creation of N+1 snapshots needs to be retained. Therefore, for the i-th snapshot created before the target snapshot, if the data written in the snapshot volume of the i-th snapshot is still the latest data, then this part of data also needs to be copied to the snapshot volume of the target snapshot to ensure that the snapshot volume of the target snapshot is a full data snapshot volume.
[0131] After the i-th snapshot is created, for data a written to the snapshot volume of the i-th snapshot, if the data a is overwritten after the subsequent snapshot is created, according to the ROW mechanism, the pointer to the data a of the snapshot volume of the i-th snapshot is redirected. Therefore, for the data in the snapshot volume of the i-th snapshot whose pointer is not redirected, this part of the data is still the latest data and needs to be copied to the snapshot volume of the target snapshot.
[0132] It should be noted that, in the embodiment of the present application, writing data into the snapshot volume of a snapshot means writing data into the storage space allocated for the snapshot. After each snapshot is created, the storage system allocates storage space for the snapshot.
[0133] The following is an illustration with reference to the accompanying drawings.
[0134] See also Figure 5 , is a schematic diagram of writing data for multiple consecutive snapshots provided in an embodiment of the present application, such as Figure 5 As shown, the source data volume contains data ai. After the first snapshot is created, data e1 and f1 are written, where data e1 is an overwrite of data e, and data f1 is an overwrite of data f. Therefore, the pointers of data e and f are redirected, and the redirected pointers point to the storage locations of data e1 and data f1 respectively. After the second snapshot is created, data e2, f2, h2, and i2 are written, where data e2 is an overwrite of data e1, data f2 is an overwrite of data f1, data h2 is an overwrite of data h, and data i2 is an overwrite of data i. After the third snapshot is created, data d3, e3, g3, h3, and i3 are written, where data d3 is an overwrite of data d, data e3 is an overwrite of data e2, data g3 is an overwrite of data g, data h3 is an overwrite of data h2, and data i3 is an overwrite of data i2.
[0135] In the embodiment of the present application, the full data corresponding to the third snapshot includes data a, b, c, d3, e3, f2, g3, h3, and i3.
[0136] For easier understanding, see Figure 6 , is a schematic diagram of the storage location of multiple consecutive snapshot write data in the storage space provided by an embodiment of the present application, Figure 6 In the example shown, the first storage space is the storage space allocated by the storage system for the source data volume, in which data ai is stored, where the address offsets corresponding to data e and f are 0x12 and 0x16 respectively. The second storage space is the storage space allocated by the storage system for the first snapshot, in which data e1 and f1 written after the first snapshot is created are stored, and the corresponding address offsets are 0x104 and 0x108 respectively. As shown in the figure, taking data e as an example, the address offset 0x12 corresponding to data e is redirected to 0x104, that is, the address corresponding to 0x104 stores the overwrite data e1 of data e. The third storage space is the storage space allocated by the storage system for the second snapshot, in which data e2, f2, h2 and i2 written after the second snapshot is created are stored, and the corresponding address offsets are 0x116, 0x124, 0x130 and 0x138 respectively. The fourth storage space is the storage space allocated by the storage system for the third snapshot. It stores data d3, e3, g3, h3, and i3 written after the third snapshot is created. The corresponding address offsets are 0x236, 0x240, 0x244, 0x248, and 0x256, respectively.
[0137] The locations of the data storage shown in the figure are only examples. When writing data to the i-th storage space, it is sufficient to ensure that the data is written to a free storage location in the storage space.
[0138] visible, Figure 5 and Figure 6 In the illustrated embodiment, data e1 and f1 written after the first snapshot are overwritten in subsequent snapshots, that is, address redirection occurs, so e1 and f1 are not the latest data; among data e2, f2, h2 and i2 written after the second snapshot, data e2, h2 and i2 are overwritten in subsequent snapshots, and data f2 is not overwritten, that is, data f2 is data whose pointer is not redirected.
[0139] Therefore, when deleting the third snapshot, since the amount of data written after the third snapshot exceeds the preset threshold, it is deleted according to the deletion mechanism provided by this application. Specifically, the determined full amount of data includes data whose pointers in the source data volume are not redirected (data a, b and c), and data whose pointers in the snapshot volume corresponding to the second snapshot are not redirected (data f2). Therefore, these data need to be copied to the fourth storage space (i.e., the storage space allocated for the third snapshot).
[0140] See also Figure 7 , which is another schematic diagram of the storage location of data written by multiple consecutive snapshots in a storage space provided in an embodiment of the present application, the data whose pointers are not redirected is copied to the fourth storage space, and the fourth storage space is the snapshot volume containing the full data, and the full data includes: data a, b, c, d3, e3, f2, g3, h3, and i3.
[0141] Subsequently, the snapshot volume containing the full data is changed to serve as the source data volume, and the deletion operation for the third snapshot can be completed.
[0142] It can be seen that in the embodiment of the present application, for the scenario of multiple consecutive snapshots, when deleting the Nth snapshot, if the amount of data written after the Nth snapshot is large, the data whose pointers are not redirected in the source data volume and the previously created snapshot are copied to the snapshot volume corresponding to the Nth snapshot, ensuring that the obtained snapshot volume is a snapshot volume containing the full amount of the latest data. It can be seen that this solution is also applicable to the scenario of multiple consecutive snapshots.
[0143] Based on the same inventive concept, the embodiment of the present application also provides a snapshot deletion device, such as Figure 8 As shown, it includes the following modules:
[0144] The judgment module 801 is used to judge whether the protection capacity of the snapshot volume written exceeds a preset threshold in response to receiving a snapshot deletion instruction; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW;
[0145] A first copy module 802 is configured to copy the first data in the source data volume to the snapshot volume to obtain a full data snapshot volume if the judgment result of the judgment module is yes; the first data is the data in the source data volume whose pointer is not redirected;
[0146] The configuration module 803 is used to delete the source data volume and configure the full data snapshot volume as the target source data volume.
[0147] Therefore, in a storage system that uses ROW snapshot technology, when deleting a snapshot, the protection capacity of the snapshot volume is judged. If the protection capacity is large, the data in the source data volume whose pointers are not redirected is copied to the snapshot volume, and the full data snapshot volume is configured as the target source data, that is, the source data volume containing the full data, which is equivalent to executing the snapshot deletion instruction. Compared with the snapshot deletion scheme in the related art, the data that needs to be copied is greatly reduced. Since the processing volume and time required to configure the full data snapshot volume as the target source data are much less than the processing volume and time required to copy the data, in the scenario where a lot of data is written after the snapshot, the existing ROW mechanism of deleting the snapshot and only copying the data once is continued, which effectively reduces the amount of data that needs to be copied, reduces the write amplification in data processing, and improves the performance of snapshot deletion.
[0148] In one embodiment of the present application, the configuration module is specifically used to:
[0149] The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume.
[0150] In one embodiment of the present application, the attribute information includes one or more of the following: an identification ID of the data volume, and a storage pool to which the data volume belongs.
[0151] In one embodiment of the present application, the device further includes:
[0152] The second copy module is used to copy the second data in the snapshot volume to the source data volume if the judgment result of the judgment module is no; the second data is the data written to the snapshot volume after the snapshot is created.
[0153] In one embodiment of the present application, the preset threshold is related to the capacity of the source data volume;
[0154] The preset threshold is a first percentage of the capacity of the source data volume, and the first percentage is in a range of 50%-100%.
[0155] In one embodiment of the present application, the snapshot deletion instruction is a deletion instruction for a target snapshot; the target snapshot is: an Nth snapshot created based on ROW for a source data volume;
[0156] The device also includes:
[0157] The third copy module is used to: copy the first data in the source data volume to the snapshot volume of the target snapshot, and copy the third data in the snapshot data volume of the i-th snapshot created before the target snapshot to the snapshot volume of the target snapshot, so as to obtain the full data snapshot volume of the N-th snapshot; the third data is the data whose pointer is not redirected; wherein i is a positive integer greater than or equal to 1 and less than N;
[0158] The second configuration module is used to delete the source data volume and configure the full data snapshot volume of the Nth snapshot as the target source data volume.
[0159] The present application also provides an electronic device, such as Fig. 9 As shown, it includes a processor 901 , a communication interface 902 , a memory 903 and a communication bus 904 , wherein the processor 901 , the communication interface 902 , and the memory 903 communicate with each other via the communication bus 904 .
[0160] Memory 903, used for storing computer programs;
[0161] The processor 901 is used to execute the program stored in the memory 903 to implement the following steps:
[0162] In response to receiving a snapshot deletion instruction, determining whether the protection capacity of the snapshot volume written exceeds a preset threshold; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW;
[0163] If yes, copy the first data in the source data volume to the snapshot volume to obtain a full data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected;
[0164] The source data volume is deleted, and the full data snapshot volume is configured as the target source data volume.
[0165] Therefore, in a storage system that uses ROW snapshot technology, when deleting a snapshot, the protection capacity of the snapshot volume is judged. If the protection capacity is large, the data in the source data volume whose pointers are not redirected is copied to the snapshot volume, and the full data snapshot volume is configured as the target source data, that is, the source data volume containing the full data, which is equivalent to executing the snapshot deletion instruction. Compared with the snapshot deletion scheme in the related art, the data that needs to be copied is greatly reduced. Since the processing volume and time required to configure the full data snapshot volume as the target source data are much less than the processing volume and time required to copy the data, in the scenario where a lot of data is written after the snapshot, the existing ROW mechanism of deleting the snapshot and only copying the data once is continued, which effectively reduces the amount of data that needs to be copied, reduces the write amplification in data processing, and improves the performance of snapshot deletion.
[0166] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0167] The communication interface is used for communication between the above electronic device and other devices.
[0168] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0169] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0170] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned snapshot deletion methods are implemented.
[0171] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any snapshot deletion method in the above embodiments.
[0172] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0173] It should 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 existence of other identical elements in the process, method, article or device including the elements.
[0174] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, electronic device, computer storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0175] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A snapshot deletion method, characterized in that: The method comprises: In response to receiving a snapshot deletion instruction, determining whether the protection capacity of the snapshot volume written exceeds a preset threshold; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW; If yes, copy the first data in the source data volume to the snapshot volume to obtain a full data snapshot volume; the first data is the data in the source data volume whose pointer is not redirected; The source data volume is deleted, and the full data snapshot volume is configured as the target source data volume.
2. The method according to claim 1, characterized in that The step of configuring the full data snapshot volume as the target source data volume includes: The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume.
3. The method according to claim 2, characterized in that The attribute information includes one or more of the following: an identification ID of the data volume, and a storage pool to which the data volume belongs.
4. The method according to any one of claims 1 to 3, characterized in that: The method further comprises: If the protection capacity written to the snapshot volume is less than or equal to the preset threshold, the second data in the snapshot volume is copied to the source data volume; the second data is the data written to the snapshot volume after the snapshot is created.
5. The method according to claim 1, characterized in that The preset threshold is related to the capacity of the source data volume; the preset threshold is a first percentage of the capacity of the source data volume, and the first percentage is in the range of 50%-100%.
6. The method according to claim 1, characterized in that The snapshot deletion instruction is a deletion instruction for a target snapshot; the target snapshot is: the Nth snapshot created based on ROW for the source data volume; The method further comprises: If it is determined that the protection capacity of the snapshot volume written to the target snapshot exceeds the preset threshold, the following steps are performed: Copying the first data in the source data volume to the snapshot volume of the target snapshot, and copying the third data in the snapshot data volume of the i-th snapshot created before the target snapshot to the snapshot volume of the target snapshot, to obtain a full data snapshot volume of the N-th snapshot; the third data is data whose pointer is not redirected; wherein i is a positive integer greater than or equal to 1 and less than N; The source data volume is deleted, and the full data snapshot volume of the Nth snapshot is configured as the target source data volume.
7. A snapshot deletion device, characterized in that: The device comprises: A judgment module, configured to judge whether the protection capacity of the snapshot volume written to the snapshot volume exceeds a preset threshold in response to receiving a snapshot deletion instruction; the snapshot volume is generated by creating a snapshot of the source data volume based on redirect-on-write ROW; A first copy module, configured to copy first data in the source data volume to the snapshot volume to obtain a full data snapshot volume if the judgment result of the judgment module is yes; the first data is data in the source data volume whose pointer is not redirected; A configuration module is used to delete the source data volume and configure the full data snapshot volume as a target source data volume.
8. The device according to claim 7, characterized in that The configuration module is specifically used for: The attribute information of the full data snapshot volume is changed based on the attribute information of the source data volume, and the full data snapshot volume after the attribute information is changed is determined as the target source data volume.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 6 when executing a program stored in a memory.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Data snapshot method and device, computer equipment and storage medium
CN111966531A
Data volume shrinkage method, system and device and readable storage medium
CN114138188A
Full-amount snapshot rapid generation method and device, electronic equipment and storage medium
CN115617802A
Snapshot method and device for distributed storage system, equipment and storage medium
CN116644048A
Method of processing snapshot introducing snapshotstatus table based on memory for shared storagesupporting large capacity
KR1020050055510A
