Data block group migration mapping table construction method and device, equipment and storage medium
By setting replica identifiers for data blocks and generating a data block group migration map using snapshot attributes, the problem of low data block migration efficiency is solved, enabling fast lookup and migration of reference snapshots for data blocks and improving data block migration efficiency.
Patent Information
- Application Number
- CN202211151248.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-21
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-09-21
AI Technical Summary
In existing technologies, data block migration is inefficient because it is impossible to effectively distinguish between snapshots as snapshot sources and snapshot identities. This results in the need to traverse all snapshots when looking up the mapping relationship between data blocks and each snapshot, which is inefficient.
By setting a data block replica identifier for a data block and using snapshot attributes such as source replica identifier and source version set identifier to distinguish snapshot identities, a data block group migration mapping table based on snapshot index is generated. This allows the reference snapshot for a specified data block to be found only within the snapshot set, avoiding traversing all snapshots.
It improves the efficiency of data block location and migration, reduces the number of times snapshot sets are traversed, and enhances the speed and efficiency of the data block migration process.
Smart Images

Figure CN115480704B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data backup, and in particular to a data block group migration mapping table construction method and device, equipment and a storage medium. BACKGROUND
[0002] Snapshot technology is about a completely available copy of a specified data set, which includes the image of the corresponding data at a certain time point (the time point when the copy starts). The snapshot can be a copy of the data it represents, or a replica of the data.
[0003] In the prior art, a globally increasing copy identifier recorded when a snapshot is created can be used to identify a newly generated snapshot and the data block generated by the snapshot. When data block migration is required, the entire snapshot set can be traversed, the copy identifier of each snapshot in the snapshot set is compared with the copy identifier of a specified data block, the order of the specified data block and each snapshot is determined, the mapping relationship between the data block and each snapshot is obtained, and subsequent migration is guided.
[0004] However, this method is equivalent to flatly managing snapshots, and the copy identifier of the snapshot cannot distinguish between the two identities of the snapshot as a snapshot source and the snapshot, so when the data block is referenced and positioned, all snapshot sources and snapshot copy identifiers must be traversed to determine the mapping relationship between the data block and each snapshot. When there are many snapshot levels, the efficiency of data block reference positioning is low, thereby causing low efficiency of data block migration. SUMMARY
[0005] The present application provides a data block group migration mapping table construction method, device, equipment and storage medium to solve the problem of low efficiency of data block migration.
[0006] According to an aspect of the present application, a data block group migration mapping table construction method is provided, comprising:
[0007] According to the migration instruction of the data block group, the data block copy identifier of each data block in the data block group is obtained;
[0008] Different data block copy identifiers are sequentially taken as target data block copy identifiers, if the target data block copy identifier exists in the copy identifier mapping table, the target snapshot information matched with the target data block copy identifier is obtained from the copy identifier mapping table;
[0009] If the target data block copy identifier does not exist in the copy identifier mapping table, the target snapshot information matched with the target data block copy identifier is obtained according to the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set;
[0010] According to target snapshot information matched with each data block copy identification, a snapshot index-based data block group migration mapping table is generated.
[0011] Optionally, the snapshot attribute of the snapshot comprises: a source copy identification, a source version set identification, a target copy identification, a target version set identification, and a snapshot version set list taking the snapshot as a source;
[0012] The data block copy identification of the data block is the same as the source copy identification of the snapshot generating the data block.
[0013] By setting the source copy identification and the source version set identification, the two identities of the snapshot as a snapshot source are identified, by setting the target copy identification and the target version set identification, the two identities of the snapshot as a snapshot are identified, by distinguishing the two identities of the snapshot as a snapshot source and a snapshot, hierarchical division management of the snapshot is realized; by storing the snapshot version set list taking the snapshot as a source in the memory of the snapshot, the snapshot source and the snapshot set directly generated by the snapshot source are managed, so that all snapshots referring to a specified data block in the snapshot set can be quickly searched. By setting the data block copy identification for the data block, the new and old degrees of the data block version are recorded.
[0014] Optionally, the target snapshot information matched with the target data block copy identification is obtained according to a hit result of the target data block copy identification and snapshot attributes of each snapshot in the snapshot set, comprising:
[0015] If a first snapshot with the same source copy identification as the target data block copy identification is searched in the snapshot set, the target copy identification of the first snapshot is taken as the target snapshot information matched with the target data block copy identification;
[0016] If the first snapshot with the same source copy identification as the target data block copy identification does not exist in the snapshot set, a second snapshot with the same target copy identification as the target data block copy identification is searched, and the target version set identification of the second snapshot is obtained;
[0017] A snapshot source corresponding to the target version set identification of the second snapshot is determined, and a snapshot version set list of the snapshot source is traversed using a stack structure to obtain a snapshot set corresponding to the target data block copy identification;
[0018] The target copy identification of each snapshot in the snapshot set is taken as the target snapshot information matched with the target data block copy identification.
[0019] According to the technical solution, the snapshot attribute of the snapshot is used, the snapshot source of the data block is found in the snapshot set only by using the data block copy identifier of the data block, and then other snapshots referencing the data block are quickly found according to the snapshot version set list stored in the memory of the snapshot source, so that the referencing result of the data block is obtained without traversing all the snapshots in the snapshot set, and the positioning efficiency of the data block referencing snapshot is improved.
[0020] Optionally, the traversing of the snapshot version set list of the snapshot source by using the stack structure to obtain the snapshot set corresponding to the target data block copy identifier comprises:
[0021] Stacking the snapshot source;
[0022] Stacking the snapshot source;
[0023] According to the traversal operation function, the snapshot version set list of the top snapshot is traversed, and the snapshot with a target copy identifier greater than or equal to the target data block copy identifier is stacked;
[0024] Returning to the step of stacking the top snapshot and adding the top snapshot to the snapshot set until the stack is empty, and obtaining the snapshot set corresponding to the target data block copy identifier.
[0025] According to the technical solution, by stacking the snapshots determined to reference the data block in sequence, the top snapshot is stacked and its snapshot version set list is traversed, and other snapshots determined to reference the data block are filtered out, and by repeating the stacking and stacking process, all the snapshots referencing the data block can be quickly found by traversing the snapshot and the snapshot sub-tree generated by the snapshot.
[0026] Optionally, according to the target snapshot information matched with each data block copy identifier, a data block group migration mapping table based on snapshot index is generated, comprising:
[0027] According to the mapping relationship between the data block index and the data block copy identifier, the target snapshot information matched with each data block copy identifier is converted into a mapping relationship between the data block index and the target snapshot information;
[0028] According to the mapping relationship between the data block index and the target snapshot information, a data block group migration mapping table based on snapshot index is generated.
[0029] According to the technical solution, since the data blocks are distinguished by using the data block index, a data block group migration mapping table based on snapshot index needs to be generated for the data block group to be migrated, so as to reflect the mapping relationship between the snapshot index referencing the migrated data block and the data block index of the migrated data block, and facilitate the data block mapping of the snapshot.
[0030] Optionally, after the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set is identified according to the target data block copy identifier, the target snapshot information matching the target data block copy identifier is obtained, the method further comprises:
[0031] According to the target snapshot information matching the target data block copy identifier, the copy identifier mapping table is updated.
[0032] According to the technical solution, the reference snapshot information of the current migrated data block is updated to the copy identifier mapping table in the memory, the experience data of the data block group mapping table construction process is accumulated, the experience data of the current data migration is reused in the subsequent data block migration process, the construction process of the subsequent data block group migration mapping table is accelerated, and the migration efficiency of the subsequent data block group is improved.
[0033] Optionally, the method further comprises:
[0034] According to the deletion instruction of the third snapshot, the data block included in the third snapshot is deleted, the snapshot attribute stored in the memory structure of the third snapshot is retained, and the target copy identifier of the third snapshot included in the copy identifier mapping table is deleted; and / or,
[0035] After the fourth snapshot is newly created, the snapshot source of the fourth snapshot is determined, a data item including the target copy identifier of the snapshot source is searched in the copy identifier mapping table, and the target copy identifier of the fourth snapshot is added in the data item; and / or,
[0036] According to the instruction of rolling back to the fifth snapshot, the data block included in the master volume is deleted, the snapshot attribute stored in the memory structure of the master volume is retained, and the target copy identifier of the master volume included in the copy identifier mapping table is deleted; after the master volume is rolled back to the fifth snapshot, a data item including the target copy identifier of the fifth snapshot is searched in the copy identifier mapping table, and the target copy identifier of the master volume is added in the data item.
[0037] According to the technical scheme, the snapshot attribute of the snapshot can reflect the snapshot level and help quickly locate the referenced snapshot of the data block to be migrated, so when a snapshot data in the snapshot set needs to be deleted, only the data block included in the snapshot can be deleted, and the snapshot attribute of the snapshot is retained to ensure that the reference location of other data blocks is not affected. Meanwhile, the target copy identifier of the snapshot in the copy identifier mapping table is synchronously deleted to ensure the correctness of the copy identifier mapping table. When a new snapshot is generated, since the data block referenced by the snapshot source will be shared by the snapshot generated by the snapshot source, it is necessary to find the data items including the target copy identifier of the snapshot source in the copy identifier mapping table, and add the target copy identifier of the new snapshot in these data items. When the primary volume is rolled back to the specified snapshot, the original primary volume no longer exists, and the primary volume is equivalent to a snapshot with the specified snapshot as the source. Therefore, when the snapshot is rolled back, the primary volume deletion process is first performed to delete the reference information of the primary volume in the copy identifier mapping table, and then the primary volume is rolled back, and the reference snapshot information in the copy identifier mapping table is scanned. For the data items including the target copy identifier of the specified snapshot, the target copy identifier of the primary volume is added.
[0038] According to another aspect of the present application, a data block group migration mapping table construction device is provided, comprising:
[0039] A obtaining module is configured to obtain data block copy identifiers of each data block in the data block group according to a migration instruction of the data block group.
[0040] A table searching module is configured to sequentially take different data block copy identifiers as target data block copy identifiers, and if the target data block copy identifier exists in the copy identifier mapping table, obtain target snapshot information matched with the target data block copy identifier from the copy identifier mapping table.
[0041] A mapping module is configured to, if the target data block copy identifier does not exist in the copy identifier mapping table, obtain target snapshot information matched with the target data block copy identifier according to a hit result of the target data block copy identifier and snapshot attributes of each snapshot in the snapshot set.
[0042] A table building module is configured to generate a snapshot index-based data block group migration mapping table according to the target snapshot information matched with each data block copy identifier.
[0043] According to another aspect of the present application, an electronic device is provided, comprising:
[0044] at least one processor; and
[0045] a memory connected with the at least one processor in communication; wherein
[0046] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the data block group migration mapping table construction method according to any one of the embodiments of the application.
[0047] According to another aspect of the application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the data block group migration mapping table construction method according to any one of the embodiments of the application when executed by the processor.
[0048] According to the migration instruction of the data block group, the data block copy identifier of each data block in the data block group is acquired first, then for each data block copy identifier, the copy identifier mapping table generated by the positioning reference result of the previously migrated data block is accessed, if the target snapshot information matching the data block copy identifier is included in the copy identifier mapping table, the snapshot of the reference data block is directly determined according to the copy identifier mapping table; if the target snapshot information matching the data block copy identifier is not included in the copy identifier mapping table, the positioning reference operation is performed on each snapshot in the snapshot set according to the data block copy identifier, the snapshot of the reference data block is found, the target snapshot information is acquired, and finally the data block group migration mapping table guiding the data block migration of each snapshot is generated according to the target snapshot information matching each data block copy identifier. According to the embodiments of the application, the positioning reference result of the previously migrated data block is reused by establishing and using the copy identifier mapping table, the positioning reference result of the currently migrated data block is accelerated to determine, and the construction efficiency of the data block group migration mapping table is improved, so that the efficiency of data migration is improved, and the problem of low data block migration efficiency is solved.
[0049] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the application, nor is it used to limit the scope of the application. Other features of the application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0050] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0051] Figure 1 is a flow chart of a data block group migration mapping table construction method according to an embodiment of the application;
[0052] Figure 2is a snapshot version relationship diagram of a snapshot in a snapshot set according to embodiment one of the present application;
[0053] Figure 3 is a flow chart of a data block group migration mapping table construction method according to embodiment two of the present application;
[0054] Figure 4 is a snapshot version relationship diagram according to embodiment two of the present application;
[0055] Figure 5 is a structure schematic diagram of a data block group migration mapping table construction device according to embodiment three of the present application;
[0056] Figure 6 is a structure schematic diagram of an electronic device for implementing the data block group migration mapping table construction method according to the present application. DETAILED DESCRIPTION
[0057] In order to make the personnel in the technical field better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by the person of ordinary skill in the art without making creative efforts should belong to the scope of protection of the present application.
[0058] It should be noted that the terms "first", "second", "target" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0059] Embodiment one
[0060] Figure 1A flowchart of a method for constructing a data block group migration mapping table is provided for the first embodiment of the present application. The first embodiment can be applied to a snapshot set with a large number of snapshot levels, and can quickly construct a data block group migration mapping table corresponding to a data block group to be migrated, to guide the data block migration of each snapshot in the snapshot set. The method can be executed by a data block group migration mapping table construction device, which can be implemented in the form of hardware and / or software, and can be configured in an electronic device.
[0061] As shown in Figure 1 , the method comprises:
[0062] S110, according to the migration instruction of the data block group, obtaining the data block copy identifier of each data block in the data block group.
[0063] The data block group can be an array structure storing a plurality of data blocks to be migrated. The data block to be migrated is a data block included in any snapshot in the snapshot set. The snapshot set refers to a collection of primary volumes and their related snapshots or clones that share the same data domain. In this embodiment, the primary volumes, snapshots, and clones can be collectively referred to as snapshots, and each snapshot includes a plurality of data blocks.
[0064] In this embodiment, in order to implement hierarchical management of snapshots in the snapshot set, when a new snapshot is generated, the snapshot attribute of the newly generated snapshot is configured and stored in the memory. The snapshot attribute of the snapshot includes a source copy identifier, a source version set identifier, a target copy identifier, a target version set identifier, and a snapshot version set list with the snapshot as the source.
[0065] It should be noted that the source copy identifier and the source version set identifier are used to identify the identity of the snapshot as a snapshot source, the target copy identifier and the target version set identifier are used to identify the identity of the snapshot as a snapshot, and the two identities of the snapshot as a snapshot source and a snapshot are distinguished to implement hierarchical division and management of the snapshot. The snapshot version set list with the snapshot as the source is stored in the memory of the snapshot, and the snapshot source and the snapshot set directly generated therefrom are managed, so that all snapshots referring to a specified data block can be quickly found in the snapshot set.
[0066] The snapshot version set represents a snapshot source and all snapshots generated based on the snapshot source. For example, Figure 2As shown, the snapshots 0, 1 and 7 in the snapshot version set-1 are all generated from the same snapshot source, i.e. the primary volume, and the snapshot 1 generates the snapshots 2 and 3 in its life cycle, deriving the snapshot version set-2. In this embodiment, for each snapshot in the snapshot set, all the snapshots generated from it need to be managed in a list or other structure in its memory structure, and each snapshot also needs to provide a mounting point in the memory structure to the snapshot version set list generated from it. Thus, when the structure of a specified snapshot is found, all the snapshots generated from it can be found by traversing the snapshot version set list of the snapshot.
[0067] In this embodiment, in order to record the new and old degree of the data block version, when a new data block is generated, the data block attribute, i.e. the data block copy identifier, is configured for the newly generated data block. The data block copy identifier of the data block is the same as the source copy identifier of the snapshot generating the data block. Since the source copy identifier of the snapshot will increase with the generation of a new snapshot, by taking the source copy identifier of the snapshot generating the data block as the data block copy identifier of the data block, the generation order of the data block and the snapshot can be recorded. Meanwhile, considering that the number of data blocks is relatively large compared with the snapshots, this embodiment only needs to configure the data block copy identifier for the data block to record the data block version, without the need of configuring other attributes for the data block, which can greatly save the disk and memory space.
[0068] S120, sequentially taking different data block copy identifiers as target data block copy identifiers, if the target data block copy identifier exists in the copy identifier mapping table, obtaining target snapshot information matching the target data block copy identifier from the copy identifier mapping table.
[0069] The copy identifier mapping table is generated according to the reference snapshot information of the previously migrated data block, and represents the mapping relationship between the data block copy identifier of the previously migrated data block and the target copy identifier of the reference snapshot.
[0070] In this embodiment, since each data block in the data block group needs to determine the referenced snapshot separately, one data block can be obtained from the data block group as the current data block to be processed, and the data block copy identifier of the current processing data block is taken as the target data block copy identifier. In order to fully reuse the experience data of the previously migrated data block and improve the positioning speed of the data block reference snapshot, the copy identifier mapping table in the memory can be accessed first to determine whether the target data block copy identifier is included in the copy identifier mapping table. Since the data block copy identifier does not change with data migration, if the target data block copy identifier is included in the copy identifier mapping table, it means that the target copy identifier of the data block reference snapshot matched with the target data block copy identifier is recorded in the copy identifier mapping table. At this time, the target snapshot information matched with the target data block copy identifier can be directly obtained from the copy identifier mapping table.
[0071] In S130, if the target data block copy identifier does not exist in the copy identifier mapping table, the target snapshot information matched with the target data block copy identifier is obtained according to the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set.
[0072] In this embodiment, when the data block corresponding to the target data block copy identifier has not been migrated, the target data block copy identifier is not included in the copy identifier mapping table, and the target copy identifier of the data block reference snapshot matched with the target data block copy identifier is not recorded in the copy identifier mapping table. Therefore, the reference snapshot information of the current processing data block cannot be obtained by reusing the experience data of the previously migrated data block. At this time, the snapshot producing the current processing data block can be searched in the snapshot set according to the target data block copy identifier and the two groups of copy identifiers and the version set identifier of the snapshot. Further, whether there is a snapshot also referencing the current processing data block in the snapshot produced from the snapshot as the source is found by traversing the snapshot version set list of the snapshot. For the found reference snapshot, the reference snapshot is found by continuing to traverse the snapshot version set list of the snapshot, and the above process is repeated. All snapshots referencing the current processing data block can be found, and the target snapshot information matched with the target data block copy identifier can be obtained.
[0073] In S140, a data block group migration mapping table based on snapshot index is generated according to the target snapshot information matched with each data block copy identifier.
[0074] In this embodiment, since the data blocks are distinguished by data block indexes, a data block group migration mapping table based on snapshot index needs to be generated for the data block group to be migrated, so as to reflect the mapping relationship between the snapshot index referencing the migrated data block and the data block index of the migrated data block, and facilitate guiding the data block mapping of the snapshot.
[0075] It should be noted that the embodiment analyzes the past data block group migration process, identifies that the result generated by the data block group migration mapping has universality, relative stability and maintainability, and based on the above characteristics, if the corresponding data block group migration mapping table is generated according to the past data block group migration mapping result and temporarily stored in the memory, the efficiency of subsequent data block migration can be accelerated. Wherein, the universality means that a batch of data blocks may have the same data block copy identifier, belong to the same version, and can reuse the same migration mapping result; the relative stability means that the copy identifier of the data block does not change, and the mapping relationship between the data block and the snapshot is also generally relatively stable, and the maintainability means that when the volume set structure changes, for example, new snapshot is generated, snapshot is deleted, snapshot rollback and the like, only a small amount of update is needed to maintain the stability of the data block group migration mapping result.
[0076] Optionally, according to the target snapshot information matched with each data block copy identifier, a data block group migration mapping table based on snapshot index is generated, including: according to the mapping relationship between the data block index and the data block copy identifier, converting the target snapshot information matched with each data block copy identifier into the mapping relationship between the data block index and the target snapshot information; according to the mapping relationship between the data block index and the target snapshot information, generating the data block group migration mapping table based on snapshot index.
[0077] Wherein, the data block index is used to identify each data block, and the mapping relationship between the data block index and the data block copy identifier can be established after obtaining the data block copy identifier of each data block in the data block group. For example, the mapping relationship between the data block index and the data block copy identifier can be shown in Table 1. Wherein, the data block index and the data block copy identifier are necessary information in the mapping relationship, and the data block logical address is optional information, which can be determined according to the configuration whether to add the data block logical address to the mapping relationship between the data block index and the data block copy identifier.
[0078] Table 1
[0079] Data block index Data block logical address (optional) Data block replica identification 0 1000 2 1 1001 4 2 1001 2 3 1010 8
[0080] In the embodiment, after obtaining the target snapshot information matched with each data block copy identifier, the data block index and the target copy identifier of the snapshot referring to the data block can be associated according to the data block copy identifier, and the mapping relationship between the data block index and the target snapshot information is established. For example, the target snapshot information corresponding to the data block copy identifier 2 is 1, 15 and 1000, the data block index corresponding to the data block copy identifier 2 includes 0 and 2, the target snapshot information corresponding to the data block index 0 is 1, 15 and 1000, and the target snapshot information corresponding to the data block index 2 is 1, 15 and 1000. Then, according to the mapping relationship between the data block index and the target snapshot information, the data block group migration mapping table indexed by the target copy identifier of the snapshot is constructed, for example, as shown in Table 2.
[0081] Table II
[0082] Target replica identification of the snapshot Data block list 1 0,1,2 10 1,3 15 0,1,2 10000 0,2
[0083] It should be noted that each item in the data block list in Table II represents a data block, or a batch of data blocks with the same data block copy identifier, corresponding to the data block index in Table I. Table II is strongly related to the group of data blocks input in Table I, that is, the effective range of the result given by Table II is only for this group of data blocks input in Table I, and for the target snapshot information matching the data block copy identifier of this group of data blocks, the effective range is the entire snapshot set, which has strong guiding significance, therefore, the target snapshot information matching each data block copy identifier can be saved for accelerating subsequent data migration.
[0084] The technical scheme of the embodiment of the application first acquires the data block copy identifiers of the data blocks in the data block group according to the migration instruction of the data block group, then for each data block copy identifier, accesses the copy identifier mapping table generated by the positioning reference result of the previously migrated data block, if the target snapshot information matching the data block copy identifier is included in the copy identifier mapping table, directly determines the snapshot of the reference data block according to the copy identifier mapping table; otherwise, performs positioning reference operation on each snapshot in the snapshot set according to the data block copy identifier, finds the snapshot of the reference data block, and acquires the target snapshot information, and finally generates the data block group migration mapping table guiding the data block migration of each snapshot according to the target snapshot information matching each data block copy identifier. The embodiment of the application reuses the positioning reference result of the previously migrated data block by establishing and using the copy identifier mapping table, accelerates the determination of the positioning reference result of the currently migrated data block, improves the construction efficiency of the data block group migration mapping table, thereby improving the efficiency of data migration, and solving the problem of low data block migration efficiency.
[0085] Embodiment II
[0086] Figure 3 is a flowchart of a method for constructing a data block group migration mapping table according to the embodiment II of the application, and the embodiment further illustrates the specific steps of acquiring the target snapshot information matching the target data block copy identifier according to the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set, and the specific steps of using a stack structure to traverse the snapshot version set list of the snapshot source. As shown in Figure 3 the method comprises:
[0087] S310, creating a snapshot set, and setting a snapshot attribute for the snapshots in the snapshot set.
[0088] In the embodiment, the snapshot set can be composed according to the snapshot or clone generated by taking the primary volume as a source, or the snapshot or clone generated by taking the snapshot or clone as a source. Thus, for each snapshot in the snapshot set (the primary volume, the snapshot or the clone), the snapshot can be the snapshot generated according to a snapshot source, or the snapshot source generating a snapshot, having two identities of the snapshot source and the snapshot. Therefore, in order to realize hierarchical management of the snapshots in the snapshot set and reduce the difficulty of locating the data block, the snapshot attribute is configured for each snapshot in the snapshot memory when the snapshot is generated. The snapshot attribute of the snapshot includes the source copy identifier, the source version set identifier, the target copy identifier, the target version set identifier, and the snapshot version set list taking the snapshot as a source.
[0089] For example, the source copy identifier A1 and the source version set identifier B1 are configured for the primary volume, the mounting point is provided in the memory of the primary volume, and the snapshot version set list taking the primary volume as a source is mounted. The snapshot version set list initially only includes the primary volume. The primary volume is taken as a snapshot source, the source copy identifier A1 and the source version set identifier B1 of the snapshot source are respectively assigned to the target copy identifier and the target version set identifier of the snapshot 1 after the snapshot 1 is created. Then two elements A2 and A3 are selected in the copy identifier set according to the element size, the element A2 (A3) is assigned to the source copy identifier of the snapshot source, and the element A3 (A2) is assigned to the source copy identifier of the snapshot 1. One element B2 is selected in the version set identifier set according to the element size order, and the element B2 is assigned to the source version set identifier of the snapshot 1. The mounting point is provided in the memory of the snapshot 1, and the snapshot version set list taking the snapshot 1 as a source is mounted. The snapshot version set list only includes the snapshot 1. The snapshot attribute of the snapshot 1 is added to the snapshot version set list of the snapshot source. The copy identifier set and the version set identifier set can be a natural number set greater than zero.
[0090] On the basis of configuring the snapshot attribute for the snapshot, in the embodiment, for a given snapshot, all the snapshots generated by taking the snapshot as a source can be found by traversing the snapshot version set list of the snapshot, and for these snapshots, all the snapshots generated by taking each snapshot as a source can be obtained by traversing the snapshot version set list in the memory structure of each snapshot. The cycle recursion is equivalent to realizing a snapshot tree, that is, for a given snapshot, all the snapshots generated by the snapshot and the snapshot sub-tree are obtained.
[0091] S320, according to the migration instruction of the data block group, obtaining the data block copy identifier of each data block in the data block group.
[0092] The data block copy identifier of the data block is the same as the source copy identifier of the snapshot generating the data block. Once the data block copy identifier of the data block is generated, it will not be changed.
[0093] S330, in turn, the different data block copy identification as the target data block copy identification, determine whether the copy identification mapping table exists the target data block copy identification, if exists, execute S340, otherwise execute S350.
[0094] Exemplary, copy identification mapping table can be shown as follows:
[0095] Data block replica identification Target replica identification of the reference snapshot 2 1,15,10000 4 1,10,15 8 10
[0096] In this embodiment, after the copy identification mapping table is generated according to the experience data of the data block that has been migrated, the copy mapping identification table can be resident in memory, not released, while introducing the least recently used (LRU) memory eviction mechanism, to ensure that the memory occupancy is controllable.
[0097] S340, if the copy identification mapping table exists the target data block copy identification, from the copy identification mapping table and the target snapshot information matched with the target data block copy identification are obtained, and step S370 is executed.
[0098] In order to overcome the problem that the snapshot set needs to be traversed every time the data block is positioned in the prior art, the embodiment proposes a cache mechanism of data block positioning result, which caches the positioning result of the previous migrated data block in the copy identification mapping table, so that when the current processing data block is positioned, it is first queried whether there is information of the reference snapshot matched with the current processing data block in the copy identification mapping table, if there is, the experience data of the data block that has been migrated is directly reused, and when there is not, the current processing data block is positioned.
[0099] S350, if the copy identification mapping table does not exist the target data block copy identification, according to the hit result of the target data block copy identification and the snapshot attribute of each snapshot in the snapshot set, the target snapshot information matched with the target data block copy identification is obtained.
[0100] Optionally, the obtaining of the target snapshot information matching the target data block copy identifier according to the hit result of the target data block copy identifier and the snapshot attributes of the snapshots in the snapshot set comprises: if a first snapshot with the same source copy identifier as the target data block copy identifier is searched in the snapshot set, taking the target copy identifier of the first snapshot as the target snapshot information matching the target data block copy identifier; if the first snapshot with the same source copy identifier as the target data block copy identifier does not exist in the snapshot set, searching for a second snapshot with the same target copy identifier as the target data block copy identifier and obtaining the target version set identifier of the second snapshot; determining a snapshot source corresponding to the target version set identifier of the second snapshot and traversing the snapshot version set list of the snapshot source using a stack structure to obtain a snapshot set corresponding to the target data block copy identifier; and taking the target copy identifier of each snapshot in the snapshot set as the target snapshot information matching the target data block copy identifier.
[0101] In the embodiment, when the target data block copy identifier is used to locate the data block currently processed, a first snapshot with the same source copy identifier as the target data block copy identifier is searched in the snapshot set. If the first snapshot exists, the first snapshot is the snapshot generating the data block and uniquely referencing the data block. At this time, the first snapshot monopolizes the data block currently processed. The target copy identifier of the first snapshot can be taken as the target snapshot information matching the target data block copy identifier.
[0102] If the first snapshot with the same source copy identifier as the target data block copy identifier does not exist in the snapshot set, it indicates that the snapshot generating the data block currently processed produces other snapshots, resulting in the change of the source copy identifier. Since the target copy identifier of the newly generated snapshot is equal to the source copy identifier of the snapshot source when the new snapshot is produced, and the target copy identifier of the snapshot does not change, the snapshot set must contain a second snapshot with the target copy identifier equal to the target data block copy identifier. The snapshot source of the snapshot version set to which the second snapshot belongs is the snapshot generating the data block currently processed. Therefore, after the second snapshot with the same target copy identifier as the target data block copy identifier is searched, the snapshot source of the snapshot version set to which the second snapshot belongs can be found according to the target version set identifier of the second snapshot. The snapshot version set list of the snapshot source is traversed using a stack structure to filter some snapshots referencing the data block currently processed from the snapshots produced by the snapshot source. Then, the snapshot version set list of the snapshots is traversed using a stack structure to filter the referenced snapshots. The above process is recursively looped to finally obtain a snapshot set referencing the data block currently processed. The target copy identifier of each snapshot in the snapshot set is taken as the target snapshot information matching the target data block copy identifier.
[0103] For example, Figure 4In the shown snapshot version relationship diagram, it is assumed that the target data block copy identifier is A8, and since the snapshot 1 with the source copy identifier A8 is searched in the snapshot set, the snapshot 1 is the only snapshot occupying the data block, and the target copy identifier A8 of the snapshot 1 is the target snapshot information. It is assumed that the target data block copy identifier is A2, and since the snapshot with the source copy identifier equal to A2 cannot be searched in the snapshot set, the snapshot with the target copy identifier equal to A2 is searched in the snapshot set, and the snapshot 2 is found. According to the target version set identifier B1 of the snapshot 2, it is determined that the snapshot source is the snapshot 0. Then, the snapshot version set 1 of the snapshot 0 is traversed according to the stack structure, and the snapshot 2 with the target copy identifier greater than or equal to the target data block copy identifier A2 is found. The snapshot version set 3 of the snapshot 2 is continuously traversed, and the snapshot referencing the data block is searched. Since the snapshot 2 does not generate other snapshots, finally, it is determined that the snapshots referencing the data block include the snapshot 0 and the snapshot 2. Thus, the target snapshot information matching the target data block copy identifier A2 includes X and A2. The target copy identifier and the target version set identifier of the snapshot 0 as the master volume can be set as a special X.
[0104] By means of the snapshot attribute of the snapshot, the snapshot source generating the data block can be found in the snapshot set only by using the data block copy identifier of the data block, and then other snapshots referencing the data block can be quickly found according to the snapshot version set list stored in the memory of the snapshot source, so that the referencing result of the data block is obtained without traversing all snapshots in the snapshot set, and the positioning efficiency of the data block referencing snapshot is improved.
[0105] Optionally, the traversing the snapshot version set list of the snapshot source by using the stack structure to obtain the snapshot set corresponding to the target data block copy identifier includes: stacking the snapshot source; de-stacking the top snapshot of the stack and adding the top snapshot of the stack to the snapshot set; traversing the snapshot version set list of the top snapshot of the stack according to the traversal operation function, and stacking the snapshot with the target copy identifier greater than or equal to the target data block copy identifier; returning to the step of de-stacking the top snapshot of the stack and adding the top snapshot of the stack to the snapshot set until the stack is empty, to obtain the snapshot set corresponding to the target data block copy identifier.
[0106] In this embodiment, the snapshots referencing the data block are stacked in sequence, the top snapshot of the stack is de-stacked and the snapshot version set list thereof is traversed, other snapshots referencing the data block are filtered out from the snapshot version set list, and all snapshots referencing the data block can be quickly found by repeating the stacking and de-stacking process without traversing all snapshots in the snapshot set, but only traversing the snapshot and the snapshot sub-tree generated by the snapshot.
[0107] S360、according to the target snapshot information matching the target data block copy identifier, updating the copy identifier mapping table.
[0108] In this embodiment, after obtaining the target snapshot information matching the target data block copy identifier according to the hit result of the target data block copy identifier and the snapshot attributes of each snapshot in the snapshot set, the target data block copy identifier item can be added in the copy identifier mapping table, and the target snapshot information can be added in the target copy identifier item of the reference snapshot corresponding to the target data block copy identifier. By updating the reference snapshot information of the current migrated data block to the copy identifier mapping table in the memory, experience data can be accumulated in the construction process of the data block group mapping table, so that the experience data of this data migration can be reused in the subsequent data block migration process, the construction process of the subsequent data block group migration mapping table is accelerated, and the migration efficiency of the subsequent data block group is improved.
[0109] It should be noted that, since the copy identifier mapping table is resident in the memory, when the members in the snapshot set change, for example, a new snapshot is created, or a specified snapshot is deleted, or the snapshot is rolled back, the copy mapping identifier needs to be maintained accordingly to ensure the correctness of the result.
[0110] Optionally, it further includes: deleting the data blocks included in the third snapshot according to the deletion instruction of the third snapshot, retaining the snapshot attributes stored in the memory structure of the third snapshot, and deleting the target copy identifier of the third snapshot included in the copy identifier mapping table; and / or,
[0111] After the fourth snapshot is created, the snapshot source for generating the fourth snapshot is determined, a data item including the target copy identifier of the snapshot source is searched in the copy identifier mapping table, and the target copy identifier of the fourth snapshot is added in the data item; and / or,
[0112] According to the instruction of rolling back to the fifth snapshot, the data blocks included in the master volume are deleted, the snapshot attributes stored in the memory structure of the master volume are retained, and the target copy identifier of the master volume included in the copy identifier mapping table is deleted; after the master volume is rolled back to the fifth snapshot, a data item including the target copy identifier of the fifth snapshot is searched in the copy identifier mapping table, and the target copy identifier of the master volume is added in the data item.
[0113] In this embodiment, when the third snapshot in the snapshot set is to be deleted, only the data blocks included in the third snapshot can be deleted, and other snapshots generated from the third snapshot are not deleted, and the snapshot attribute stored in the memory structure of the third snapshot is to be saved, and the mounting point for mounting the version set list of the third snapshot can also be saved accordingly, so as to ensure that the reference positioning of the data blocks is not affected. At the same time, because the third snapshot is deleted and no longer references any data block, the entire replica identifier mapping table is also traversed, and each data block replica identifier item is scanned one by one. For a group of reference snapshot information corresponding to a data block replica identifier, if the target replica identifier of the third snapshot to be deleted exists, the target replica identifier of the third snapshot in the item is deleted to ensure the correctness of the replica identifier mapping table. The third snapshot can be any snapshot to be deleted in the snapshot set.
[0114] In this embodiment, the fourth snapshot can be a new snapshot generated from any snapshot in the snapshot set. When a new snapshot is generated, because the data blocks referenced by the snapshot source will be shared by the snapshot generated therefrom, the reference snapshot of the data block of the snapshot source will change, thereby affecting the correctness of the replica identifier mapping table. Therefore, when the new snapshot is generated, the data items including the target replica identifier of the snapshot source can be found in the target replica identifier column of the reference snapshot of the replica identifier mapping table, and the target replica identifier of the new snapshot can be added to these data items.
[0115] In this embodiment, when the primary volume is rolled back to the specified snapshot, the original primary volume no longer exists, and the primary volume is equivalent to a snapshot with the specified snapshot as the source. Therefore, when the instruction to roll back to the fifth snapshot is received, to roll back the primary volume to the fifth snapshot, the deletion process of the original primary volume needs to be performed first, the data blocks included in the primary volume are deleted, the snapshot attribute stored in the memory structure of the primary volume is saved, and the mounting point for mounting the version set list of the primary volume can also be saved accordingly, and then the target replica identifier of the primary volume is found in the target replica identifier column of the reference snapshot of the replica identifier mapping table and is deleted. Then, the primary volume is rolled back to the fifth snapshot, that is, the data blocks of the fifth snapshot are copied to the primary volume, and the reference snapshot information in the replica identifier mapping table is scanned, and the target replica identifier of the primary volume is added to the data items in which the target replica identifier of the fifth snapshot exists.
[0116] S370, generating a snapshot index-based data block group migration mapping table according to the target snapshot information matched with each data block replica identifier.
[0117] In an optional embodiment, the target snapshot information matched with each data block copy identifier can be converted into a mapping relationship between a data block index and target snapshot information according to a mapping relationship between the data block index and the data block copy identifier; and a snapshot index-based data block group migration mapping table can be generated according to the mapping relationship between the data block index and the target snapshot information.
[0118] In the embodiment, for multi-layer snapshots, the snapshot source and snapshot copies directly generated therefrom are managed in a snapshot version set list added in the memory structure of the snapshot, and a snapshot recursive traversal method based on a stack structure is used to realize the functions of managing multi-layer snapshots and query traversal with less memory occupation. The data block copy identifier information and the reference mapping relationship of the snapshot are uniformly managed in the memory by introducing a copy identifier mapping table, so that the construction process of the previous data block group migration mapping table can guide the construction process of the subsequent data block group migration mapping table, and the overall efficiency of the migration of the data block group is improved.
[0119] Embodiment Three
[0120] Figure 5 is a structural schematic diagram of a data block group migration mapping table construction device provided according to Embodiment Three of the present application. As shown in Figure 5 , the device comprises:
[0121] The acquisition module 510 is configured to acquire data block copy identifiers of each data block in the data block group according to a migration instruction of the data block group.
[0122] The table lookup module 520 is configured to sequentially take different data block copy identifiers as target data block copy identifiers, and acquire target snapshot information matched with the target data block copy identifiers from the copy identifier mapping table if the target data block copy identifiers exist in the copy identifier mapping table.
[0123] The mapping module 530 is configured to acquire target snapshot information matched with the target data block copy identifiers according to a hit result of the target data block copy identifiers and snapshot attributes of each snapshot in a snapshot set if the target data block copy identifiers do not exist in the copy identifier mapping table.
[0124] The table construction module 540 is configured to generate a snapshot index-based data block group migration mapping table according to the target snapshot information matched with each data block copy identifier.
[0125] The technical scheme of the embodiment of the application comprises the following steps: according to the migration instruction of the data block group, the data block copy identifier of each data block in the data block group is acquired; then, for the data block copy identifier of each data block, the copy identifier mapping table generated by the positioning reference result of the previously migrated data block is accessed; if the target snapshot information matching the data block copy identifier is included in the copy identifier mapping table, the snapshot of the reference data block is directly determined according to the copy identifier mapping table; if the target snapshot information matching the data block copy identifier is not included in the copy identifier mapping table, the positioning reference operation is performed on each snapshot in the snapshot set according to the data block copy identifier, the snapshot of the reference data block is found, the target snapshot information is acquired, and finally the data block group migration mapping table guiding the data block migration of each snapshot is generated according to the target snapshot information matching each data block copy identifier. Through the establishment and use of the copy identifier mapping table, the positioning reference result of the previously migrated data block is reused, the positioning reference result of the currently migrated data block is accelerated to be determined, and the construction efficiency of the data block group migration mapping table is improved, so that the efficiency of data migration is improved, and the problem of low data block migration efficiency is solved.
[0126] Optionally, the snapshot attribute of the snapshot comprises: a source copy identifier, a source version set identifier, a target copy identifier, a target version set identifier, and a snapshot version set list taking the snapshot as a source.
[0127] The data block copy identifier of the data block is the same as the source copy identifier of the snapshot generated by the data block.
[0128] Optionally, the mapping module 530 comprises:
[0129] The first searching unit is configured to, if the first snapshot with the source copy identifier same as the target data block copy identifier is searched in the snapshot set, take the target copy identifier of the first snapshot as the target snapshot information matching the target data block copy identifier.
[0130] The second searching unit is configured to, if the first snapshot with the source copy identifier same as the target data block copy identifier does not exist in the snapshot set, search the second snapshot with the target copy identifier same as the target data block copy identifier, and acquire the target version set identifier of the second snapshot.
[0131] The traversal unit is configured to determine the snapshot source corresponding to the target version set identifier of the second snapshot, and traverse the snapshot version set list of the snapshot source using a stack structure to obtain the snapshot set corresponding to the target data block copy identifier.
[0132] The mapping unit is configured to take the target copy identifier of each snapshot in the snapshot set as the target snapshot information matching the target data block copy identifier.
[0133] Optionally, the traversing unit is configured to:
[0134] stack the snapshot source;
[0135] pop the top snapshot and add the top snapshot to the snapshot set;
[0136] traverse the list of snapshot version sets of the top snapshot according to the traversal operation function, and stack the snapshot whose target copy identification is greater than or equal to the target data block copy identification;
[0137] return to the step of popping the top snapshot and adding the top snapshot to the snapshot set until the stack is empty, to obtain a snapshot set corresponding to the target data block copy identification.
[0138] Optionally, the table building module 540 is configured to:
[0139] convert the target snapshot information matched with each data block copy identification into a mapping relationship between the data block index and the target snapshot information according to the mapping relationship between the data block index and the data block copy identification;
[0140] generate a data block group migration mapping table based on the snapshot index according to the mapping relationship between the data block index and the target snapshot information.
[0141] Optionally, the system further comprises an updating module configured to, after obtaining the target snapshot information matched with the target data block copy identification according to the hit result of the target data block copy identification and the snapshot attributes of each snapshot in the snapshot set, update the copy identification mapping table according to the target snapshot information matched with the target data block copy identification.
[0142] Optionally, the system further comprises:
[0143] a deleting module configured to, according to a deletion instruction of a third snapshot, delete the data blocks included in the third snapshot, retain the snapshot attributes stored in the memory structure of the third snapshot, and delete the snapshot attributes of the third snapshot included in the copy identification mapping table; and / or
[0144] after a fourth snapshot is newly created, determine a snapshot source of the fourth snapshot, find a data item including a target copy identification of the snapshot source in the copy identification mapping table, and add the target copy identification of the fourth snapshot in the data item; and / or
[0145] according to an instruction of rolling back to a fifth snapshot, delete the data blocks included in the primary volume, retain the snapshot attributes stored in the memory structure of the primary volume, and delete the target copy identification of the primary volume included in the copy identification mapping table; after the primary volume is rolled back to the fifth snapshot, find a data item including a target copy identification of the fifth snapshot in the copy identification mapping table, and add the target copy identification of the primary volume in the data item.
[0146] The data block group migration mapping table construction device provided by the embodiment of the present application can execute the data block group migration mapping table construction method provided by any embodiment of the present application, and has the function modules and beneficial effects corresponding to the execution method.
[0147] Embodiment four
[0148] Figure 6 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.
[0149] As shown in Figure 6 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11, wherein the memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0150] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, a loudspeaker, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0151] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, and the like. The processor 11 performs various methods and processes described above, such as the method of constructing a data block group migration mapping table.
[0152] In some embodiments, the method of constructing a data block group migration mapping table can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the method of constructing a data block group migration mapping table described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the method of constructing a data block group migration mapping table by any other suitable means, such as by means of firmware.
[0153] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0154] Computer programs used to implement the methods of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a stand-alone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0155] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0156] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0157] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), blockchain network, and the Internet.
[0158] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.
[0159] It should be understood that the various forms of flow shown above can be used to reorder, add or delete steps. For example, each step described in the present application can be executed in parallel, sequentially or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which is not limited herein.
[0160] The above detailed description does not constitute a limitation on the scope of protection of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method of constructing a data chunk group migration mapping table, characterized by, The method comprises the following steps: According to the migration instruction of the data block group, the data block copy identifier of each data block in the data block group is obtained; Different data block copy identifiers are sequentially taken as target data block copy identifiers. If the target data block copy identifier exists in the copy identifier mapping table, the target snapshot information matched with the target data block copy identifier is obtained from the copy identifier mapping table; If the target data block copy identifier does not exist in the copy identifier mapping table, the target snapshot information matched with the target data block copy identifier is obtained according to the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set; According to the target snapshot information matched with each data block copy identifier, a snapshot index-based data block group migration mapping table is generated; The snapshot attribute of the snapshot comprises a source copy identifier, a source version set identifier, a target copy identifier, a target version set identifier, and a snapshot version set list taking the snapshot as a source; The data block copy identifier of the data block is the same as the source copy identifier of the snapshot in which the data block is generated; The target snapshot information matched with the target data block copy identifier is obtained according to the hit result of the target data block copy identifier and the snapshot attribute of each snapshot in the snapshot set, which comprises: If a first snapshot in which the source copy identifier is the same as the target data block copy identifier is searched in the snapshot set, the target copy identifier of the first snapshot is taken as the target snapshot information matched with the target data block copy identifier; If the first snapshot in which the source copy identifier is the same as the target data block copy identifier does not exist in the snapshot set, a second snapshot in which the target copy identifier is the same as the target data block copy identifier is searched, and the target version set identifier of the second snapshot is obtained; The snapshot source corresponding to the target version set identifier of the second snapshot is determined, and the snapshot version set list of the snapshot source is traversed using a stack structure to obtain a snapshot set corresponding to the target data block copy identifier; The target copy identifier of each snapshot in the snapshot set is taken as the target snapshot information matched with the target data block copy identifier.
2. The method of claim 1, wherein, The snapshot set corresponding to the target data block copy identifier is obtained by traversing the snapshot version set list of the snapshot source using a stack structure, which comprises: The snapshot source is stacked; The top snapshot of the stack is out-stacked, and the top snapshot of the stack is added to the snapshot set; According to the traversal operation function, the snapshot version set list of the top snapshot of the stack is traversed, and the snapshot in which the target copy identifier is greater than or equal to the target data block copy identifier is stacked; The step of out-stacking the top snapshot of the stack and adding the top snapshot of the stack to the snapshot set is returned until the stack is empty, and the snapshot set corresponding to the target data block copy identifier is obtained.
3. The method of claim 1, wherein, The snapshot index-based data block group migration mapping table is generated according to the target snapshot information matched with each data block copy identifier, which comprises: According to the mapping relationship between the data block index and the data block copy identifier, the target snapshot information matched with each data block copy identifier is converted into the mapping relationship between the data block index and the target snapshot information; According to the mapping relationship between the data block index and the target snapshot information, a data block group migration mapping table based on snapshot index is generated.
4. The method of claim 1, wherein, After the target snapshot information matching the target data block copy identifier is obtained according to the hit result of the target data block copy identifier and snapshot attributes of each snapshot in the snapshot set, the method further comprises: According to the target snapshot information matching the target data block copy identifier, the copy identifier mapping table is updated.
5. The method of claim 1, wherein, Further comprising: According to the deletion instruction of the third snapshot, the data blocks included in the third snapshot are deleted, the snapshot attributes stored in the memory structure of the third snapshot are retained, and the target copy identifier of the third snapshot included in the copy identifier mapping table is deleted; And / or, After the fourth snapshot is newly created, the snapshot source of generating the fourth snapshot is determined, the data item including the target copy identifier of the snapshot source is searched in the copy identifier mapping table, and the target copy identifier of the fourth snapshot is added in the data item; And / or, According to the instruction of rolling back to the fifth snapshot, the data blocks included in the master volume are deleted, the snapshot attributes stored in the memory structure of the master volume are retained, and the target copy identifier of the master volume included in the copy identifier mapping table is deleted; After the master volume is rolled back to the fifth snapshot, the data item including the target copy identifier of the fifth snapshot is searched in the copy identifier mapping table, and the target copy identifier of the master volume is added in the data item.
6. An apparatus for constructing a data chunk group migration mapping table, the apparatus comprising: Comprise: An acquisition module is configured to acquire data block copy identifiers of data blocks in a data block group according to a migration instruction of the data block group; A table searching module is configured to sequentially take different data block copy identifiers as target data block copy identifiers, and if the target data block copy identifier exists in a copy identifier mapping table, acquire target snapshot information matching the target data block copy identifier from the copy identifier mapping table; A mapping module is configured to, if the target data block copy identifier does not exist in the copy identifier mapping table, acquire target snapshot information matching the target data block copy identifier according to a hit result of the target data block copy identifier and snapshot attributes of each snapshot in a snapshot set; A table building module is configured to generate a data block group migration mapping table based on snapshot index according to target snapshot information matching each data block copy identifier; The snapshot attributes of the snapshot include a source copy identifier, a source version set identifier, a target copy identifier, a target version set identifier, and a snapshot version set list taking the snapshot as a source; The data block copy identifier of the data block is the same as the source copy identifier of generating a snapshot of the data block; The mapping module comprises: A first searching unit is configured to, if a first snapshot with the same source copy identifier as the target data block copy identifier is searched in the snapshot set, take the target copy identifier of the first snapshot as the target snapshot information matching the target data block copy identifier; A second searching unit is configured to, if the first snapshot with the same source copy identifier as the target data block copy identifier does not exist in the snapshot set, search a second snapshot with the same target copy identifier as the target data block copy identifier, and acquire the target version set identifier of the second snapshot. The traversal unit is configured to determine a snapshot source corresponding to a target version set identifier of the second snapshot, and traverse a snapshot version set list of the snapshot source using a stack structure to obtain a snapshot set corresponding to the target data block copy identifier; The mapping unit is configured to map a target copy identifier of each snapshot in the snapshot set as target snapshot information matching the target data block copy identifier.
7. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the data block group migration mapping table construction method of any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to implement the data block group migration mapping table construction method of any one of claims 1-5 when executed.
Citation Information
Patent Citations
Method and system for active replication for Cache of multi-core processor
CN102117262A
Positioning method for quickly positioning data block references in snapshot system
CN111007990A