Snapshot processing method and device
By adjusting the reference relationship of cascading snapshots through the application-layer snapshot index, the problem of complex metadata migration in multi-level cascading snapshot processing is solved, and efficient snapshot deletion and construction are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- DAWNING INFORMATION IND (BEIJING) CO LTD
- Filing Date
- 2024-10-28
- Publication Date
- 2026-05-08
AI Technical Summary
In the case of multi-layered cascaded snapshots, existing snapshot processing methods involve complex metadata migration operations when deleting intermediate-layer data snapshots, resulting in low processing efficiency.
By responding to the target application-layer snapshot deletion command in response to cascading snapshots, and using the application-layer snapshot as a data snapshot index, the reference relationship of the data snapshots is adjusted and transformed into a deletion operation identified by the index, thus avoiding data migration and improving processing efficiency.
While ensuring the reliability of snapshot processing, the efficiency of snapshot processing has been improved, ensuring the rationality and reliability of data snapshot deletion.
Smart Images

Figure CN121996473A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a snapshot processing method and apparatus. Background Technology
[0002] To ensure the reliability of data in storage systems, snapshot technology has emerged, which involves copying a snapshot of the source data at a certain point in time and establishing a dependency relationship between the source data and the snapshot.
[0003] However, in existing snapshot processing methods, when there are multiple cascaded snapshots, there are interdependencies between the data snapshots. In this case, deleting the data snapshot of the intermediate layer within the cascaded snapshot involves complex metadata migration operations, which reduces the efficiency of snapshot processing. Summary of the Invention
[0004] Therefore, it is necessary to provide a snapshot processing method and apparatus that can improve the efficiency of snapshot processing in order to address the above-mentioned technical problems.
[0005] Firstly, this application provides a snapshot processing method, including:
[0006] In response to a snapshot deletion command for the target application layer snapshot of the cascaded snapshot, the target application layer snapshot is deleted; wherein, each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index;
[0007] Based on the mapping relationship between application layer snapshots and data snapshots, determine the target data snapshot corresponding to the target application layer snapshot;
[0008] The target data snapshot is processed based on the snapshot reference information of the target data snapshot.
[0009] In this embodiment, by using application-layer snapshots for index data snapshots to construct cascaded snapshots, the original deletion operation directly targeting the data snapshot is transformed into a deletion operation targeting the index identifier, and the reference relationship of the data snapshot is adjusted. No data migration is required, which can improve the efficiency of snapshot processing while ensuring the reliability of snapshot processing.
[0010] In one embodiment, the snapshot reference information includes the current snapshot reference count of the target data snapshot; processing the target data snapshot based on the snapshot reference information includes:
[0011] Subtract the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count to obtain the new snapshot reference count of the target data snapshot; if the new snapshot reference count is a set value, delete the target data snapshot.
[0012] In this embodiment of the application, by calculating the number of references to the new snapshot and comparing the number of references to the new snapshot with a set value, it is possible to determine whether the target data snapshot needs to be deleted, thus ensuring the rationality of data snapshot deletion.
[0013] In one embodiment, deleting the target data snapshot includes:
[0014] Based on the reference relationships between the data snapshots in the cascaded snapshot, determine whether there is a first reference snapshot that references the target data snapshot in each data snapshot; if so, delete the data in the target data snapshot that has no reference relationship with the first reference snapshot; if not, delete the target data snapshot.
[0015] In this embodiment of the application, by determining whether there is a first reference snapshot that has a reference relationship with the target data snapshot, and then performing different deletion processes on the target data snapshot, it is possible to avoid deleting data that has data references in the target data snapshot, thereby ensuring the reliability of data snapshot deletion.
[0016] In one embodiment, deleting data in the target data snapshot that has no reference relationship with the first reference snapshot includes:
[0017] When the target data snapshot references the second reference snapshot in each data snapshot, determine the current snapshot reference count of the second reference snapshot; when the current snapshot reference count of the second reference snapshot is a set value, merge the target data snapshot and the second reference snapshot to obtain a merged snapshot; delete data in the merged snapshot that has no reference relationship with the first reference snapshot.
[0018] In this embodiment of the application, when there is also a need to delete in the second reference snapshot, the target data snapshot and the second reference snapshot are first merged. Then, the data in the merged snapshot obtained by the fusion process is directly deleted, which reduces the number of data deletions and thus improves the efficiency of snapshot deletion.
[0019] In one embodiment, after processing the target data snapshot, the method further includes:
[0020] Based on the reference relationships between the data snapshots in the cascaded snapshot, the snapshot reference information of other data snapshots besides the target data snapshot is updated, as well as the container reference information of each data container storing the data snapshots is updated; wherein, the container reference information of each data container is determined based on the snapshot reference information of the data snapshots stored in the data container.
[0021] In this embodiment of the application, by updating the snapshot reference information of other data snapshots and the container reference information of each data container based on the reference relationship between each data snapshot based on cascading snapshots, the reliability of the reference relationship between each data snapshot can be guaranteed.
[0022] In one embodiment, the method further includes:
[0023] In response to a snapshot build instruction for a cascaded snapshot, the parent application layer snapshot of the new application layer snapshot to be created is determined, and a new application layer snapshot is created; the target data container where the first data snapshot corresponding to the parent application layer snapshot is located is determined; the data snapshot corresponding to the new application layer snapshot is determined according to the target data container and the snapshot type of the new application layer snapshot; wherein, the snapshot type includes a writable snapshot or a read-only snapshot.
[0024] In this embodiment of the application, by determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot after creating a new application layer snapshot, the efficiency of application layer snapshot construction can be improved while ensuring the reliability of the data snapshot corresponding to the new application layer snapshot.
[0025] In one embodiment, determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot includes:
[0026] If the snapshot type of the new application layer snapshot is a writable snapshot, create a next-level data container of the target data container; determine the base data snapshot from the data snapshots stored in the target data container based on the snapshot reference information of the data snapshots stored in the target data container; and create a new data snapshot corresponding to the new application layer snapshot in the next-level data container based on the base data snapshot.
[0027] In this embodiment of the application, when the snapshot type of the new application layer snapshot is a writable snapshot, the reliability of data snapshot creation can be guaranteed by creating a new data snapshot corresponding to the application layer snapshot in the next-level data container based on the basic data snapshot.
[0028] In one embodiment, determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot includes:
[0029] If the snapshot type of the new application layer snapshot is a read-only snapshot, a second data snapshot with a reference relationship to the first data snapshot is created in the target data container; the previous application layer snapshot is mapped to the second data snapshot, and the new application layer snapshot is mapped to the first data snapshot.
[0030] In this embodiment of the application, when the snapshot type of the new application layer snapshot is a read-only snapshot, by creating a second data snapshot in the target data container and directly modifying the mapping relationship between the previous application layer snapshot and the new application layer snapshot, the data snapshot corresponding to the new application layer snapshot can be determined, thus ensuring the accuracy of the data snapshot construction.
[0031] In one embodiment, the method further includes:
[0032] In response to a snapshot rollback instruction that rolls back from a first application-layer snapshot to a second application-layer snapshot, the system determines the rollback data snapshot corresponding to the second application-layer snapshot; in the data container where the rollback data snapshot resides, it creates a third data snapshot that has a reference relationship with the rollback data snapshot and maps the second application-layer snapshot to the third data snapshot; it creates a new data container containing the rollback data snapshot; it deletes the data snapshot corresponding to the first application-layer snapshot and maps the first application snapshot to the rollback data snapshot in the new data container.
[0033] In this embodiment of the application, by using application-layer snapshots for index data snapshots to construct cascaded snapshots, the original rollback operation directly targeting data snapshots is transformed into a rollback operation targeting index identifiers and adjusting the reference relationship of data snapshots, which effectively improves the efficiency of snapshot rollback.
[0034] Secondly, this application also provides a snapshot processing apparatus, comprising:
[0035] The first processing module is used to delete the target application layer snapshot in response to a snapshot deletion instruction for the target application layer snapshot of the cascaded snapshot; wherein, each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index.
[0036] The snapshot determination module is used to determine the target data snapshot corresponding to the target application layer snapshot based on the mapping relationship between application layer snapshots and data snapshots;
[0037] The second processing module is used to process the target data snapshot based on the snapshot reference information of the target data snapshot.
[0038] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0039] In response to a snapshot deletion command for the target application layer snapshot of the cascaded snapshot, the target application layer snapshot is deleted; wherein, each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index;
[0040] Based on the mapping relationship between application layer snapshots and data snapshots, determine the target data snapshot corresponding to the target application layer snapshot;
[0041] The target data snapshot is processed based on the snapshot reference information of the target data snapshot.
[0042] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0043] In response to a snapshot deletion command for the target application layer snapshot of the cascaded snapshot, the target application layer snapshot is deleted; wherein, each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index;
[0044] Based on the mapping relationship between application layer snapshots and data snapshots, determine the target data snapshot corresponding to the target application layer snapshot;
[0045] The target data snapshot is processed based on the snapshot reference information of the target data snapshot.
[0046] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0047] In response to a snapshot deletion command for the target application layer snapshot of the cascaded snapshot, the target application layer snapshot is deleted; wherein, each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index;
[0048] Based on the mapping relationship between application layer snapshots and data snapshots, determine the target data snapshot corresponding to the target application layer snapshot;
[0049] The target data snapshot is processed based on the snapshot reference information of the target data snapshot.
[0050] The aforementioned snapshot processing method and apparatus, in response to a snapshot deletion instruction for a target application-layer snapshot in a cascaded snapshot, delete the target application-layer snapshot, determine the target data snapshot corresponding to the target application-layer snapshot based on the mapping relationship between application-layer snapshots and data snapshots, and then process the target data snapshot based on its snapshot reference information. Compared to related technologies that directly delete data snapshots, the above method, by constructing cascaded snapshots using application-layer snapshots used to index data snapshots, transforms the original direct deletion operation on data snapshots into a deletion operation on index identifiers and adjusts the reference relationship of data snapshots. This eliminates the need for data migration and improves the efficiency of snapshot processing while ensuring its reliability. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1A This is a flowchart illustrating a snapshot processing method in one embodiment;
[0053] Figure 1B This is a schematic diagram of a cascaded snapshot tree A in one embodiment;
[0054] Figure 2A This is a schematic diagram of the process of deleting a target data snapshot in one embodiment;
[0055] Figure 2B This is a schematic diagram of a cascaded snapshot tree B in one embodiment;
[0056] Figure 3 This is a schematic diagram of the process for deleting a target data snapshot in another embodiment;
[0057] Figure 4A This is a schematic diagram of the process for creating an application layer snapshot in one embodiment;
[0058] Figure 4B This is a schematic diagram of a cascaded snapshot tree C in one embodiment;
[0059] Figure 5A This is a schematic diagram of the process for creating a data snapshot in one embodiment;
[0060] Figure 5B This is a schematic diagram of a cascaded snapshot tree D in one embodiment;
[0061] Figure 5C This is a schematic diagram of a cascaded snapshot tree E in one embodiment;
[0062] Figure 6A A schematic diagram of the process for creating a data snapshot in another embodiment;
[0063] Figure 6B This is a schematic diagram of a cascaded snapshot tree F in one embodiment;
[0064] Figure 7A This is a schematic diagram of a cascaded snapshot tree G in one embodiment;
[0065] Figure 7B This is a schematic diagram of a cascaded snapshot tree H in one embodiment;
[0066] Figure 8 This is a flowchart illustrating the snapshot processing method in another embodiment;
[0067] Figure 9 This is a flowchart illustrating the snapshot processing method in yet another embodiment;
[0068] Figure 10 This is a structural block diagram of a snapshot processing device in one embodiment;
[0069] Figure 11 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0070] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0071] To ensure the reliability of data in storage systems, snapshot technology has emerged, which involves copying a snapshot of the source data at a certain point in time and establishing a dependency relationship between the source data and the snapshot.
[0072] However, in existing snapshot processing methods, when there are multiple cascaded snapshots, there are interdependencies between the data snapshots. In this case, deleting the data snapshot of the intermediate layer within the cascaded snapshot involves complex metadata migration operations, which reduces the efficiency of snapshot processing.
[0073] Based on this, in an exemplary embodiment, such as Figure 1A As shown, a snapshot processing method is provided. Taking the application of this method to a snapshot processing device as an example, the method includes the following steps:
[0074] S101, in response to a snapshot deletion instruction for a target application layer snapshot of a cascaded snapshot, delete the target application layer snapshot.
[0075] The target application layer snapshot is an application layer snapshot that needs to be deleted; the snapshot deletion command is used to instruct the target application layer snapshot to be deleted.
[0076] Cascading snapshots are a technique for building snapshots in a cascading manner, where each level snapshot depends on the data in the previous level object. In this embodiment, each application-layer snapshot in a cascading snapshot is associated with a data snapshot, and the reference relationship between different application-layer snapshots is determined based on the reference relationship between the data snapshots in the cascading snapshot. The application-layer snapshot serves as the data snapshot index.
[0077] Understandably, in order to avoid extensive migration of the data / metadata associated with the snapshot when processing the snapshot, in this embodiment, the physical layer data snapshot itself can be separated from the application layer snapshot (i.e., the data snapshot index) that the user can obtain at the application layer, so that when processing the application snapshot, the user only needs to modify the reference relationship between the corresponding data snapshots in the physical layer.
[0078] Optionally, the user can send a snapshot deletion command containing the snapshot identifier corresponding to the target application layer snapshot to the snapshot processing device based on the cascaded snapshots displayed at the application layer. Subsequently, after the snapshot processing device receives the snapshot deletion command, since the target application layer snapshot is only an index of the data snapshot, the target application layer snapshot can be deleted directly without involving data migration.
[0079] For example, refer to Figure 1B , Figure 1B The left side shows the cascaded snapshots consisting of application layer snapshots (shell1-shell5), which is also the cascaded snapshot tree A that the user side can obtain; Figure 1B The right side shows the index relationship between the actual application layer snapshots and data snapshots on the physical layer associated with the cascaded snapshot tree A, as well as the reference relationship between each data snapshot. Here, c1, c2, and c3 are data containers used to store data snapshots; v1, v2, and v3 are data snapshots under each version.
[0080] S102, determine the target data snapshot corresponding to the target application layer snapshot based on the mapping relationship between the application layer snapshot and the data snapshot.
[0081] The target data snapshot is the data snapshot itself that the target application layer snapshot points to.
[0082] It is understandable that after deleting the target application layer snapshot, the application relationship between data snapshots on the physical layer needs to be modified accordingly. Therefore, based on the mapping relationship between application layer snapshots and data snapshots, the target application layer snapshot can be used as an index for querying to determine the target data snapshot corresponding to the target application layer snapshot.
[0083] For example, continue to refer to Figure 1B If the target application layer snapshot is shell4, then the target data snapshot is the v1 version data snapshot in the c2 data container; if the target application layer snapshot is shell5, then the target data snapshot is the v1 version data snapshot in the c3 data container.
[0084] S103, Process the target data snapshot according to the snapshot reference information of the target data snapshot.
[0085] Among them, snapshot reference information is application information related to data snapshots, such as, but not limited to, the reference relationship between data snapshots.
[0086] Optionally, after deleting the target application layer snapshot, the application relationship of the target data snapshot will also change. Therefore, the data within the target data snapshot can be processed based on the snapshot reference information of the target data snapshot.
[0087] For example, based on the snapshot reference information of the target data snapshot, it can be determined whether the target data snapshot is still referenced by other data snapshots after the target application layer snapshot is deleted. If so, the target data snapshot is retained; otherwise, useless data in the target data snapshot is deleted.
[0088] In the snapshot processing method described above, the target application-layer snapshot is deleted in response to a snapshot deletion command for the target application-layer snapshot in a cascaded snapshot. Based on the mapping relationship between application-layer snapshots and data snapshots, the target data snapshot corresponding to the target application-layer snapshot is determined. Then, the target data snapshot is processed based on its snapshot reference information. Compared to related technologies that directly delete data snapshots, this method uses application-layer snapshots used to index data snapshots to construct cascaded snapshots. This transforms the original direct deletion operation on data snapshots into a deletion operation on index identifiers and adjusts the reference relationship of data snapshots. No data migration is required, thus improving the efficiency of snapshot processing while ensuring its reliability.
[0089] To ensure the rationality of data snapshot deletion, based on the above embodiments, this embodiment includes the snapshot reference information as the current snapshot reference count of the target data snapshot; furthermore, an optional method for deleting the target data snapshot is provided, such as... Figure 2AAs shown, the specific steps include:
[0090] S201, subtract the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count of the target data snapshot to obtain the new snapshot reference count of the target data snapshot.
[0091] The snapshot reference count refers to the number of times a data snapshot is referenced, including but not limited to the number of times a data snapshot is referenced by data snapshots within other data containers and / or the number of times a data snapshot is referenced by application-layer snapshots. For example, refer to... Figure 1B , Figure 1B The number of times each data snapshot is referenced is the total number of times a data snapshot is referenced by other data snapshots in other data containers and application layer snapshots.
[0092] The current snapshot reference count refers to the number of times the target data snapshot has been referenced before the target application layer snapshot has been deleted; the new snapshot reference count refers to the number of times the target data snapshot has been referenced after the target application layer snapshot has been deleted.
[0093] Optionally, the new snapshot reference count of the target data snapshot can be obtained by directly subtracting the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count. For example, refer to... Figure 1B Assuming the target application layer snapshot is shell4, and the target data snapshot is the v1 version data snapshot in c2, and the current snapshot reference count of the target data snapshot is 1, since shell4 references the target data snapshot 1 time, the new snapshot reference count of the target data snapshot is 0.
[0094] S202, if the number of references to the new snapshot is a set value, delete the target data snapshot.
[0095] The set value refers to the value used to determine whether to delete the target data snapshot. For example, the set value can be specified as 0, which means that the snapshot can be deleted when it is not referenced.
[0096] Optionally, the reference count of the new snapshot of the target data snapshot can be compared with a set value. If the reference count of the new snapshot is greater than the set value, the target data snapshot does not need to be deleted; if the reference count of the new snapshot is equal to the set value, the target data snapshot needs to be deleted.
[0097] For example, in Figure 1B By deleting shell3 from the cascaded snapshot tree A shown, we can obtain the following: Figure 2BThe cascaded snapshot tree B shown, and the index relationship between the actual application layer snapshot and the data snapshot on the physical layer associated with the cascaded snapshot tree B, are shown. In this case, the new snapshot reference count of the v2 version data snapshot in data container c1 is 0, so it is necessary to delete the v2 version data snapshot in data container c1.
[0098] In this embodiment of the application, by calculating the number of references to the new snapshot and comparing the number of references to the new snapshot with a set value, it is possible to determine whether the target data snapshot needs to be deleted, thus ensuring the rationality of data snapshot deletion.
[0099] In practical applications, since there are reference relationships between the data snapshots, directly deleting a single data snapshot can easily lead to problems with data references. Based on this, this embodiment provides another optional method for deleting the target data snapshot, which is to determine whether there is a first referencing snapshot that references the target data snapshot in each data snapshot according to the reference relationship between the data snapshots of the cascaded snapshots; if so, delete the data in the target data snapshot that has no reference relationship with the first referencing snapshot; if not, delete the target data snapshot.
[0100] Here, the first reference snapshot refers to a data snapshot that resides in the same data container as the data snapshot and references the target data snapshot. For example, referencing... Figure 1B The first reference snapshot corresponding to the v2 version data snapshot in data container c1 is the v3 version data snapshot in data container c1.
[0101] Optionally, based on the reference relationship between the data snapshots in the cascaded snapshots, it can be determined whether there is a first referencing snapshot referencing the target data snapshot in each data snapshot in the snapshot container where the target data snapshot is located. If there is no first referencing snapshot, it proves that all data in the target data snapshot is not referenced. In this case, the target data snapshot can be deleted directly.
[0102] If a first reference snapshot exists, it proves that the target data snapshot may contain data referenced by the first reference snapshot. Therefore, it is necessary to determine the data in the target data snapshot that does not have a reference relationship with the first reference snapshot based on the data reference relationship between the first reference snapshot and the target application snapshot, and delete the data that does not have a reference relationship.
[0103] In this embodiment of the application, by determining whether there is a first reference snapshot that has a reference relationship with the target data snapshot, and then performing different deletion processes on the target data snapshot, it is possible to avoid deleting data that has data references in the target data snapshot, thereby ensuring the reliability of data snapshot deletion.
[0104] It is understandable that when adjacent versions of data snapshots in the same data container need to be deleted simultaneously, the existing method requires determining the data reference relationships between data snapshots one by one before performing the deletion process sequentially, which reduces the efficiency of data snapshot deletion. Therefore, based on the above embodiments, this embodiment provides another optional method for deleting a target data snapshot, such as... Figure 3 As shown, the specific steps include:
[0105] S301, when the target data snapshot references the second reference snapshot in each data snapshot, determine the current snapshot reference count of the second reference snapshot.
[0106] The second reference snapshot refers to a data snapshot that resides in the same data container as the target data snapshot and is referenced by it. For example, referencing... Figure 1B The second reference snapshot corresponding to the v2 version data snapshot in data container c1 is the v1 version data snapshot in data container c1.
[0107] Optionally, based on the reference relationship between the data snapshots in the cascaded snapshots, it can be determined whether there is a second reference snapshot referenced by the target data snapshot in each data snapshot in the snapshot container where the target data snapshot is located. If it exists, the current snapshot reference count of the second reference snapshot is obtained; if it does not exist, the data in the target data snapshot that has no reference relationship with the first reference snapshot is directly deleted.
[0108] S302, when the current snapshot reference count of the second reference snapshot is a set value, the target data snapshot and the second reference snapshot are merged to obtain a merged snapshot.
[0109] The fused snapshot is a data snapshot obtained by merging the target data snapshot and the second reference snapshot.
[0110] Optionally, referring to step S202 above, the current snapshot reference of the second reference snapshot is compared with a set value. If the current snapshot reference count of the second reference snapshot is greater than the set value, it proves that the second reference snapshot is referenced by data snapshots in other data containers. Therefore, data in the target data snapshot that has no reference relationship with the first reference snapshot can be directly deleted.
[0111] If the current snapshot reference count or other parameters of the second reference snapshot are set to a certain value, it indicates that the second reference snapshot is not referenced by data snapshots within other data containers. Therefore, the second reference snapshot also needs to be deleted. In this case, to improve snapshot processing efficiency, the target data snapshot and the second reference snapshot can be merged based on their data reference relationships to obtain a merged snapshot. For example, data with the same data attributes in the target data snapshot and the second reference snapshot can be aggregated to complete the merging process.
[0112] S303, Delete data in the merged snapshot that has no reference relationship with the first referenced snapshot.
[0113] Optionally, after obtaining the merged snapshot, data in the merged snapshot that has no reference relationship with the first referenced snapshot can be directly deleted based on the data reference relationship between the merged snapshot and the first referenced snapshot.
[0114] Understandably, if two adjacent data snapshots to be deleted are not referenced by other data snapshots, then the two adjacent data snapshots can be deleted directly. For example, refer to... Figure 1B If two data snapshots of versions v2 and v3 in data container c1 need to be deleted at the same time, the two data snapshots of versions v2 and v3 in data container c1 can be deleted without determining the data reference relationship.
[0115] In this embodiment of the application, when there is also a need to delete in the second reference snapshot, the target data snapshot and the second reference snapshot are first merged. Then, the data in the merged snapshot obtained by the fusion process is directly deleted, which reduces the number of data deletions and thus improves the efficiency of snapshot deletion.
[0116] To ensure the reliability of the reference relationships between data snapshots, after processing the target data snapshot, this embodiment provides an optional method for updating reference information based on the above embodiments. Specifically, based on the reference relationships between the data snapshots in the cascaded snapshots, the snapshot reference information of other data snapshots besides the target data snapshot is updated, and the container reference information of each data container storing the data snapshots is updated.
[0117] The container reference information for each data container is determined based on the snapshot reference information of the data snapshots stored within the data container. The container reference information may include the number of container references.
[0118] Optionally, after deleting the target data snapshot, it can be determined whether there is a reference relationship between the target data snapshot and other data snapshots in other data containers based on the reference relationship between the data snapshots of the cascaded snapshots. If there is a reference relationship, the snapshot reference information of other data snapshots besides the target data snapshot needs to be updated; if there is no reference relationship, there is no need to update the snapshot reference information of other data snapshots.
[0119] Subsequently, after updating the snapshot reference information of other data snapshots, for each data container, the container reference information of that data container can be updated based on the snapshot reference information of each data snapshot within that data container. For example, the sum of the snapshot reference counts of each data snapshot within the data container can be used as the container reference count of the data container.
[0120] Understandably, based on the above-mentioned approach to automatically deleting data snapshots, an automatic deletion strategy can be configured for each data container. This means that if the reference count of any data container reaches a set value, that data container will be automatically deleted. For example, if the reference count of data container A is 0, data container A can be deleted directly.
[0121] In this embodiment of the application, by updating the snapshot reference information of other data snapshots and the container reference information of each data container based on the reference relationship between each data snapshot based on cascading snapshots, the reliability of the reference relationship between each data snapshot can be guaranteed.
[0122] To facilitate users in creating new application-layer snapshots, this embodiment provides an optional method for creating application-layer snapshots, based on the above embodiments, such as... Figure 4A As shown, the specific steps include:
[0123] S401, in response to a snapshot build instruction for a cascaded snapshot, determines the parent application layer snapshot of the new application layer snapshot to be created, and creates a new application layer snapshot.
[0124] Among them, the new application layer snapshot refers to the newly created application layer snapshot; the parent application layer snapshot is the application layer snapshot pointed to by the new application layer snapshot in the cascade snapshot; the snapshot build instruction is used to characterize the instruction to build the application layer snapshot.
[0125] Optionally, the user can send a snapshot build instruction for cascaded snapshots to the snapshot processing device as needed for snapshot creation. Subsequently, the snapshot processing device can extract the parent application layer snapshot of the new application layer snapshot to be built and the snapshot type of the new application layer snapshot from the snapshot build instruction, and then build the new application layer snapshot.
[0126] For example, refer to Figure 4BIn response to the instruction to build a new application-layer snapshot for shell1 in the cascading snapshot tree C, it can be determined that the parent application-layer snapshot of the new application-layer snapshot to be created is shell1; subsequently, a new application-layer snapshot shell5 is created based on shell1, thus obtaining... Figure 1B The cascaded snapshot tree A is shown.
[0127] S402, determine the target data container where the first data snapshot corresponding to the upper-level application layer snapshot is located.
[0128] The first data snapshot is the data snapshot itself corresponding to the snapshot of the previous application layer.
[0129] Optionally, based on the mapping relationship between application-layer snapshots and data snapshots, a query can be performed using the previous-level application-layer snapshot as an index to find the location of the first data snapshot corresponding to the previous-level application-layer snapshot, thereby determining the target data container where the first data snapshot is located. For example, refer to... Figure 4B The target data container where the first data snapshot corresponding to the application layer snapshot shell1 is located is c1.
[0130] S403, determine the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot.
[0131] The snapshot types include writable snapshots and read-only snapshots. Furthermore, application-layer snapshots with a writable snapshot type can perform write operations on the indexed data snapshots; application-layer snapshots with a read-only snapshot type can only perform read operations on the indexed data snapshots.
[0132] Optionally, after constructing a new application-layer snapshot, the data snapshots that the new application-layer snapshot can index can be determined based on the information of each data snapshot in the target data container and the snapshot type of the new application-layer snapshot.
[0133] Understandably, once the data snapshot corresponding to the new application layer snapshot is determined, the snapshot reference information of each data snapshot can be updated based on the reference relationship between the data snapshots in the cascaded snapshot, as well as the container reference information of each data container storing the data snapshot.
[0134] In this embodiment of the application, by determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot after creating a new application layer snapshot, the efficiency of application layer snapshot construction can be improved while ensuring the reliability of the data snapshot corresponding to the new application layer snapshot.
[0135] To ensure the accuracy of data snapshot construction, based on the above embodiments, this embodiment provides an optional method for creating data snapshots when the snapshot type of the new application layer snapshot is a writable snapshot, such as... Figure 5A As shown, the specific steps include:
[0136] S501, if the snapshot type of the new application layer snapshot is a writable snapshot, create the next level data container of the target data container.
[0137] The next-level data container is a data container that references the target data container.
[0138] It is understandable that if the snapshot type of the new application layer snapshot is a writable snapshot, it means that the newly created data snapshot needs to support the write operation of the new application layer snapshot. In this case, a new target container needs to be created. Therefore, a next-level data container of the target data container can be created based on the target data container.
[0139] S502, determine the basic data snapshot from the data snapshots stored in the target data container based on the snapshot reference information of the data snapshots stored in the target data container.
[0140] The base data snapshot is the source data in each data snapshot stored in the data container. For example, Figure 1B Data snapshots of version 1 in each data container.
[0141] Optionally, based on the snapshot reference relationship between the data snapshots stored in the target data container, the base data snapshot referenced by other data snapshots can be located from each data snapshot stored in the target data container.
[0142] S503 creates a new data snapshot corresponding to the application layer snapshot in the next-level data container, based on the basic data snapshot.
[0143] Optionally, after determining the base data snapshot in the target data container, the base data snapshot can be used as the data foundation to create a new application-layer snapshot in the next-level data container. For example, a data snapshot that has a query order relationship with the base data snapshot can be created directly in the next-level data container, and this data snapshot can be used as the data snapshot corresponding to the new application-layer snapshot.
[0144] It is understandable that the newly created data snapshot does not contain any data; it is only used to store the data written through the new application layer snapshot. Accordingly, when reading data, if the data to be read does not exist in the newly created data snapshot, the underlying data snapshot corresponding to the newly created data snapshot can be located through the query order relationship, and the required data can be queried in the underlying data snapshot.
[0145] For example, referring to 5B, in response to the instruction to construct a writable snapshot shell2 for shell1 in the cascading snapshot tree D, Figure 5B Based on the mapping relationship shown, a next-level data container c2 is constructed for the target data container c1; subsequently, based on the basic data snapshot (v1 version data snapshot) in the target data container c1, a data snapshot with a query order relationship to the v1 version data snapshot is created (i.e., the v1 version data snapshot in c2), and shell2 is mapped to the v1 version data snapshot in c2. Figure 5C The mapping relationship is shown. It's understandable that the v1 version data snapshot in c2 doesn't contain any data at creation time; instead, it's used to store data written via shell2.
[0146] In addition, if the snapshot build instruction is to build a copy of any application layer snapshot, the parent data snapshot corresponding to the base data snapshot in the data container pointed to by the application layer snapshot is determined; then, a new next-level data container corresponding to the container where the parent data snapshot is located is created, and in the new next-level data container, the parent data snapshot is used as the base data snapshot to create the data snapshot pointed to by the copy application layer snapshot.
[0147] For example, refer to Figure 4B In response to the command to create a copy of shell2 in cascaded snapshot C, in Figure 4B Based on the mapping relationship shown, a next-level data container c3 is constructed for the target data container c1. Then, based on the base data snapshot (v1 version data snapshot) in the target data container c1, a v1 version data snapshot with a query order relationship to the base snapshot data is created in the next-level data container c3. This yields the data snapshot corresponding to the replica application layer snapshot shell5. Figure 1B The mapping relationship is shown.
[0148] In this embodiment of the application, when the snapshot type of the new application layer snapshot is a writable snapshot, the reliability of data snapshot creation can be guaranteed by creating a new data snapshot corresponding to the application layer snapshot in the next-level data container based on the basic data snapshot.
[0149] To ensure the accuracy of data snapshot construction, based on the above embodiments, this embodiment provides another optional method for creating data snapshots when the snapshot type of the new application layer snapshot is a read-only snapshot, such as... Figure 6A As shown, the specific steps include:
[0150] S601, if the snapshot type of the new application layer snapshot is a read-only snapshot, create a second data snapshot in the target data container that has a reference relationship with the first data snapshot.
[0151] The second data snapshot is a higher version of the data snapshot created based on the first data snapshot.
[0152] Understandably, if the new application-layer snapshot is a read-only snapshot, it means the newly created data snapshot needs to support read operations on the new application-layer snapshot. Since the same data snapshot cannot simultaneously support write and read operations, and to ensure data write reliability, the snapshot version of the data snapshot supporting write operations needs to be higher than the snapshot version of the data snapshot supporting read operations. Based on this, a second data snapshot with a reference relationship to the first data snapshot can be created in the target data container, based on the data condition of the first data snapshot at the time the snapshot creation command is issued.
[0153] S602, map the previous application layer snapshot to the second data snapshot, and map the new application layer snapshot to the first data snapshot.
[0154] Optionally, after creating the second data snapshot, it is necessary to modify the mapping relationship of the parent application layer snapshot, that is, change the mapping address of the parent application layer snapshot from the first data snapshot to the second data snapshot; then, map the new application layer snapshot to the first data snapshot.
[0155] For example, in Figure 5C Based on this, when creating a read-only application-layer snapshot shell3 for shell1 in the cascaded snapshot tree E at time T1, we can first create a v3 version data snapshot (i.e., the second data snapshot) that has a query order relationship with the v2 version data snapshot at time T1, based on the v2 version data snapshot corresponding to shell1 (i.e., the first data snapshot); furthermore, we can map shell1 to the v3 version data snapshot and map shell3 to the v2 version data snapshot. At this point, we can obtain... Figure 6B The diagram shows the cascaded snapshot tree F and its corresponding mapping. Specifically, the v3 version data snapshot in c1 does not contain any data when newly created; instead, it is used to store data newly written by shell1 after the v3 version data snapshot.
[0156] In this embodiment of the application, when the snapshot type of the new application layer snapshot is a read-only snapshot, by creating a second data snapshot in the target data container and directly modifying the mapping relationship between the previous application layer snapshot and the new application layer snapshot, the data snapshot corresponding to the new application layer snapshot can be determined, thus ensuring the accuracy of the data snapshot construction.
[0157] To facilitate snapshot rollback processing for cascaded snapshots, this embodiment provides an optional snapshot rollback method based on the above embodiments. Specifically, in response to a snapshot rollback instruction from a first application-layer snapshot to a second application-layer snapshot, the rollback data snapshot corresponding to the second application-layer snapshot is determined; in the data container where the rollback data snapshot is located, a third data snapshot with a reference relationship to the rollback data snapshot is created, and the second application-layer snapshot is mapped to the third data snapshot; a new data container containing the rollback data snapshot is created; the data snapshot corresponding to the first application-layer snapshot is deleted, and the rollback data snapshot mapped from the first application-layer snapshot to the new data container is deleted.
[0158] The first application layer snapshot is the application layer snapshot that needs to be rolled back; the second application layer snapshot is the application layer snapshot at the next higher level than the first application layer snapshot after rollback; the rollback data snapshot is the data snapshot that can be indexed by the second application layer snapshot; the third data snapshot is the data snapshot that has a reference relationship with the rollback data snapshot and is located in the same data container as the rollback data snapshot; the new data container is the newly created data container.
[0159] Optionally, when a snapshot rollback instruction is detected to roll back from the first application layer snapshot to the second application layer snapshot, the second application layer snapshot can be used as an index to query based on the mapping relationship between the application layer snapshot and the data snapshot in order to determine the rollback data snapshot corresponding to the second application layer snapshot.
[0160] In the data container where the rollback data snapshot is located, a third data snapshot with a query order relationship to the rollback data snapshot is created based on the rollback data snapshot at the current time. Subsequently, the mapping address of the second application layer snapshot is changed from the rollback data snapshot to the third data snapshot.
[0161] Furthermore, a new data container containing the rollback data snapshot can be created based on the rollback data snapshot at the current moment; then, the data snapshot corresponding to the first application layer snapshot is deleted, and the mapping address of the first application layer snapshot is changed from the original data snapshot to the rollback data snapshot in the new data container, at which point the data rollback operation can be completed.
[0162] For example, in Figure 7A Based on this, for the cascaded snapshot tree G, in response to the snapshot rollback instruction from shell1 to shell3, a v2 version data snapshot (third data snapshot) can be created in the data container c3 based on the v1 version data snapshot (rollback data snapshot), and shell3 can be mapped to the v2 version data snapshot.
[0163] Further, a new data container c4 is created containing a data snapshot of version v1, and the data snapshot corresponding to shell1 is deleted; subsequently, shell1 is mapped to the data snapshot of version v1 in c4, resulting in the following... Figure 7B The mapping relationship corresponding to the cascading snapshot tree H shown can be used to complete the snapshot rollback operation from shell1 to shell3.
[0164] Specifically, the v1 version data snapshot in c4 is used to save the data newly written to shell1 after rollback. Correspondingly, after the snapshot rollback, if a data read operation is performed on shell1, it is necessary to first read the v1 version data snapshot in c4 pointed to by shell1. If the required data is not found in the v1 version data snapshot in c4, then the v1 version data snapshot in c3 is queried.
[0165] In this embodiment of the application, by using application-layer snapshots for index data snapshots to construct cascaded snapshots, the original rollback operation directly targeting data snapshots is transformed into a rollback operation targeting index identifiers and adjusting the reference relationship of data snapshots, which effectively improves the efficiency of snapshot rollback.
[0166] Figure 8 This is a flowchart illustrating a snapshot processing method in another embodiment. Based on the above embodiments, this embodiment provides an optional example of a snapshot processing method. (Combined with...) Figure 8 The specific implementation process is as follows:
[0167] S801, in response to a snapshot deletion command for a target application layer snapshot of a cascaded snapshot, deletes the target application layer snapshot.
[0168] In this system, each application-layer snapshot in the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application-layer snapshots is determined based on the reference relationship between the data snapshots in the cascaded snapshot. The application-layer snapshot serves as the index for the data snapshot.
[0169] S802, determine the target data snapshot corresponding to the target application layer snapshot based on the mapping relationship between application layer snapshots and data snapshots.
[0170] S803, subtract the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count of the target data snapshot to obtain the new snapshot reference count of the target data snapshot.
[0171] S804, determine whether the reference count of the new snapshot is the set value. If yes, execute S805; otherwise, execute S810.
[0172] S805, based on the reference relationship between the data snapshots in the cascaded snapshot, determine whether there is a first reference snapshot that references the target data snapshot in each data snapshot. If yes, then execute S806; otherwise, execute S809.
[0173] S806, when the target data snapshot references the second reference snapshot in each data snapshot, determine the current snapshot reference count of the second reference snapshot.
[0174] S807, when the current snapshot reference count of the second reference snapshot is a set value, the target data snapshot and the second reference snapshot are merged to obtain a merged snapshot.
[0175] S808, Delete data in the merged snapshot that has no reference relationship with the first referenced snapshot.
[0176] S809, Delete target data snapshot.
[0177] S810 updates the snapshot reference information of data snapshots other than the target data snapshot based on the reference relationship between the data snapshots in the cascaded snapshot, and updates the container reference information of each data container storing the data snapshots.
[0178] The container reference information for each data container is determined based on the snapshot reference information of the data snapshots stored in the data container.
[0179] The specific processes of S801-S810 described above can be found in the description of the above method embodiments. Their implementation principles and technical effects are similar, and will not be repeated here.
[0180] Figure 9 This is a flowchart illustrating the snapshot processing method in another embodiment. Based on the above embodiments, this embodiment provides an optional example of the snapshot processing method. (Combined with...) Figure 9 The specific implementation process is as follows:
[0181] S901, in response to a snapshot build instruction for a cascaded snapshot, determines the parent application layer snapshot of the new application layer snapshot to be created, and creates a new application layer snapshot.
[0182] S902, determine the target data container where the first data snapshot corresponding to the upper-level application layer snapshot is located.
[0183] S903, determine whether the snapshot type of the new application layer snapshot is a writable snapshot. If yes, execute S904; otherwise, execute S907.
[0184] S904, Create the next level data container of the target data container.
[0185] S905, determine the base data snapshot from the data snapshots stored in the target data container based on the snapshot reference information of the data snapshots stored in the target data container.
[0186] S906, based on the basic data snapshot, creates a new data snapshot corresponding to the application layer snapshot in the next level data container.
[0187] S907, In the target data container, create a second data snapshot that has a reference relationship with the first data snapshot.
[0188] S908, map the previous application layer snapshot to the second data snapshot, and map the new application layer snapshot to the first data snapshot.
[0189] The specific processes of S901-S908 described above can be found in the description of the above method embodiments. Their implementation principles and technical effects are similar, and will not be repeated here.
[0190] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0191] Based on the same inventive concept, this application also provides a snapshot processing apparatus for implementing the snapshot processing method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more snapshot processing apparatus embodiments provided below can be found in the limitations of the snapshot processing method described above, and will not be repeated here.
[0192] In one exemplary embodiment, such as Figure 10 As shown, a snapshot processing device 1 is provided, including: a first processing module 10, a snapshot determination module 20, and a second processing module 30, wherein:
[0193] The first processing module 10 is used to delete the target application layer snapshot in response to a snapshot deletion instruction for the target application layer snapshot of the cascaded snapshot; wherein each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is the data snapshot index.
[0194] The snapshot determination module 20 is used to determine the target data snapshot corresponding to the target application layer snapshot based on the mapping relationship between application layer snapshots and data snapshots;
[0195] The second processing module 30 is used to process the target data snapshot based on the snapshot reference information of the target data snapshot.
[0196] In one exemplary embodiment, the snapshot reference information includes the current snapshot reference count of the target data snapshot; the second processing module 30 includes:
[0197] The first processing unit is used to subtract the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count of the target data snapshot, so as to obtain the new snapshot reference count of the target data snapshot;
[0198] The second processing unit is used to delete the target data snapshot when the number of references to the new snapshot is a set value.
[0199] In one exemplary embodiment, the second processing unit includes:
[0200] The first subunit is used to determine whether there is a first referencing snapshot that references the target data snapshot in each data snapshot, based on the reference relationship between the data snapshots of the cascaded snapshots.
[0201] The second subunit is used to delete data in the target data snapshot that has no reference relationship with the first reference snapshot if the condition is met.
[0202] The third sub-unit is used to delete the target data snapshot if no.
[0203] In one exemplary embodiment, the second subunit is specifically used for:
[0204] When the target data snapshot references the second reference snapshot in each data snapshot, determine the current snapshot reference count of the second reference snapshot; when the current snapshot reference count of the second reference snapshot is a set value, merge the target data snapshot and the second reference snapshot to obtain a merged snapshot; delete data in the merged snapshot that has no reference relationship with the first reference snapshot.
[0205] In an exemplary embodiment, the snapshot processing apparatus 1 further includes an update module, wherein the update module is specifically used for:
[0206] Based on the reference relationships between the data snapshots in the cascaded snapshot, the snapshot reference information of other data snapshots besides the target data snapshot is updated, as well as the container reference information of each data container storing the data snapshots is updated; wherein, the container reference information of each data container is determined based on the snapshot reference information of the data snapshots stored in the data container.
[0207] In an exemplary embodiment, the snapshot processing device 1 further includes a creation module, wherein the creation module specifically includes:
[0208] The first new unit is used to respond to a snapshot build instruction for a cascaded snapshot, determine the parent application layer snapshot of the new application layer snapshot to be created, and create a new application layer snapshot.
[0209] The second newly created unit is used to determine the target data container where the first data snapshot corresponding to the upper-level application layer snapshot is located.
[0210] The third newly created unit is used to determine the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot; wherein, the snapshot type includes writable snapshot or read-only snapshot.
[0211] In an exemplary embodiment, the third newly created unit is specifically used for:
[0212] If the snapshot type of the new application layer snapshot is a writable snapshot, create a next-level data container of the target data container; determine the base data snapshot from the data snapshots stored in the target data container based on the snapshot reference information of the data snapshots stored in the target data container; and create a new data snapshot corresponding to the new application layer snapshot in the next-level data container based on the base data snapshot.
[0213] In one exemplary embodiment, the third newly created unit is further configured to:
[0214] If the snapshot type of the new application layer snapshot is a read-only snapshot, a second data snapshot with a reference relationship to the first data snapshot is created in the target data container; the previous application layer snapshot is mapped to the second data snapshot, and the new application layer snapshot is mapped to the first data snapshot.
[0215] In one exemplary embodiment, the snapshot processing apparatus 1 further includes a rollback module, wherein the rollback module is specifically used for:
[0216] In response to a snapshot rollback command that rolls back from a first application layer snapshot to a second application layer snapshot, determine the rollback data snapshot corresponding to the second application layer snapshot;
[0217] In the data container where the rollback data snapshot is located, create a third data snapshot that has a reference relationship with the rollback data snapshot, and map the second application layer snapshot to the third data snapshot;
[0218] Create a new data container that contains the rollback data snapshot;
[0219] Delete the data snapshot corresponding to the first application layer snapshot, and map the first application layer snapshot to the rollback data snapshot in the new data container.
[0220] Each module in the aforementioned snapshot processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0221] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 11 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores snapshot data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a snapshot processing method.
[0222] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0223] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0224] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0225] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0226] It should be noted that the data involved in this application (including but not limited to snapshot data) is all data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0227] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0228] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0229] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A snapshot processing method, characterized in that, The method includes: In response to a snapshot deletion instruction for a target application layer snapshot of a cascaded snapshot, the target application layer snapshot is deleted; wherein each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is a data snapshot index; Based on the mapping relationship between application layer snapshots and data snapshots, determine the target data snapshot corresponding to the target application layer snapshot; The target data snapshot is processed based on the snapshot reference information of the target data snapshot.
2. The method according to claim 1, characterized in that, The snapshot reference information includes the current snapshot reference count of the target data snapshot; The step of processing the target data snapshot based on the snapshot reference information of the target data snapshot includes: Subtract the number of times the target application layer snapshot references the target data snapshot from the current snapshot reference count of the target data snapshot to obtain the new snapshot reference count of the target data snapshot; If the number of references to the new snapshot is a set value, the target data snapshot is deleted.
3. The method according to claim 2, characterized in that, The deletion process for the target data snapshot includes: Based on the reference relationships between the data snapshots in the cascaded snapshots, determine whether there is a first reference snapshot that references the target data snapshot in each data snapshot; If so, delete the data in the target data snapshot that has no reference relationship with the first reference snapshot; If not, delete the target data snapshot.
4. The method according to claim 3, characterized in that, Deleting data in the target data snapshot that has no reference relationship with the first reference snapshot includes: In the case where the target data snapshot references the second reference snapshot in each data snapshot, the current snapshot reference count of the second reference snapshot is determined; When the current snapshot reference count of the second reference snapshot is the set value, the target data snapshot and the second reference snapshot are fused to obtain a fused snapshot; Delete the data in the fused snapshot that has no reference relationship with the first reference snapshot.
5. The method according to claim 1, characterized in that, After processing the target data snapshot, the method further includes: Based on the reference relationships between the data snapshots in the cascaded snapshots, the snapshot reference information of other data snapshots besides the target data snapshot is updated, and the container reference information of each data container storing the data snapshots is updated; wherein, the container reference information of each data container is determined based on the snapshot reference information of the data snapshots stored in the data container.
6. The method according to claim 1, characterized in that, The method further includes: In response to the snapshot build instruction for the cascaded snapshot, determine the parent application layer snapshot of the new application layer snapshot to be created, and create the new application layer snapshot; Determine the target data container where the first data snapshot corresponding to the previous application layer snapshot is located; Based on the target data container and the snapshot type of the new application layer snapshot, determine the data snapshot corresponding to the new application layer snapshot; wherein, the snapshot type includes a writable snapshot or a read-only snapshot.
7. The method according to claim 6, characterized in that, The step of determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot includes: If the snapshot type of the new application layer snapshot is a writable snapshot, create the next-level data container of the target data container; Based on the snapshot reference information of the data snapshots stored in the target data container, determine the basic data snapshot from the data snapshots stored in the target data container; Based on the aforementioned basic data snapshot, a data snapshot corresponding to the new application layer snapshot is created in the next-level data container.
8. The method according to claim 6, characterized in that, The step of determining the data snapshot corresponding to the new application layer snapshot based on the target data container and the snapshot type of the new application layer snapshot includes: If the snapshot type of the new application layer snapshot is a read-only snapshot, a second data snapshot that has a reference relationship with the first data snapshot is created in the target data container; Map the previous application layer snapshot to the second data snapshot, and map the new application layer snapshot to the first data snapshot.
9. The method according to claim 1, characterized in that, The method further includes: In response to a snapshot rollback instruction that rolls back from a first application layer snapshot to a second application layer snapshot, determine the rollback data snapshot corresponding to the second application layer snapshot; In the data container where the rollback data snapshot is located, a third data snapshot that has a reference relationship with the rollback data snapshot is created, and the second application layer snapshot is mapped to the third data snapshot; Create a new data container that contains the rollback data snapshot; Delete the data snapshot corresponding to the first application layer snapshot, and map the first application layer snapshot to the rollback data snapshot in the new data container.
10. A snapshot processing apparatus, characterized in that, The device includes: The first processing module is configured to delete the target application layer snapshot in response to a snapshot deletion instruction for the target application layer snapshot of the cascaded snapshot; wherein each application layer snapshot of the cascaded snapshot is associated with a data snapshot, and the reference relationship between different application layer snapshots is determined based on the reference relationship between the data snapshots of the cascaded snapshot, and the application layer snapshot is a data snapshot index; The snapshot determination module is used to determine the target data snapshot corresponding to the target application layer snapshot based on the mapping relationship between application layer snapshots and data snapshots; The second processing module is used to process the target data snapshot according to the snapshot reference information of the target data snapshot.