Index processing method, device and equipment and computer readable storage medium

By deleting and merging incremental snapshot indexes in the cloud disk snapshot chain to generate a third index, the problem of long processing time during cloud disk cloning is solved, and cloning efficiency is improved.

CN121858044APending Publication Date: 2026-04-14BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-09
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

The problem of long loading times for snapshot indexes during cloud disk cloning, especially as the snapshot chain length increases, leads to low efficiency in cloning cloud disks.

Method used

Delete the first incremental snapshot in the cloud disk's snapshot chain, obtain its index and the index of the second incremental snapshot of the next version, generate a third index by merging these indexes, delete the first index, shorten the snapshot chain length, and only load the merged third index for cloning.

Benefits of technology

It improves the efficiency of cloud disk cloning, reduces the time overhead of index loading and merging, and solves the problem of long processing time when cloning cloud disks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121858044A_ABST
    Figure CN121858044A_ABST
Patent Text Reader

Abstract

The invention relates to an index processing method and device, equipment and a computer readable storage medium, and the method comprises the steps: obtaining a first index corresponding to a first incremental snapshot under the condition that the first incremental snapshot is deleted from a snapshot chain of a cloud disk, the first index is used for recording at least one first data block which changes in the cloud disk when the first incremental snapshot is created, a second index corresponding to the second incremental snapshot is obtained, and the second index is used for recording at least one second data block which changes in the cloud disk when the second incremental snapshot is created; and merging the first index to the second index to obtain a third index corresponding to the second incremental snapshot, and deleting the first index in the snapshot chain. According to the method and the device, the length of the snapshot chain is effectively shortened, and when the cloud disk is cloned based on the snapshot chain, the first index of the deleted first incremental snapshot does not need to be loaded, so that the time overhead of index loading and merging in the cloud disk cloning stage is reduced, and the cloud disk cloning efficiency based on the snapshot chain is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cloud storage technology, and in particular to an indexing method, apparatus, device, and computer-readable storage medium. Background Technology

[0002] Cloud disk cloning technology is one of the core technologies in the fields of cloud computing and data management. It provides important support for key application scenarios such as data backup, disaster recovery, rapid deployment of virtual machines, and test environment construction by creating a data copy of the cloud disk at a specific point in time.

[0003] In related technologies, cloud disk systems commonly employ incremental snapshot technology. This means that after the initial full snapshot is created, subsequent snapshots only record data blocks that have changed since the last snapshot, and each incremental snapshot typically corresponds to an incremental index. When cloud disk cloning is required based on this snapshot chain, the system needs to merge the various indexes in the snapshot chain. Therefore, the time required for cloud disk cloning increases with the length of the snapshot chain, resulting in a significant time commitment when loading snapshot indexes during cloud disk cloning. Summary of the Invention

[0004] To address the aforementioned technical problems, this disclosure provides an index processing method, apparatus, device, and computer-readable storage medium to solve the problem of long loading times when cloning cloud disks.

[0005] In a first aspect, embodiments of this disclosure provide an indexing method, including: When the first incremental snapshot is deleted from the snapshot chain of the cloud disk, the first index corresponding to the first incremental snapshot is obtained. The first index is used to record at least one first data block that changed in the cloud disk when the first incremental snapshot was created. The second index corresponding to the second incremental snapshot is also obtained. The second index is used to record at least one second data block that changed in the cloud disk when the second incremental snapshot was created. The snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation. The second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot. The first index is merged into the second index to obtain the third index corresponding to the second incremental snapshot, and the first index is deleted from the snapshot chain. The third index is used to record at least one second data block and at least a portion of the first data blocks in at least one first data block.

[0006] In some optional implementations, after merging the first index into the second index to obtain the third index corresponding to the second incremental snapshot, the index processing method further includes: In response to the cloning instruction for the second incremental snapshot, the target snapshot chain index in the snapshot chain is loaded to clone the cloud disk corresponding to the second incremental snapshot; wherein, the target snapshot chain index includes a third index and an index corresponding to the cloud disk snapshot in the snapshot chain that is located before the second incremental snapshot.

[0007] In some optional implementations, the first index includes at least one first sub-index, and the second index includes at least one second sub-index, wherein the first sub-index is index information of the first data block, and the second sub-index is index information of the second data block; The first index is merged into the second index to obtain the third index, which includes: If the first index includes a duplicate sub-index, delete the duplicate sub-index in the first index to obtain the fourth index; wherein the duplicate sub-index is a first sub-index of at least one first sub-index, and the storage location of the first data block corresponding to the duplicate sub-index is the same as the storage location of the second data block corresponding to a second sub-index in the second index; the first sub-index in the fourth index is concatenated with the second sub-index in the second index to obtain the third index.

[0008] In some optional implementations, the indexing process further includes: When a third incremental snapshot is added to the snapshot chain of the cloud disk, a fifth index corresponding to the third incremental snapshot is constructed. The fifth index is used to record the third data block that changed in the cloud disk when the third incremental snapshot was created, and the fourth data block that did not change in the cloud disk when the third incremental snapshot was created.

[0009] In some optional implementations, when a third incremental snapshot is added to the snapshot chain of the cloud disk, after constructing the fifth index of the third incremental snapshot, the index processing method further includes: In response to the cloning command for the third incremental snapshot, the fifth index is loaded to clone the cloud disk corresponding to the third incremental snapshot.

[0010] In some optional implementations, a fifth index corresponding to the third incremental snapshot is constructed, including: Construct the third sub-index corresponding to the third data block; extract the fourth sub-index corresponding to the fourth data block from the sixth index, where the sixth index includes the index of the cloud disk snapshot located before the third incremental snapshot in the snapshot chain; concatenate the third sub-index and the fourth sub-index to obtain the fifth index.

[0011] In some optional implementations, before obtaining the first index corresponding to the first incremental snapshot, the method further includes: If the number of snapshots in the snapshot chain exceeds a certain threshold, delete the first incremental snapshot; or delete the first incremental snapshot in response to a snapshot deletion command.

[0012] Secondly, embodiments of this disclosure provide an index processing apparatus, comprising: The acquisition module is used to acquire the first index corresponding to the first incremental snapshot when the first incremental snapshot is deleted in the snapshot chain of the cloud disk. The first index is used to record the first data block that changed in the cloud disk when the first incremental snapshot was created. The module is also used to acquire the second index corresponding to the second incremental snapshot. The second index is used to record the second data block that changed in the cloud disk when the second incremental snapshot was created. The snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation. The second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot. The merging module is used to merge the first index into the second index to obtain the third index corresponding to the second incremental snapshot, and delete the first index in the snapshot chain; wherein, the third index is used to record the second data block and at least part of the first data block.

[0013] Thirdly, embodiments of this disclosure provide an electronic device, including: Memory; Processor; and Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the indexing method as described in the first aspect.

[0014] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the indexing processing method described in the first aspect.

[0015] Fifthly, embodiments of this disclosure also provide a computer program product, which includes a computer program or instructions that, when executed by a processor, implement the indexing processing method described above.

[0016] The methods, apparatus, devices, and computer-readable storage media provided in this disclosure improve the feasibility of subsequent index merging by obtaining a first index of the first incremental snapshot and a second index of the second incremental snapshot of the next version of the first incremental snapshot when deleting a first incremental snapshot in the snapshot chain of a cloud disk. Then, by merging the first index into the second index to obtain a third index, which includes the storage locations of all second data blocks in the second incremental snapshot and at least some of the first data blocks in the first incremental snapshot, the third index retains all valid storage locations from both the first and second indices, thereby improving the effectiveness of the third index. Furthermore, after merging to obtain the third index, deleting the first index in the snapshot chain effectively shortens the length of the snapshot chain. When cloning the cloud disk based on the snapshot chain, it is unnecessary to load the first index of the deleted first incremental snapshot, thereby reducing the time overhead of index loading and merging during the cloud disk cloning stage, improving the efficiency of cloud disk cloning based on the snapshot chain, and solving the problem of long loading times for snapshot indexes when cloning cloud disks. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0018] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 A schematic diagram illustrating an application scenario provided by an embodiment of this disclosure; Figure 2 A flowchart of an index processing method provided in this embodiment of the disclosure; Figure 3 This is a schematic diagram of an index provided in some embodiments of this disclosure; Figure 4 This is a schematic diagram of incremental indexing provided in some embodiments of this disclosure; Figure 5 This is a schematic diagram of incremental indexing provided in some other embodiments of this disclosure; Figure 6 This is a schematic diagram of incremental indexing provided in some other embodiments of this disclosure; Figure 7 This is a schematic diagram of the structure of the index processing apparatus provided in the embodiments of this disclosure; Figure 8 This is a schematic diagram of the device provided in an embodiment of the present disclosure. Detailed Implementation

[0020] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0021] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0022] In order to illustrate the technical solutions provided in the embodiments of this disclosure, some terms involved in the embodiments of this disclosure will be introduced below.

[0023] Cloud storage: A network storage service based on cloud computing and distributed storage technology, providing users with on-demand scalable and highly reliable data storage space.

[0024] Data block: A logical unit for snapshot management in a cloud disk.

[0025] Full snapshot: A complete copy of the state of all data blocks on the cloud disk at a specific point in time.

[0026] Full Index: Index information used to record the storage locations of all data blocks in the cloud disk.

[0027] Incremental snapshot: Only records data blocks that have changed since the last snapshot, which can be a full snapshot or an incremental snapshot.

[0028] Incremental index: Index information used to record the storage location of data blocks that have changed in incremental snapshots.

[0029] Snapshot chain: A chained data structure with dependencies, consisting of a series of snapshots of a cloud disk. The snapshot chain records the complete history of disk data changes over time.

[0030] Cloud disk cloning: Clones a snapshot of the source cloud disk, resulting in a target cloud disk with snapshot data completely identical to the source cloud disk. Modifications to the target cloud disk after cloning will not affect the source cloud disk.

[0031] Lazy loading: A technology that enables cloud disks to be available in seconds by cloning virtual machine cloud disks through snapshots without waiting for snapshot data to be downloaded to the cloud disk.

[0032] This disclosure provides an index processing method, which will be described below with reference to specific embodiments.

[0033] Figure 1 This is a schematic diagram illustrating an application scenario provided by an embodiment of the present disclosure, such as... Figure 1 As shown, this application scenario includes the hardware environment of terminal 101 and server cluster 102, with server cluster 102 connected to terminal 101 via a network. By setting up a database on server cluster 102, server cluster 102 can provide storage services to terminal 101, i.e., cloud disks are deployed in server cluster 102. The indexing method provided in this embodiment can be executed by server cluster 102. Exemplarily, the network includes, but is not limited to, wired networks and wireless networks.

[0034] In related technologies, the process of cloning a cloud disk based on a cloud disk snapshot requires first reading the snapshot chain that the source cloud disk snapshot to be copied depends on, tracing back the incremental indexes that the copied cloud disk snapshot depends on in the snapshot chain, and then merging the dependent incremental indexes. Then, lazy loading technology is used to obtain the data blocks from object storage, making the cloned cloud disk immediately available. Subsequently, the data blocks of the copied cloud disk snapshot are downloaded offline to a local copy in the Elastic Block Store (EBS) cluster to improve the read performance of the cloned cloud disk. It is evident that cloning a cloud disk based on a cloud disk snapshot requires loading all incremental indexes that the cloud disk snapshot depends on. For cloud disks with automatic snapshots enabled online, the number of snapshot creation and deletion is relatively frequent. Once the cumulative number of historical snapshots reaches thousands, cloning the cloud disk requires loading thousands of incremental indexes, and some of these incremental indexes may have already been deleted, making the loading process very time-consuming and impacting the efficiency of cloud disk cloning.

[0035] Figure 2 This is a flowchart of an index processing method provided in an embodiment of the present disclosure. This method can be applied to... Figure 1 The application scenarios shown below. The following will be combined with... Figure 1 The application scenarios shown are for Figure 2 The index processing method shown is described below. This method is applied to the server and includes the following specific steps: S201. If the first incremental snapshot is deleted in the snapshot chain of the cloud disk, obtain the first index corresponding to the first incremental snapshot and obtain the second index corresponding to the second incremental snapshot.

[0036] The first index is used to record at least one first data block that changes in the cloud disk when the first incremental snapshot is created, and the second index is used to record at least one second data block that changes in the cloud disk when the second incremental snapshot is created. The snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation. The second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot.

[0037] In this embodiment, a first index is constructed when the first incremental snapshot is created, and a second index is constructed when the second incremental snapshot is created, with the creation time of the first incremental snapshot preceding the creation time of the second incremental snapshot. Both the first and second indexes are incremental indexes; that is, the first index records only the storage location of the first data block that changed in the cloud disk when the first incremental snapshot was created, and the second index records only the storage location of the second data block that changed in the cloud disk when the second incremental snapshot was created.

[0038] It should be noted that since the second incremental snapshot is created after the first incremental snapshot, there is a dependency between the second index and the first index. In related technologies, if a cloud disk is to be cloned based on the second incremental snapshot, it is necessary to load at least the second index, the first index, and the full index of the initial full snapshot of the cloud disk, resulting in a long processing time.

[0039] Figure 3 This is a schematic diagram of an index provided in some embodiments of this disclosure, such as... Figure 3 As shown, SP1 is the full index of the full snapshot of the cloud disk, which includes sub-indexes for the storage locations of data blocks A, B, C, and D, namely A1, B1, C1, and D1, respectively. SP2 is the incremental index of the first incremental snapshot of the cloud disk, i.e., the first index, which includes sub-indexes for the storage locations of two changed first data blocks C and D, namely C2 and D2, respectively. SP3 is the incremental index of the second incremental snapshot of the cloud disk, i.e., the second index, which includes a sub-index for the storage location of the changed second data block A, specifically A3.

[0040] S202. Merge the first index into the second index to obtain the third index corresponding to the second incremental snapshot, and delete the first index in the snapshot chain.

[0041] The third index is used to record at least a portion of the first data block from at least one second data block and at least one first data block.

[0042] In this embodiment, the third index is the index formed by merging the first index and the second index. The storage locations in the third index are not merely the sum of the storage locations in the first index and the second index, but are merged using garbage collection (GC) technology. This results in the third index including the storage locations of all second data blocks in the second index, as well as the storage locations of at least some first data blocks in the first index.

[0043] The following combination Figure 3 and Figure 4 The method for merging the first and second indexes is explained below: Figure 4 This is a schematic diagram of incremental indexing provided in some embodiments of this disclosure, such as... Figure 4 As shown, for example, SP2 is the first index, which includes sub-indexes for three first data block storage locations: A2, C2, and D2. SP3 is the second index, which includes sub-indexes for two second data block storage locations: A3 and C3. When merging SP2 and SP3, since SP3 includes sub-indexes for data blocks A and C, sub-indexes A2 and C2 in SP2 are determined to be invalid sub-indexes. Therefore, the merged third index SP4 includes sub-indexes for three data blocks: A3, C3, and D2. SP4 retains all the sub-indexes for the second data blocks in SP3 and only retains some of the sub-indexes for the first data blocks in SP2.

[0044] like Figure 3 As shown, for example, when merging SP2 and SP3, since the first data blocks that changed in SP2 are C and D, and the second data block that changed in SP3 is A, it is determined that there are no invalid sub-indexes in SP2. The merged third index SP4 includes sub-indexes of three data blocks: A3, C2, and D2. SP4 also retains the sub-indexes of all the first data blocks in SP2 and all the sub-indexes of the second data blocks in SP3.

[0045] In this embodiment, during the merging of the first and second indices, garbage collection is performed on the storage locations in the first index so that the merged third index includes only the valid storage locations in the first index and all the storage locations in the second index. This ensures that the third index retains all the valid storage locations in the first and second indices. Furthermore, the first index in the snapshot chain is deleted, so that when cloning the second incremental snapshot, it is not necessary to load the merged first and second indices; only the third index needs to be loaded to obtain all the valid storage locations in the first and second indices.

[0046] In this embodiment, when deleting the first incremental snapshot in the cloud disk's snapshot chain, the first index of the first incremental snapshot and the second index of the second incremental snapshot of the next version of the first incremental snapshot are obtained, improving the feasibility of subsequent index merging. Then, a third index is obtained by merging the first index into the second index. This third index includes the storage locations of all second data blocks in the second incremental snapshot and the storage locations of at least some first data blocks in the first incremental snapshot, ensuring that the third index retains all valid storage locations from both the first and second indices, thereby improving the effectiveness of the third index. Furthermore, after merging to obtain the third index, the first index is deleted from the snapshot chain, effectively shortening the snapshot chain length. When cloning the cloud disk based on the snapshot chain, it is unnecessary to load the first index of the deleted first incremental snapshot, thus reducing the time overhead of index loading and merging during the cloud disk cloning stage, improving the efficiency of cloud disk cloning based on the snapshot chain, and solving the problem of long loading times for snapshot indexes when cloning cloud disks.

[0047] In some embodiments of this disclosure, after merging the first index into the second index to obtain the third index corresponding to the second incremental snapshot, the index processing method further includes: In response to the cloning instruction for the second incremental snapshot, the target snapshot chain index in the snapshot chain is loaded to clone the cloud disk corresponding to the second incremental snapshot; wherein, the target snapshot chain index includes a third index and an index corresponding to the cloud disk snapshot in the snapshot chain that is located before the second incremental snapshot.

[0048] In this embodiment, upon receiving a cloning instruction for the second incremental snapshot, it is determined that all data blocks of the cloud disk at the time the second incremental snapshot was created need to be cloned. The target snapshot chain index is all indices in the target snapshot chain, and the target snapshot chain is all cloud disk snapshots in the snapshot chain prior to the second incremental snapshot. Specifically, all cloud disk snapshots prior to the second incremental snapshot include other incremental snapshots and full snapshots. The full snapshot is the first snapshot of the cloud disk, and the other incremental snapshots are saved incremental snapshots created between the first and second incremental snapshots.

[0049] The index corresponding to the second incremental snapshot is the merged third index, which is obtained by merging the first and second indices. Both the first and second indices are incremental indexes, and the third index may also be an incremental index. Therefore, it is necessary to load the third index and the indexes of snapshots from previous versions of the third index.

[0050] Specifically, the incremental snapshots in the snapshot block are arranged in the order of their creation. When determining to clone the second incremental snapshot, the third index of the second incremental snapshot and the indices of all snapshots preceding the second incremental snapshot are extracted. The third index is then merged with the indices of all snapshots preceding the second incremental snapshot to obtain the target snapshot chain index. Based on the target snapshot chain index, the corresponding data blocks are obtained through lazy loading technology and downloaded offline to the local copy of the server cluster, thus completing the cloning of the cloud disk based on the second incremental snapshot version.

[0051] It should be noted that since the first incremental snapshot has been deleted, the cloud disk is usually not cloned based on the first incremental snapshot. When the cloud disk is cloned based on the second incremental snapshot, the cloned cloud disk includes at least part of the modified content of the first data block in the first incremental snapshot.

[0052] In this embodiment of the disclosure, upon receiving a cloning instruction for the second incremental snapshot, the cloud disk of the second incremental snapshot version can be cloned by loading the target snapshot chain index. The target snapshot chain index includes a third index corresponding to the second incremental snapshot, and this third index is an index obtained by merging the second index and the first index. Therefore, when loading the snapshot chain index, it is not necessary to load the first index that has been deleted, reducing the number of indexes that need to be loaded, thereby improving the efficiency of cloning the second incremental snapshot.

[0053] In some embodiments of this disclosure, the first index includes at least one first sub-index, and the second index includes at least one second sub-index, wherein the first sub-index is index information of the first data block, and the second sub-index is index information of the second data block; The first index is merged into the second index to obtain the third index, which includes: If the first index includes a duplicate sub-index, delete the duplicate sub-index in the first index to obtain the fourth index; wherein the duplicate sub-index is a first sub-index of at least one first sub-index, and the storage location of the first data block corresponding to the duplicate sub-index is the same as the storage location of the second data block corresponding to a second sub-index in the second index; the first sub-index in the fourth index is concatenated with the second sub-index in the second index to obtain the third index.

[0054] In this embodiment, a first sub-index is used to record the storage location of a first data block, and a second sub-index is used to record the storage location of a second data block. A duplicate sub-index is an invalid sub-index when the first index is merged into the second index. If it is determined that at least one of the first sub-indexes in the first index includes a duplicate sub-index, then the duplicate sub-index in the first index is deleted to obtain a fourth index, which includes the remaining first sub-indexes after deleting the duplicate indexes.

[0055] Figure 5 This is a schematic diagram of incremental indexing provided in some other embodiments of this disclosure, such as... Figure 5 As shown, the sub-indexes in the first index SP2 include A2, B2, and D2, where A2 is a sub-index of the storage location of data block A. The sub-index A3 in the second index SP3 is also a sub-index of the storage location of data block A. Since the second incremental snapshot was created after the first incremental snapshot, sub-index A2 can be determined to be an invalid sub-index in the first index, i.e., a duplicate sub-index. The first index SP2 includes A2, B2, and D2. Deleting the duplicate sub-index A2 yields the fourth index SP0, which includes B2 and D2. Then, B2 and D2 in SP4 are concatenated with A3 in the second index to obtain the third index SP4, which includes A3, B2, and D2.

[0056] It should be noted that if the first index does not contain duplicate sub-indexes, then there is no need to process the first sub-index in the first index. Instead, all the first sub-indexes in the first index are concatenated with all the second sub-indexes in the second index to obtain the third index.

[0057] In this embodiment, after obtaining the first index and the second index, the duplicate sub-indexes in the first index are identified by comparing the first sub-indexes in the first index and the second sub-indexes in the second index. These duplicate sub-indexes are invalid after the first index is deleted. Therefore, during the index merging process, these invalid duplicate sub-indexes in the first index are deleted, resulting in a fourth index that includes all valid first sub-indexes. The data blocks corresponding to all valid first sub-indexes and all second sub-indexes in the fourth index are different. A third index is obtained by concatenating all valid first sub-indexes with all second sub-indexes, ensuring that all sub-indexes in the third index are valid. This shortens the snapshot chain while retaining all valid sub-indexes, thereby improving the accuracy and efficiency of subsequent cloud disk cloning based on the snapshot chain.

[0058] In some embodiments of this disclosure, the index processing method further includes: when a third incremental snapshot is added to the snapshot chain of the cloud disk, constructing a fifth index corresponding to the third incremental snapshot, wherein the fifth index is used to record the third data block that changed in the cloud disk when the third incremental snapshot was created, and the fourth data block that did not change in the cloud disk when the third incremental snapshot was created.

[0059] In this embodiment, when creating a new snapshot of the cloud disk, a third incremental snapshot needs to be added to the snapshot chain. This third incremental snapshot is a snapshot of the third data block in the cloud disk that has changed. The fifth index of the third incremental snapshot is a full index, that is, the index of all data blocks in the cloud disk when the third data block in the cloud disk changes. Therefore, the sub-indexes included in the fifth index include the sub-index of the storage location of the changed third data block and the sub-index of the storage location of the unchanged fourth data block.

[0060] Figure 6 This is a schematic diagram of the full index provided in some embodiments of this disclosure, such as... Figure 6 As shown, SP1 is the initial full index of the full snapshot of the cloud disk. The initial full index includes sub-indexes for the storage locations of data blocks A, B, C, and D, which are A1, B1, C1, and D1, respectively. SP5 and SP6 are both fifth indexes of the newly created third incremental snapshot of the cloud disk, and these fifth indexes are also full indexes. When the third incremental snapshot corresponding to SP5 was created, data blocks A and B changed; therefore, the fifth index of SP5 includes sub-indexes for the storage locations of data blocks A, B, C, and D, which are A5, B5, C1, and D1, respectively. When the third incremental snapshot corresponding to SP6 was created, data blocks A and C changed; therefore, the fifth index of SP6 includes sub-indexes for the storage locations of data blocks A, B, C, and D, which are A6, B5, C6, and D1, respectively.

[0061] It should be noted that the cloud disk can be a newly created cloud disk or an existing cloud disk. The order in which the steps of creating a new incremental snapshot or deleting an incremental snapshot are performed can be configured according to actual needs, and no specific restrictions are imposed here.

[0062] In some possible implementations, when the cloud disk is an existing cloud disk, there may already be a large number of incremental snapshots, and each incremental snapshot corresponds to an incremental index. In this case, when constructing a new third incremental snapshot for the existing cloud disk, a full index of the cloud disk data corresponding to this third incremental snapshot is constructed, i.e., the fifth index. When cloning the cloud disk based on incremental snapshots prior to the third incremental snapshot, the incremental indexes that the incremental snapshots depend on are still loaded; when cloning the cloud disk based on the third incremental snapshot, only the fifth index needs to be recorded for cloud disk cloning.

[0063] In some other possible implementations, when creating a new third incremental snapshot of a newly created cloud disk, a corresponding full index, i.e., the fifth index, is constructed. This ensures that all incremental snapshots in the cloud disk's snapshot chain correspond to full indexes. When cloning a newly created cloud disk, the full index of any incremental snapshot can be directly loaded for cloning.

[0064] In this embodiment, when creating a third incremental snapshot of the cloud disk, a full index of the cloud disk data corresponding to the third incremental snapshot, i.e., the fifth index, is simultaneously constructed. This fifth index includes not only the sub-index of the storage location of the third data block modified by the third incremental snapshot, but also the sub-index of the storage location of the fourth data block not modified by the third incremental snapshot. When cloning the cloud disk based on the third incremental snapshot, the cloning operation can be completed by directly loading the fifth index, without needing to load other indexes in the snapshot chain. This further reduces the number of indexes required when cloning the cloud disk, thereby improving the efficiency of cloning the cloud disk.

[0065] In some embodiments of this disclosure, when a third incremental snapshot is added to the snapshot chain of the cloud disk, after constructing a fifth index of the third incremental snapshot, the index processing method further includes: In response to the cloning command for the third incremental snapshot, the fifth index is loaded to clone the cloud disk corresponding to the third incremental snapshot.

[0066] In this embodiment of the disclosure, upon receiving a cloning instruction for the third incremental snapshot, it is determined that all data blocks of the cloud disk at the time of creating the third incremental snapshot need to be cloned. Since the fifth index corresponding to the third incremental snapshot is a full index, that is, the fifth index includes not only the sub-index of the third data block that changed when the third incremental snapshot was created, but also the sub-index of the fourth data block that did not change when the third incremental snapshot was created, there is no need to load the other indexes in the snapshot chain. The fifth index can be directly loaded to clone the cloud disk corresponding to the third incremental snapshot, which further reduces the number of indexes that need to be loaded when cloning the cloud disk, thereby improving the efficiency of cloning the cloud disk.

[0067] In some embodiments of this disclosure, constructing a fifth index corresponding to the third incremental snapshot includes: Construct the third sub-index corresponding to the third data block; extract the fourth sub-index corresponding to the fourth data block from the sixth index, where the sixth index includes the index of the cloud disk snapshot located before the third incremental snapshot in the snapshot chain; concatenate the third sub-index and the fourth sub-index to obtain the fifth index.

[0068] In this embodiment, the third incremental snapshot is a newly created incremental snapshot of the cloud disk. That is, if there is a changed third data block in the third incremental snapshot, then a third sub-index corresponding to the third data block is constructed. The number of third data blocks is the same as the number of third sub-indexes, and there is a one-to-one correspondence between the third data blocks and the third sub-indexes.

[0069] For example, the third data block that changes is tracked by the write-time redirection technique, and the storage location of each third data block is recorded, thereby obtaining the third sub-index corresponding to each third data block.

[0070] In this embodiment, the sixth index is the index of the cloud disk snapshot created before the creation of the third incremental snapshot. The sixth index includes at least the full index of the initial full snapshot of the cloud disk. If other incremental snapshots were created between the third incremental snapshot and the initial full snapshot, the sixth index also includes the full or incremental indexes corresponding to those other incremental snapshots. The sixth index includes a fourth sub-index of the unchanged fourth data block, and this fourth sub-index is extracted. Since the data blocks corresponding to the third and fourth sub-indexes are different, concatenating the third and fourth sub-indexes yields a fifth index, which includes sub-indexes of all data blocks in the cloud disk.

[0071] In this embodiment of the disclosure, when constructing the fifth index of the third incremental snapshot, a new third sub-index is created only for the third data blocks that have changed in the third incremental snapshot. The fourth sub-index of the fourth data blocks that have not changed is extracted from the sixth index of the previously constructed cloud disk snapshot. The full fifth index is then obtained by concatenation. This ensures that the fifth index not only includes the third sub-index of the third data blocks that have changed, but also that the fourth sub-index in the fifth index is the same as the fourth sub-index in the sixth index. This improves the index consistency of the fourth data blocks that have not changed in the fifth index and the sixth index, and further improves the accuracy of cloning the cloud disk corresponding to the third incremental snapshot based on the fifth index.

[0072] In some embodiments of this disclosure, before obtaining the first index corresponding to the first incremental snapshot, the method further includes: If the number of snapshots in the snapshot chain exceeds a certain threshold, delete the first incremental snapshot; or delete the first incremental snapshot in response to a snapshot deletion command.

[0073] In this embodiment, the cloud disk can enable automatic snapshot functionality. When automatic snapshot functionality is enabled, the cloud disk automatically creates incremental snapshots to record the changed data blocks when data changes. As the number of incremental snapshots and snapshot indexes gradually increases after automatic snapshot functionality is enabled, the cloud disk continuously monitors the number of snapshots in the snapshot chain. When the number of snapshots exceeds a threshold, the cloud disk executes the steps of deleting the first incremental snapshot and merging the first index of the first incremental snapshot into the second index. This shortens the snapshot chain length and also reduces the number of indexes required when cloning the cloud disk.

[0074] For example, when the number of snapshots exceeds a threshold, the incremental snapshot created earlier is preferentially deleted as the first incremental snapshot. Specifically, if the threshold is 1000, when the number of snapshots reaches 1000, the first created incremental snapshot among the 1000 snapshots is selected as the first incremental snapshot.

[0075] In this embodiment, the user can choose to delete the first incremental snapshot in the cloud disk according to actual needs. Specifically, the user issues a snapshot deletion command to the cloud disk, and the cloud disk responds by deleting the first incremental snapshot. This allows the user to choose to delete incremental snapshots in the snapshot chain according to actual needs, that is, the user can choose the first index and the second index to be merged, improving the user's flexibility in shortening the snapshot chain.

[0076] Specifically, each cloud disk snapshot in the snapshot chain corresponds to a version number (Epoch). The snapshot deletion command downloaded by the user to the cloud disk includes the version number, so that the cloud disk can locate the first incremental snapshot to be deleted based on the version number.

[0077] Figure 7 This is a schematic diagram of the structure of an index processing apparatus provided in an embodiment of this disclosure. The index processing apparatus may be a server cluster as described in the above embodiments, or it may be a component or part within the server cluster. The apparatus provided in this disclosure can execute the processing flow provided in the method embodiments, such as... Figure 7 As shown, the index processing device 70 includes: an acquisition module 71 and a merging module 72; The acquisition module 71 is used to acquire the first index corresponding to the first incremental snapshot when the first incremental snapshot is deleted in the snapshot chain of the cloud disk. The first index is used to record the first data block that changed in the cloud disk when the first incremental snapshot was created. The module 71 is also used to acquire the second index corresponding to the second incremental snapshot. The second index is used to record the second data block that changed in the cloud disk when the second incremental snapshot was created. The snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation. The second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot. The merging module 72 is used to merge the first index into the second index to obtain the third index corresponding to the second incremental snapshot, and delete the first index in the snapshot chain; wherein, the third index is used to record the second data block and at least part of the first data block.

[0078] In some embodiments of this disclosure, the index processing apparatus 70 further includes: The first cloning module is used to load the target snapshot chain index in the snapshot chain in response to the cloning instruction of the second incremental snapshot, so as to clone the cloud disk corresponding to the second incremental snapshot; wherein, the target snapshot chain index includes a third index and the index corresponding to the cloud disk snapshot in the snapshot chain that is located before the second incremental snapshot.

[0079] In some embodiments of this disclosure, the first index includes at least one first sub-index, and the second index includes at least one second sub-index, wherein the first sub-index is index information of the first data block, and the second sub-index is index information of the second data block; The index processing device 70 also includes: The deletion module is used to delete the duplicate sub-index in the first index when the first index includes a duplicate sub-index, thereby obtaining a fourth index; wherein the duplicate sub-index is one of the first sub-indexes in at least one first sub-index, and the storage location of the first data block corresponding to the duplicate sub-index is the same as the storage location of the second data block corresponding to one of the second sub-indexes in the second index; The first concatenation module is used to concatenate the first sub-index in the fourth index with the second sub-index in the second index to obtain the third index.

[0080] In some embodiments of this disclosure, the index processing apparatus 70 further includes: The first building module is used to build a fifth index corresponding to the third incremental snapshot when a third incremental snapshot is added to the snapshot chain of the cloud disk. The fifth index is used to record the third data block that changed in the cloud disk when the third incremental snapshot was created, and the fourth data block that did not change in the cloud disk when the third incremental snapshot was created.

[0081] In some embodiments of this disclosure, the index processing apparatus 70 further includes: The second cloning module is used to load the fifth index in response to the cloning instruction for the third incremental snapshot, so as to clone the cloud disk corresponding to the third incremental snapshot.

[0082] In some embodiments of this disclosure, the index processing apparatus 70 further includes: The second building module is used to build the third sub-index corresponding to the third data block; The extraction module is used to extract the fourth sub-index corresponding to the fourth data block from the sixth index, wherein the sixth index includes the index of the cloud disk snapshot located before the third incremental snapshot in the snapshot chain; The second concatenation module is used to concatenate the third sub-index with the fourth sub-index to obtain the fifth index.

[0083] In some embodiments of this disclosure, the index processing apparatus 70 further includes: The deletion module is used to delete the first incremental snapshot when the number of snapshots in the snapshot chain exceeds a number threshold; or to delete the first incremental snapshot in response to a snapshot deletion command.

[0084] Figure 7 The index processing apparatus of the illustrated embodiment can be used to execute the technical solution of the above-described index processing method embodiment. Its implementation principle and technical effect are similar, and will not be repeated here.

[0085] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. The electronic device can be an upgradeable device as described in the above embodiments. The electronic device provided in this disclosure can execute the processing flow provided in the index processing method embodiments, such as… Figure 8 As shown, device 80 includes: memory 81, processor 82, computer program and communication interface 83; wherein the computer program is stored in memory 81 and configured to be executed by processor 82 as described above.

[0086] In addition, this disclosure also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the indexing processing method described in the above embodiments.

[0087] Furthermore, this disclosure also provides a computer program product comprising a computer program or instructions that, when executed by a processor, implement the method described above.

[0088] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0089] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An index processing method, characterized in that, include: In the case of deleting the first incremental snapshot in the snapshot chain of the cloud disk, the first index corresponding to the first incremental snapshot is obtained. The first index is used to record at least one first data block that changed in the cloud disk when the first incremental snapshot was created. The second index corresponding to the second incremental snapshot is also obtained. The second index is used to record at least one second data block that changed in the cloud disk when the second incremental snapshot was created. The snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation. The second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot. The first index is merged into the second index to obtain the third index corresponding to the second incremental snapshot, and the first index is deleted in the snapshot chain; wherein, the third index is used to record at least a portion of the first data blocks in the at least one second data block and the at least one first data block.

2. The index processing method according to claim 1, characterized in that, After merging the first index into the second index to obtain the third index corresponding to the second incremental snapshot, the index processing method further includes: In response to the cloning instruction of the second incremental snapshot, the target snapshot chain index in the snapshot chain is loaded to clone the cloud disk corresponding to the second incremental snapshot; wherein, the target snapshot chain index includes the third index and the index corresponding to the cloud disk snapshot in the snapshot chain that is located before the second incremental snapshot.

3. The index processing method according to claim 1, characterized in that, The first index includes at least one first sub-index, and the second index includes at least one second sub-index. The first sub-index is the index information of the first data block, and the second sub-index is the index information of the second data block. The step of merging the first index into the second index to obtain the third index includes: If the first index includes a duplicate sub-index, the duplicate sub-index in the first index is deleted to obtain a fourth index; wherein the duplicate sub-index is a first sub-index among the at least one first sub-index, and the storage location of the first data block corresponding to the duplicate sub-index is the same as the storage location of the second data block corresponding to a second sub-index in the second index; The third index is obtained by concatenating the first sub-index in the fourth index with the second sub-index in the second index.

4. The index processing method according to any one of claims 1 to 3, characterized in that, The index processing method further includes: When a third incremental snapshot is added to the snapshot chain of the cloud disk, a fifth index corresponding to the third incremental snapshot is constructed. The fifth index is used to record the third data block that changed in the cloud disk when the third incremental snapshot was created, and the fourth data block that did not change in the cloud disk when the third incremental snapshot was created.

5. The index processing method according to claim 4, characterized in that, When adding a third incremental snapshot to the snapshot chain of the cloud disk, after constructing the fifth index of the third incremental snapshot, the index processing method further includes: In response to the cloning instruction for the third incremental snapshot, the fifth index is loaded to clone the cloud disk corresponding to the third incremental snapshot.

6. The index processing method according to claim 4, characterized in that, The construction of the fifth index corresponding to the third incremental snapshot includes: Construct the third sub-index corresponding to the third data block; Extract the fourth sub-index corresponding to the fourth data block from the sixth index, wherein the sixth index includes the index of the cloud disk snapshot located before the third incremental snapshot in the snapshot chain; The third sub-index is concatenated with the fourth sub-index to obtain the fifth index.

7. The index processing method according to any one of claims 1 to 3, characterized in that, Before obtaining the first index corresponding to the first incremental snapshot, the process further includes: If the number of snapshots in the snapshot chain exceeds a threshold, delete the first incremental snapshot; or In response to the snapshot deletion command, the first incremental snapshot is deleted.

8. An index processing apparatus, characterized in that, include: The acquisition module is used to acquire, in the case of deleting the first incremental snapshot in the snapshot chain of the cloud disk, the first index being used to record the first data block that changed in the cloud disk when the first incremental snapshot was created, and to acquire the second index corresponding to the second incremental snapshot, the second index being used to record the second data block that changed in the cloud disk when the second incremental snapshot was created; wherein, the snapshot chain includes multiple cloud disk snapshots arranged in the order of their creation, the second incremental snapshot is adjacent to the first incremental snapshot in the snapshot chain, and the creation order of the first incremental snapshot is before the second incremental snapshot; A merging module is used to merge the first index into the second index to obtain a third index corresponding to the second incremental snapshot, and to delete the first index in the snapshot chain; wherein, the third index is used to record the second data block and at least a portion of the first data block.

9. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 7.