Method and system for processing snapshots
By writing incremental data to a low-cost storage area and generating metadata information during cloud disk write operations, the problem of slow snapshot availability in low-cost storage is solved, achieving a method with low storage costs and extremely fast snapshot availability.
Patent Information
- Application Number
- CN202310115587.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-02-10
AI Technical Summary
In existing technologies, the snapshot method of using low-cost storage for data backup in order to reduce costs makes it difficult to quickly put snapshots into use, and they can only be used after the data is uploaded.
By associating incremental data with the snapshot logical space and writing it to a low-cost storage area during cloud disk write operations, while sharing data with the cloud disk, and using the mapping relationship to generate snapshot metadata information, ultra-fast access to snapshots can be achieved.
Without affecting cloud disk write performance, storage costs are reduced, and snapshots can be made available extremely quickly without additional data uploads, thus improving data access efficiency.
Smart Images

Figure CN116225782B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present specification relate to the technical field of computer technology, and particularly relate to a method for processing snapshots. BACKGROUND
[0002] In the field of cloud computing, a snapshot of a cloud server is a data backup of a cloud disk at a certain time. The snapshot can be used for data recovery when the cloud server fails, providing a guarantee for data security. If a user mistakenly deletes a system file, the system can be quickly restored by rolling back through the snapshot. The snapshot copy can also be used as source data by the upper layer to quickly map to other upper layers, providing convenience for data mining, report query, development and testing, and other applications.
[0003] Currently, in order to reduce costs, low-cost storage is usually used for data backup to implement snapshots. However, the data needs to be uploaded before it can be used, which makes it difficult to quickly put the snapshot into use. Therefore, there is an urgent need for a method for processing snapshots that is low in cost and fast in use. SUMMARY
[0004] Therefore, one or more embodiments of the present specification provide a method for processing snapshots. One or more embodiments of the present specification also provide an apparatus for processing snapshots, a computing device, a computer-readable storage medium, and a computer program to solve the technical defects in the prior art.
[0005] According to a first aspect of an embodiment of the present specification, a method for processing snapshots is provided, including: in response to a cloud disk performing a write operation, associating incremental data caused by the write operation to a snapshot logical space and writing the incremental data to a snapshot storage area outside the cloud disk, the cloud disk also including shared data shared with a snapshot, and a mapping relationship between a logical block address of the shared data on the snapshot logical space and a storage location on the cloud disk being saved in a shared data information set; updating a mapping relationship between a logical block address of the incremental data on the snapshot logical space and a storage location in the snapshot storage area to an incremental data information set of the cloud disk; and obtaining metadata information of the snapshot by using a mapping relationship corresponding to the shared data in the shared data information set and a mapping relationship corresponding to the incremental data in the incremental data information set.
[0006] According to a second aspect of the embodiments of the present specification, there is provided an apparatus for processing a snapshot, comprising: a write processing module configured to, in response to a cloud disk write operation, associate incremental data brought by the write operation to a snapshot logical space and write the incremental data to a snapshot storage area outside the cloud disk, the cloud disk further comprising shared data shared by the snapshot, a mapping relationship between logical block addresses of the shared data on the snapshot logical space and storage locations on the cloud disk being saved in a shared data information set; an incremental information updating module configured to update a mapping relationship between logical block addresses of the incremental data on the snapshot logical space and storage locations in the snapshot storage area to an incremental data information set of the cloud disk; and a metadata generating module configured to obtain metadata information of the snapshot by using a mapping relationship corresponding to the shared data in the shared data information set and a mapping relationship corresponding to the incremental data in the incremental data information set.
[0007] According to a third aspect of the embodiments of the present specification, there is provided a system for processing a snapshot, comprising: a snapshot service module applying a method for processing a snapshot according to any of the embodiments of the present specification, a snapshot storage area implemented in the method for processing a snapshot according to any of the embodiments of the present specification, and a cloud disk implemented in the method for processing a snapshot according to any of the embodiments of the present specification, the cloud disk being one or more.
[0008] According to a fourth aspect of the embodiments of the present specification, there is provided a computing device, comprising: a memory and a processor; the memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions, the computer executable instructions, when executed by the processor, implement steps of the method for processing a snapshot.
[0009] According to a fifth aspect of the embodiments of the present specification, there is provided a computer readable storage medium storing computer executable instructions, the instructions, when executed by a processor, implement steps of the method for processing a snapshot.
[0010] According to a sixth aspect of the embodiments of the present specification, there is provided a computer program, wherein the computer program, when executed in a computer, causes the computer to perform steps of the method for processing a snapshot.
[0011] One embodiment of the present specification provides a method for processing snapshots, which associates incremental data brought by a cloud disk write operation to a snapshot logical space and writes the incremental data to a snapshot storage area outside the cloud disk in response to the write operation, the cloud disk further comprising shared data shared with the snapshot, a mapping relationship between logical block addresses of the snapshot logical space and storage locations on the cloud disk of the shared data being saved in a shared data information set, a mapping relationship between logical block addresses of the snapshot logical space and storage locations of the snapshot storage area of the incremental data being updated to an incremental data information set of the cloud disk, and metadata information of the snapshot being obtained by using the mapping relationship corresponding to the shared data and the mapping relationship corresponding to the incremental data. It can be seen that the method adopts a write-time distribution mode, associates the incremental data to the snapshot storage space and stores the incremental data in a low-cost storage independent of the snapshot by bypassing without affecting the write performance of the cloud disk, the shared data unchanged in the cloud disk is shared with the snapshot, the additional occupation of the high-speed storage space by the snapshot data is reduced, the purpose of reducing the storage cost is achieved, and as long as the mapping information recorded by the shared data information set and the incremental data information set is used, the metadata information of the complete data of the snapshot can be obtained, the mapping relationship between the logical block addresses of the shared data and the incremental data on the snapshot logical space and the storage locations is included in the metadata information, the shared data shared with the cloud disk and the incremental data in the low-cost storage are associated to the snapshot logical space by the reference mode, the creation of the snapshot does not need an additional data uploading operation, the metadata information of the snapshot can be used to achieve extremely fast access to the snapshot, and a method for processing snapshots with low cost and extremely fast availability is implemented. BRIEF DESCRIPTION OF DRAWINGS
[0012] Figure 1 FIG. 1 is a scene diagram in which a method for processing snapshots provided by one embodiment of the present specification is applied in a cloud disk creation scenario;
[0013] Figure 2 FIG. 2 is a flowchart of a method for processing snapshots provided by one embodiment of the present specification;
[0014] Figure 3a FIG. 3 is a diagram of a mapping relationship corresponding to shared data provided by one embodiment of the present specification;
[0015] Figure 3b FIG. 4 is a diagram of a mapping relationship corresponding to incremental data provided by one embodiment of the present specification;
[0016] Figure 3c FIG. 5 is a diagram of metadata information of a snapshot provided by one embodiment of the present specification;
[0017] Figure 4 FIG. 6 is a process flowchart of a method for processing snapshots provided by one embodiment of the present specification;
[0018] Figure 5 is a structural schematic diagram of an apparatus for processing snapshots provided by an embodiment of the present specification;
[0019] Figure 6 is a structural schematic diagram of a system for processing snapshots provided by an embodiment of the present specification;
[0020] Figure 7 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION
[0021] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than in the examples described herein. Those of ordinary skill in the art, and others, can readily ascertain combinations and sub-combinations of the elements of the present specification without departing from the scope of the present specification. Thus, the scope of the present specification is not to be limited by the specific details in the description.
[0022] The terminology used in one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in one or more embodiments of the present specification and the accompanying claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and / or "comprising," when used in one or more embodiments of the present specification, specify the presence of stated features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof.
[0023] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used solely to distinguish one from another only. For example, without departing from the scope of one or more embodiments of the present specification, first can be termed second, and similarly, second can be termed first. The term "if' as used herein, can be interpreted as meaning "when" or "in response to determining" depending on the context.
[0024] First, the noun terms related to one or more embodiments of the present specification are explained.
[0025] Object storage service: an object-based mass storage service that provides users with mass, secure, highly reliable, and low-cost data storage capabilities. Snapshot data can be stored in the object storage service in data blocks.
[0026] Cloud disk: a block device implemented by a cloud vendor through virtualization.
[0027] Snapshot: a backup of the valid data on the cloud disk at a specified time, the snapshot size can be the same as the cloud disk.
[0028] Instantly available snapshot: snapshot data can be accessed without waiting for uploading to object storage.
[0029] Shared data: the data part of the cloud disk referenced by the snapshot in the specification. It can be understood that the data in the cloud disk created by the same snapshot is exactly the same as the data of the snapshot before new data is written, so it can be shared, called shared data. With cloud disk write operation, part of the data in the cloud disk changes, and the shared data decreases accordingly. The unchanged part is the shared data common to the snapshot and the cloud disk. In addition, when the data file size of the cloud disk exceeds the upper limit or the cloud disk actively makes a consistency point, the previously writable data file will be closed and identified as read-only. Since the read-only data file will not change again, such read-only data file can also be used as shared data common to the cloud disk and the snapshot.
[0030] Incremental data: the part of the data that changes relative to the shared data.
[0031] Read-only file: a data file in the cloud disk that is identified as read-only and can be referenced by the snapshot to form shared data referenced by the snapshot.
[0032] Data file: a file actually stored in a storage device (such as a disk). For example, the data written into the cloud disk can finally be stored in several data files of the storage device of the distributed file system, and these data files are the way used by the storage device to organize data for implementing the cloud disk.
[0033] Writeable file: a data file in the cloud disk that can be appended to write, and the data written into the cloud disk can be written into such a file.
[0034] Logical Block Address (LBA): a block device, such as a cloud disk or a snapshot, divides the logical space according to the smallest access unit (data block) and accesses it by block addressing.
[0035] In the specification, a method for processing snapshots is provided, and the specification also relates to an apparatus for processing snapshots, a system for processing snapshots, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0036] Referring to Figure 1 , Figure 1 A scene diagram of the method for processing snapshots provided according to one embodiment of the specification in a cloud disk creation application scenario is shown. As Figure 1As shown, the original cloud disk is a cloud disk created using the original snapshot. The data in the original cloud disk originates from the original snapshot; that is, the original cloud disk is created using the data from the original snapshot. The original cloud disk contains read-only data files and append-only data files. The read-only data files are data obtained from the original snapshot, meaning they are shared data between the cloud disk and the snapshot. The shared data information set contains the mapping relationship between the logical block addresses of the shared data in the snapshot's logical space and their storage locations on the cloud disk. For example... Figure 1 As shown, the storage location of shared data on the cloud disk can be represented by a unique identifier for the read-only data file and the identifier of the storage cluster where the data file resides. When the original cloud disk receives a read access request, no additional processing is required; it can directly return the data actually read. When the original cloud disk receives a write access request and performs a write operation to write incremental data 1 to the original cloud disk, the snapshot service module of the method provided in the embodiments of this specification synchronously writes the incremental data 1 to a snapshot storage area outside the cloud disk, and associates the incremental data 1 with the snapshot logical space. The mapping relationship between the logical block address of incremental data 1 in the snapshot logical space and its storage location in the snapshot storage area is updated in the incremental data information set. The snapshot storage area is located in... Figure 1 The application scenario shown can be represented as a snapshot storage cluster. The snapshot service module dynamically updates the metadata information of snapshot 1, including: obtaining the mapping relationship corresponding to shared data from the shared data information set, obtaining the mapping relationship corresponding to incremental data 1 from the incremental data information set, and merging these two mapping relationships to obtain the updated metadata information of snapshot 1. Subsequently, when the original cloud disk receives a write access request and incremental data 2 is written to the original cloud disk, the snapshot service module synchronously writes incremental data 2 to the snapshot storage area outside the cloud disk, and associates incremental data 2 with the snapshot logical space. The mapping relationship between the logical block address of incremental data 2 in the snapshot logical space and its storage location in the snapshot storage area is updated in the incremental data information set. The snapshot service module dynamically updates the metadata information of snapshot 2, including: obtaining the mapping relationship corresponding to shared data from the shared data information set, obtaining the mapping relationship corresponding to incremental data 1 and incremental data 2 from the incremental data information set, and merging these two mapping relationships to obtain the metadata information of snapshot 2. After obtaining the metadata information of snapshot 2, a new cloud disk can be created using the snapshot data corresponding to the metadata information of snapshot 2. The metadata information is as follows: Figure 1 This can include the mapping relationship between the logical block address of data in the snapshot logical space and the actual storage location of the data. For example, the storage location information can consist of a unique file identifier (file ID) and a storage cluster identifier.
[0037] It should be noted that, Figure 1The application scenarios shown are only used to schematically illustrate the method provided by the embodiments of the present specification, and do not constitute a limitation on the method provided by the embodiments of the present specification. For example, according to the method provided by the embodiments of the present specification, the cloud disk can be a cloud disk of a cloud server for providing any cloud computing capability. The cloud server can be a distributed server cluster including multiple servers, or a single server. The services provided by the cloud server can include basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0038] Referring to Figure 2 , Figure 2 A flowchart of a method for processing a snapshot is shown, according to an embodiment of the present specification, and specifically includes the following steps.
[0039] Step 202: In response to a cloud disk write operation, associating incremental data brought by the write operation to a snapshot logical space and writing the incremental data to a snapshot storage area outside the cloud disk, the cloud disk further including shared data common to the snapshot, and a mapping relationship between a logical block address on the snapshot logical space and a storage location on the cloud disk of the shared data is saved in a shared data information set.
[0040] The snapshot can be represented as a complete logical space as a whole, referred to as a snapshot logical space. The association of the incremental data to the snapshot logical space can also be understood as allocating a logical block address corresponding to the snapshot logical space to the incremental data. Specifically, the snapshot logical space is a logical space divided into blocks of a certain size. For example, each block can be of a fixed size and be assigned a label, such as 0-N, and the complete snapshot logical space can be schematically shown as: Block0|Block1|…|BlockN. Assuming that the cloud disk writes incremental data 1 once, when the incremental data 1 is associated to the snapshot logical space, it is associated to the data block Block1, and the logical block address of the incremental data 1 on the snapshot logical space is Block1.
[0041] The snapshot storage area can be an independent low-cost storage space outside the cloud disk, such as an object storage or any other low-cost storage cluster.
[0042] It should be noted that the snapshot described in the embodiments of the present specification is a set of incremental data. The part of the cloud disk that has no difference or change relative to the snapshot is the shared data common to the snapshot. In the case where the data of the cloud disk is modified, the part of the data that is modified is the incremental data, which is also included in the snapshot.
[0043] The shared data is data in a data file identified as read-only in the cloud disk. Since the data file will not be modified after being identified as read-only, as data referenced by the snapshot, it will not conflict with the write request and will not affect the write performance of the cloud disk. For example, before the cloud disk is created and no new data is written, all data in the cloud disk comes from the snapshot, and all data files are read-only. As the cloud disk receives write requests, incremental data is written to the data file that can be appended to the cloud disk. It can be reasonably assumed that the data file that can be appended to the cloud disk will be closed and identified as read-only at some special time point, such as when the data file exceeds the size limit or actively makes a consistency point. Accordingly, these newly added read-only data files can also be associated with the snapshot logical space as shared data referenced by the snapshot, have corresponding logical block addresses, and the mapping relationship between the corresponding logical block addresses and the storage location on the cloud disk is updated to the shared data information set. The shared data information set can be represented as a mapping table as shown in Figure 3a in actual application.
[0044] The mapping relationship between the logical block address of the shared data on the snapshot logical space and the storage location on the cloud disk includes the logical block address of the shared data on the snapshot logical space, the unique identifier of the data file of the shared data on the cloud disk, and the storage cluster identifier. In this embodiment, the data of the cloud disk is stored in the storage cluster in the form of a data file, and the data is managed based on the data file management mode, so that the snapshot data is managed based on the same mode, and the management is more efficient.
[0045] For example, assuming that the shared data "data file 1" shared by the cloud disk and the snapshot has a logical block address of Block0 on the snapshot logical space and a storage location of cluster 3, file 1 on the cloud disk, the mapping relationship as shown in Figure 3a is included in the shared data information set.
[0046] Step 204: Update the mapping relationship between the logical block address of the incremental data on the snapshot logical space and the storage location in the snapshot storage area to the incremental data information set of the cloud disk.
[0047] For example, assuming that the address of incremental data 1 on the snapshot logical space is Block1, and the storage location in the snapshot storage area is object 3, object storage cluster 1, the mapping relationship as shown in Figure 3b is included in the incremental data information set.
[0048] For example, in one or more embodiments, the updating of the mapping relationship between the logical block address of the incremental data on the snapshot logical space and the storage location in the snapshot storage area into the incremental data information set of the cloud disk can include: determining a snapshot logical space of a current latest version snapshot; and updating the mapping relationship between the logical block address of the incremental data on the determined snapshot logical space and the storage location in the snapshot storage area into the incremental data information set of the cloud disk. That is, if there is no new snapshot, the logical space of the previous snapshot is written, and if there is a new snapshot, the logical space of the new snapshot is written.
[0049] Step 206: obtaining the metadata information of the snapshot by using the mapping relationship corresponding to the shared data in the shared data information set and the mapping relationship corresponding to the incremental data in the incremental data information set.
[0050] In combination with the above example, the mapping relationship as shown in Figure 3a and the mapping relationship as shown in Figure 3b can be used to obtain the metadata information of the snapshot.
[0051] For example, the mapping relationship corresponding to the shared data and the mapping relationship corresponding to the incremental data can be merged to obtain the metadata information of the snapshot. In addition, the metadata information can be saved in a storage file of the metadata information in the order of the logical block addresses of the snapshot logical space, which is not limited by the embodiments of the present specification.
[0052] In combination with the above example, the mapping relationship as shown in Figure 3a and the mapping relationship as shown in Figure 3b are merged to obtain the metadata information of the snapshot as shown in Figure 3c .
[0053] It can be seen that the method provided by the embodiments of the present specification adopts a write-time distribution manner, associates the incremental data to the snapshot storage space and stores the incremental data in the snapshot independent low-cost storage by bypassing without affecting the write performance of the cloud disk, and the unchanged shared data is shared by the snapshot and the cloud disk, which reduces the additional occupation of the high-speed storage space by the snapshot data, and achieves the purpose of reducing the storage cost. Moreover, as long as the mapping information recorded by the shared data information set and the incremental data information set is used, the metadata information of the complete data of the snapshot can be obtained, so that the mapping relationship between the logical block address and the storage location of the shared data and the incremental data on the snapshot logical space is included in the metadata information, which is equivalent to associating the data shared by the cloud disk and the incremental data in the low-cost storage to the snapshot logical space by the reference manner. The creation of the snapshot does not need an additional data uploading operation, and the metadata information of the snapshot can be used to achieve extremely fast access to the snapshot, and a processing method of the snapshot is provided, which is low in cost and fast in use.
[0054] In some embodiments, obtaining the metadata information of the snapshot can be equivalent to completing the creation of the snapshot. In other embodiments, a correctness check of the data is also needed, and the creation of the snapshot is determined to be completed only after the correctness check is passed, to ensure the correctness of the snapshot data. Therefore, in one or more embodiments, after the metadata information of the snapshot is obtained by using the mapping relationship corresponding to the shared data and the mapping relationship corresponding to the incremental data, the method further includes:
[0055] performing a preset correctness check on the shared data and the incremental data;
[0056] determining that the creation of the snapshot is completed when the preset correctness check is passed.
[0057] For example, the correctness check can include partition table information checking, data integrity checking, whether the data can be decompressed, whether the HASH value is consistent, and the like.
[0058] After the snapshot is created, in one or more embodiments of the present specification, the method can further use the snapshot data corresponding to the metadata information of the snapshot to create a new cloud disk.
[0059] It can be understood that the read-only data files of the new cloud disk can also be shared to create a snapshot, which becomes the snapshot data available to other to-be-created cloud disks. This is because: at the beginning of the system, the snapshot data of the original snapshot has only one copy, and after the original cloud disk is created using the original snapshot, since the shared data in the original cloud disk can be referenced as snapshot data, the copy of the snapshot becomes two, that is, the copy of the original snapshot and the copy of the original cloud disk. In this way, when the snapshot data is accessed subsequently, the original snapshot can be accessed, and the original cloud disk can also be accessed. The shared data of the original cloud disk and the incremental data of the snapshot storage area are associated to the snapshot logical space, and one or more new snapshots can be created. The new cloud disk created based on the new snapshot can also be used to access the shared data that has not changed. Therefore, multiple snapshots of the same cloud disk can share a shared data information set, which is used to record the data file information corresponding to the shared data that can be shared by each snapshot in the cloud disk, such as including the unique identifier of the data file corresponding to the snapshot LBA and the cluster identifier where the data file is located. Therefore, the storage location of the shared data of the cloud disk created based on each snapshot in the cloud disk can also be updated to the shared data information set, to provide more referenceable data sources for the subsequent snapshot creation.
[0060] Based on this, in one or more embodiments of the present specification, the method can further include:
[0061] add the storage location of the shared data on the new cloud disk to the mapping relationship of the shared data information set.
[0062] Since the data of the cloud disk is derived from the snapshot, as more and more cloud disks are created, the snapshot data copy is used by many cloud disks, thereby bringing more traffic of accessing the snapshot data. In the above embodiment, by adding the storage location of the shared data on the new cloud disk to the mapping relationship of the shared data information set, the number of snapshot data copies is dynamically expanded, the traffic of subsequently accessing the snapshot data is dispersed, and the purpose of improving the data reading efficiency is achieved. It should be further noted that, on the one hand, when the snapshot is used to create a disk, the mapping relationship in the shared data information set is updated accordingly, and the storage location of the data on the new cloud disk is added, and on the other hand, when a data file of a cloud disk is modified, the data file in the space of the cloud disk cannot be referenced as shared data, at which time, the storage location of the data file needs to be removed from the mapping relationship in the shared data information set.
[0063] In one or more embodiments of the present specification, based on the above embodiment of dynamically expanding the number of snapshot data copies, the new cloud disk is created using the snapshot data corresponding to the metadata information of the snapshot, comprising:
[0064] Using the metadata information of the snapshot, determining the mapping of each logical block address on the snapshot logical space to the storage location of the cloud disk or to the storage location of the snapshot storage area;
[0065] If any logical block address is mapped to multiple cloud disks, any cloud disk is selected from the multiple cloud disks as a cloud disk for obtaining snapshot data based on a preset traffic balancing strategy;
[0066] Obtaining the corresponding snapshot data from the storage location mapped by each logical block address;
[0067] Creating a new cloud disk using the obtained snapshot data.
[0068] The preset traffic balancing strategy can be set according to actual needs, as long as the purpose of dispersing traffic is achieved. For example, the preset traffic balancing strategy can include: evenly distributing traffic, or presetting a corresponding traffic upper limit for a cluster, and when the traffic upper limit is reached, selecting other clusters, etc.
[0069] As can be seen from the above embodiments, when a new cloud disk needs to be created, snapshot data can be obtained from any cloud disk of the multiple cloud disks created from the original snapshot based on the traffic balancing strategy, which can effectively disperse traffic and improve the data reading efficiency of the cloud disk. Of course, snapshot data can also be obtained from the original snapshot, and the embodiments of the present specification do not limit this.
[0070] In one or more embodiments of the present specification, a data file to which the cloud disk writes data can be closed and identified as read-only, for example, the file size is closed and identified as read-only when it exceeds the upper limit, and then data is appended to a new data file, in which case the newly added read-only data file can be added to the shared data information set so that the subsequently created snapshots can share the read-only data file. Specifically, before associating the incremental data caused by the write operation to the snapshot logical space and writing it to the snapshot storage area outside the cloud disk, it also includes:
[0071] The cloud disk determines whether the access request is a write request in response to receiving the access request.
[0072] If it is a write request, it is determined whether the data file to which the write request is directed is a data file that needs to stop writing and is marked as read-only in the cloud disk storage.
[0073] If yes, the data file is stopped writing and marked as read-only, the data file is updated to the shared data information set as shared data of the cloud disk and the snapshot, and the write operation corresponding to the write request is performed in other data files.
[0074] If no, the corresponding write operation is performed in the data file to which the write request is directed.
[0075] Wherein, the other data file can be a newly added data file or other data file that allows writing.
[0076] The following describes the method for processing snapshots in conjunction with the accompanying Figure 4 Taking the application of the method for processing snapshots provided by the present specification in the cloud disk read-write process as an example, the method for processing snapshots is further described. Among them, Figure 4 A processing process flow diagram of a method for processing snapshots provided by one embodiment of the present specification is shown, which specifically includes the following steps.
[0077] Step 402: Receive an access request.
[0078] Step 404: Determine whether the access request is a write request.
[0079] In conjunction with Figure 1 The scenario diagram shown, the snapshot service module will determine whether the access request for any cloud disk is a write request. This is because a read request will not cause data changes, and the snapshot data and the cloud disk remain consistent, and no additional processing is required, and the actual read data can be returned directly.
[0080] Step 406: If it is a read request, the corresponding data is read from the cloud disk according to the read request, and the read data is returned, and the processing of the access request ends.
[0081] Step 408: If it is a write request, it is judged whether the data file to which the write request is directed is a data file that needs to stop writing and is marked as read-only in the cloud disk storage.
[0082] In this step, for a write request, it is checked whether the data file that actually stores data is a data file that needs to stop writing and is marked as read-only.
[0083] Step 410: If yes, the data file is stopped from writing and marked as read-only.
[0084] Since the data file is stopped from writing and marked as read-only, the write operation corresponding to the write request can be performed in other data files.
[0085] Step 412: The data file that is stopped from writing and marked as read-only is updated to the shared data information set as shared data of the cloud disk and snapshot.
[0086] In this step, for the newly added read-only data file, the mapping relationship between the logical block address on the snapshot logical space and the storage location on the cloud disk is updated to the shared data information set, so that it can be shared by the snapshot.
[0087] If it is not a data file that needs to stop writing and is marked as read-only, the write operation can be normally performed in the corresponding data file.
[0088] Step 414: It is judged whether the function of processing snapshots realized by the method provided in the embodiments of the present specification is enabled.
[0089] For example, while writing data of the cloud disk, it can be judged whether the scheme of processing snapshots realized according to the method provided in the embodiments of the present specification has been enabled.
[0090] Step 416: If yes, the incremental data caused by the write operation corresponding to the request is triggered to be sent to the snapshot storage area.
[0091] Through this step, the data written in the cloud disk can be synchronously written into the low-cost snapshot storage space.
[0092] Step 418: It is judged whether the snapshot storage area needs to be generated.
[0093] Step 420: If yes, the snapshot storage area is generated.
[0094] It can be understood that in the case that the existing snapshot storage area is available, a new snapshot storage area does not need to be generated.
[0095] Step 422: The incremental data is associated to the snapshot logical space and written into the snapshot storage area.
[0096] Step 424: updating the mapping relationship between the logical block address of the incremental data on the snapshot logical space and the storage location of the snapshot storage area into the incremental data information set of the cloud disk.
[0097] It can be understood that the snapshots of the same cloud disk can be multiple, and the snapshots can share the same shared data information set and the same incremental data information set. Therefore, when the incremental data is written into the snapshot storage space, the incremental data information set is updated accordingly, that is, the mapping relationship of the incremental data corresponding to the shared data shared by each snapshot is updated. The mapping relationship can also be understood as the reference relationship of the snapshot data.
[0098] Step 426: merging the mapping relationship of the shared data obtained from the shared data information set and the mapping relationship of the incremental data obtained from the incremental data information set.
[0099] In this step, the information of the data file of the data referenced by the snapshot on the cloud disk and the actual storage cluster information (such as the storage space of a certain cluster or cloud disk) are queried from the mapping relationship of the shared data information set, and are merged with the actual storage location of the incremental data saved in the snapshot storage area, thereby generating the metadata information of the snapshot for recording the storage location of the snapshot data. Thus, the creation of the snapshot is completed.
[0100] Corresponding to the method embodiments described above, the present specification also provides a device for processing snapshots, Figure 5 A structural schematic diagram of a device for processing snapshots provided by an embodiment of the present specification is shown. As Figure 5 shown, the device comprises:
[0101] The write processing module 502 is configured to associate the incremental data brought by the cloud disk write operation to the snapshot logical space and write the incremental data into the snapshot storage area outside the cloud disk in response to the cloud disk write operation, the cloud disk further comprising shared data shared by the snapshot, and the mapping relationship between the logical block address of the shared data on the snapshot logical space and the storage location on the cloud disk is saved in the shared data information set.
[0102] The incremental information updating module 504 is configured to update the mapping relationship between the logical block address of the incremental data on the snapshot logical space and the storage location of the snapshot storage area into the incremental data information set of the cloud disk.
[0103] The metadata generation module 506 is configured to obtain the metadata information of the snapshot by using the mapping relationship of the shared data corresponding to the shared data information set and the mapping relationship of the incremental data corresponding to the incremental data information set.
[0104] In one or more embodiments of the present specification, the apparatus further comprises:
[0105] A cloud disk creating module configured to create a new cloud disk using the snapshot data corresponding to the metadata information of the snapshot.
[0106] In one or more embodiments of the present specification, the apparatus further comprises:
[0107] A shared data information set updating module configured to add the storage location of the shared data on the new cloud disk to the mapping relationship of the shared data information set.
[0108] In one or more embodiments of the present specification, the cloud disk creating module can comprise:
[0109] A storage location determining sub-module configured to determine, using the metadata information of the snapshot, the storage location of each logical block address on the snapshot logical space mapped to the cloud disk or mapped to the snapshot storage area.
[0110] A flow dispersion sub-module configured to, if any logical block address is mapped to a plurality of cloud disks, select any one cloud disk from the plurality of cloud disks as a cloud disk for obtaining snapshot data based on a preset flow balancing strategy.
[0111] A data access sub-module configured to obtain corresponding snapshot data from the storage location mapped by each logical block address.
[0112] A cloud disk creating sub-module configured to create a new cloud disk using the obtained snapshot data.
[0113] In one or more embodiments of the present specification, the apparatus further comprises:
[0114] A request type judging module configured to, when the cloud disk receives an access request before the write processing module performs the association of the incremental data caused by the write operation to the snapshot logical space and writing to the snapshot storage area other than the cloud disk, judge whether the access request is a write request.
[0115] A read-only file judging module configured to, if it is a write request, judge whether the data file targeted by the write request is a data file that needs to be stopped from being written and marked as read-only in cloud disk storage.
[0116] A read-only file increasing module configured to, if the read-only file judging module determines that it is, stop the data file from being written and mark it as read-only, update the data file to the shared data information set as shared data shared by the cloud disk and the snapshot, and execute the write operation corresponding to the write request in other data files.
[0117] In one or more embodiments of the present specification, the apparatus further comprises:
[0118] The write request execution module is configured to execute a corresponding write operation in the data file to which the write request is directed if the data file to which the write request is directed is not a data file in the cloud disk storage that needs to stop writing and is marked as read-only.
[0119] In one or more embodiments of the present specification, the apparatus further comprises:
[0120] The read request execution module is configured to read corresponding data from the cloud disk according to the read request if the read request is a read request.
[0121] In one or more embodiments of the present specification, the apparatus further comprises:
[0122] The correctness checking module is configured to, after the metadata generation module obtains the metadata information of the snapshot by using the mapping relationship corresponding to the shared data and the mapping relationship corresponding to the incremental data, perform a preset correctness check on the shared data and the incremental data, and determine that the creation of the snapshot is completed when the preset correctness check passes.
[0123] The above is a schematic scheme of the apparatus for processing a snapshot according to an embodiment of the present specification. It should be noted that the technical scheme of the apparatus for processing a snapshot and the technical scheme of the method for processing a snapshot described above belong to the same concept, and the details of the technical scheme of the apparatus for processing a snapshot that are not described in detail can be referred to the description of the technical scheme of the method for processing a snapshot.
[0124] Corresponding to the method embodiments described above, the present specification also provides an apparatus embodiment for processing a snapshot, Figure 6 A structural schematic diagram of a system for processing a snapshot according to an embodiment of the present specification is shown. As shown in the figure, Figure 6 The system comprises:
[0125] The snapshot service module 602 applies the method for processing a snapshot described in any embodiment of the present specification, the snapshot storage area 604 is implemented by the method for processing a snapshot described in any embodiment of the present specification, and the cloud disk 606 is one or more.
[0126] The above is a schematic scheme of the system for processing a snapshot according to an embodiment of the present specification. It should be noted that the technical scheme of the system for processing a snapshot and the technical scheme of the method for processing a snapshot described above belong to the same concept, and the details of the technical scheme of the system for processing a snapshot that are not described in detail can be referred to the description of the technical scheme of the method for processing a snapshot.
[0127] Figure 7A structural block diagram of a computing device 700 is shown, according to one embodiment of the present specification. The components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 through a bus 730, and a database 750 is used to store data.
[0128] The computing device 700 also includes an access device 740 that enables the computing device 700 to communicate via one or more networks 760. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 740 can include one or more of any type of network interface (e.g., a network interface card (NIC)), wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, Near Field Communication (NFC).
[0129] In one embodiment of the present specification, the above-mentioned components of the computing device 700 and other components not shown in the Figure 7 may be connected to each other, for example, through a bus. It should be understood that Figure 7 the structural block diagram of the computing device shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Other components can be added or replaced as needed by those skilled in the art.
[0130] The computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other type of mobile device, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 700 can also be a mobile or stationary server.
[0131] The processor 720 is configured to execute computer-executable instructions, which, when executed by the processor, perform steps of the method for processing a snapshot.
[0132] The above is a schematic solution of the computing device of the embodiment. It should be noted that the technical solution of the computing device and the technical solution of the method for processing a snapshot belong to the same concept, and details of the technical solution of the computing device not described in detail can be referred to the description of the technical solution of the method for processing a snapshot.
[0133] An embodiment of the present specification further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions, when executed by a processor, implement steps of the method for processing a snapshot.
[0134] The above is a schematic solution of the computer-readable storage medium of the embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the method for processing a snapshot belong to the same concept, and details of the technical solution of the storage medium not described in detail can be referred to the description of the technical solution of the method for processing a snapshot.
[0135] An embodiment of the present specification further provides a computer program, which, when executed in a computer, causes the computer to perform steps of the method for processing a snapshot.
[0136] The above is a schematic solution of the computer program of the embodiment. It should be noted that the technical solution of the computer program and the technical solution of the method for processing a snapshot belong to the same concept, and details of the technical solution of the computer program not described in detail can be referred to the description of the technical solution of the method for processing a snapshot.
[0137] The above-described embodiments of the application have several aspects, no single one of which is solely responsible for the application's desirable attributes. Without limiting the scope of the application as expressed by the claims which follow, some further embodiments make these aspects even more useful. Other embodiments can result in less desirable attributes.
[0138] The computer readable medium can include any entity or apparatus capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, software distribution medium, etc. It should be noted that the computer readable medium can include appropriate contents according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
[0139] It should be noted that for the foregoing method embodiments, the acts described therein can be performed in a different order from the order described, and that some acts can be performed in parallel or concurrently. In addition, some of the acts described above can not be performed in all embodiments. Furthermore, the acts described above can be performed by different parties in some embodiments. Furthermore, each of the acts described above can be performed by specialized hardware components or modules or can be embodied in a software-specific or a generalized computing system or module. Similarly, general-purpose computing systems and modules can be configured to constitute one or more specialized components or modules described above.
[0140] In the above embodiments, the description of each embodiment is focused on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0141] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and do not limit the invention to the specific embodiments described. Obviously, according to the content of the embodiments of the present specification, many modifications and changes can be made. The present specification selects and describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present specification, so that those skilled in the art can well understand and use the present specification. The present specification is limited by the claims and their entire scope and equivalents.
Claims
1. A method for processing snapshots, comprising: In response to a cloud disk write operation, the incremental data resulting from the write operation is associated with the snapshot logical space and written to a snapshot storage area outside the cloud disk. The cloud disk also includes shared data shared with the snapshot. The mapping relationship between the logical block address of the shared data in the snapshot logical space and the storage location on the cloud disk is stored in the shared data information set. The snapshot logical space is a complete logical space represented by the snapshot as a whole. The mapping relationship between the logical block address of the incremental data in the snapshot logical space and the storage location in the snapshot storage area is updated to the incremental data information set of the cloud disk; The metadata information of the snapshot is obtained by using the mapping relationship between the shared data in the shared data information set and the mapping relationship between the incremental data in the incremental data information set.
2. The method according to claim 1, further comprising: Create a new cloud disk using the snapshot data corresponding to the metadata information of the snapshot.
3. The method according to claim 2, further comprising: Add the storage location of the shared data on the new cloud disk to the mapping relationship of the shared data information set.
4. The method according to claim 3, wherein creating a new cloud disk using snapshot data corresponding to the metadata information of the snapshot includes: Using the metadata information of the snapshot, determine the storage location of each logical block address in the snapshot logical space mapped to the cloud disk or the storage location mapped to the snapshot storage area. If any logical block address is mapped to multiple cloud disks, one cloud disk is selected from the multiple cloud disks as the cloud disk for obtaining snapshot data based on a preset traffic balancing strategy. Obtain the corresponding snapshot data from the storage location mapped to each of the logical block addresses; Create a new cloud disk using the acquired snapshot data.
5. The method according to claim 1, further comprising, before associating the incremental data resulting from the write operation to the snapshot logical space and writing it to the snapshot storage area outside the cloud disk: The cloud disk responds to receiving an access request by determining whether the access request is a write request. If it is a write request, determine whether the data file targeted by the write request is a data file in cloud disk storage that needs to be stopped from being written to and marked as read-only; If so, stop writing to the data file and mark it as read-only, update the data file as shared data shared by the cloud disk and the snapshot to the shared data information set, and perform the write operation corresponding to the write request in other data files.
6. The method according to claim 5, further comprising: If the data file targeted by the write request is not a data file in the cloud disk storage that needs to be stopped from being written to and marked as read-only, then the corresponding write operation is performed on the data file targeted by the write request.
7. The method according to claim 1, after obtaining the metadata information of the snapshot using the mapping relationship between the shared data and the incremental data, further includes: A preset correctness check is performed on the shared data and the incremental data; If the preset correctness check passes, the creation of the snapshot is considered complete.
8. A system for processing snapshots, comprising: The snapshot service module employs the snapshot processing method as described in any one of claims 1-7, the snapshot storage area implemented in the snapshot processing method as described in any one of claims 1-7, and the cloud disk implemented in the snapshot processing method as described in any one of claims 1-7.
9. A computing device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method for processing snapshots as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the method for processing a snapshot as described in any one of claims 1 to 7.
11. A computer program product, characterized in that, Includes computer instructions that, when executed by a processor, implement the steps of the method for processing a snapshot as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method, device and equipment for reading and writing data of simplified LUN
CN113553005A
Data processing method and device and electronic equipment
CN114077574A