Data storage method and data query method based on snapshot

By adopting a chain-cascaded snapshot metadata topology in the snapshot storage system, the problem of difficulty in maintaining the metadata of snapshot volume is solved, efficient data updates and queries are realized, and multiple snapshot rollbacks are supported.

CN114741236BActive Publication Date: 2025-03-14HANGZHOU HIKVISION SYST TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210378402.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-12
Publication Date
2025-03-14
Estimated Expiration
2042-04-12

AI Technical Summary

Technical Problem

In the prior art, the metadata maintenance of snapshot volumes is difficult, resulting in frequent updates of the metadata address information when data is updated frequently, which increases the difficulty of system maintenance.

Method used

A chain-cascaded snapshot metadata topology is adopted, and the data storage location of the block is recorded through the cascade relationship between the backbone root node and the backbone cascade node, so as to avoid recording specific address information in the metadata.

Benefits of technology

It reduces the difficulty of maintaining metadata, improves the efficiency of data updates and queries, and supports multiple snapshot rollbacks and data recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114741236B_ABST
    Figure CN114741236B_ABST
Patent Text Reader

Abstract

The present application discloses a data storage method and a data query method based on snapshots. Based on the present application, a snapshot metadata topology based on chain cascade can be provided, in which different topological nodes are used to represent the target data volume of the executed snapshot and the target snapshot volume generated in response to snapshots at different times, respectively. Each topological node and the corresponding volume space can have a mapping relationship with block granularity, and each topological node can record whether the data of each block is in the mapping area of ​​the volume space corresponding to the topological node. Through the cascading references between the topological nodes, each target snapshot volume can be referenced to the snapshot data of all the blocks it contains with block granularity, and the volume space where the snapshot data of each snapshot is located can be represented by an independent topological node to help reduce the difficulty of metadata maintenance. In addition, the present application can also support multiple snapshot rollbacks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data storage technology, and in particular to a snapshot-based data storage method, a snapshot-based data query method, a snapshot-based data storage device, a snapshot-based data query device, an electronic device, a data storage system, and a storage medium. Background Art

[0002] Snapshots can back up data at any point in time, and data backed up using snapshots can be queried and even restored by accessing the snapshot volume.

[0003] One of the commonly used snapshot implementation methods is COW (Copy On Write), that is, the obsolete data that is replaced by the writing of new data in each data block of the data volume can be moved to the volume space of the snapshot volume and stored as snapshot data, and the metadata of the snapshot volume will record the address information of the storage location of the snapshot data in the volume space of the snapshot volume. At the same time, the original data in the data volume that has not been updated will also be used as snapshot data, and the metadata of the snapshot volume also needs to record the storage location of other snapshot data in the volume space of the data volume.

[0004] Moreover, as the data volume is continuously updated, multiple consecutive snapshots are needed to back up the latest data in the data volume. Accordingly, the data eliminated after each data update will be continuously stored in the volume space of the snapshot volume as snapshot data. Therefore, the metadata of the snapshot volume will continuously update the recorded address information.

[0005] It can be seen that the continuous updating of the address information recorded in the metadata will make it difficult to maintain the metadata. Therefore, how to reduce the difficulty of maintaining the metadata has become a technical problem to be solved in the prior art. Summary of the invention

[0006] In an embodiment of the present application, a snapshot-based data storage method, a snapshot-based data query method, a snapshot-based data storage device, a snapshot-based data query device, an electronic device, a data storage system and a storage medium are provided, which help to reduce the difficulty of maintaining metadata.

[0007] In one embodiment, a snapshot-based data storage method is provided, comprising:

[0008] (i) In response to a data snapshot of the target data volume, configuring a snapshot metadata topology of the target data volume so that the snapshot metadata topology has topological nodes including:

[0009] The trunk root node that has a block-based mapping relationship with the volume space of the target data volume, and,

[0010] A trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot in a block-sized granularity, the trunk cascade node being created at the end of a chain cascade starting from the trunk root node in response to generation of a corresponding target snapshot volume;

[0011] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the node information of the trunk cascade node created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the target data volume are not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0012] (ii) In response to data update of any valid block in the target data volume after the target snapshot volume is generated, if the node information of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then:

[0013] The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and

[0014] The node information of the trunk cascade node is updated to indicate that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0015] In some examples, optionally, the node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, wherein: each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to changeably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0016] In some examples, optionally, the data storage method further includes:

[0017] (iii) in response to deletion of a snapshot of any target snapshot volume generated for the target data volume, deleting a trunk cascade node corresponding to the deleted target snapshot volume in the snapshot metadata topology;

[0018] If the trunk cascade node corresponding to the deleted target snapshot volume has a parent trunk cascade node, any valid block has snapshot data stored in the volume space of the deleted target snapshot volume, and the volume space of the target snapshot volume corresponding to the parent trunk cascade node does not store snapshot data of the valid block, then:

[0019] Transferring the snapshot data of the valid block in the volume space of the deleted target snapshot volume to the mapping area of ​​the valid block in the volume space of the target snapshot volume corresponding to the parent trunk cascade node; and

[0020] The node information of the parent trunk cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted target snapshot volume is stored in the volume space of the target snapshot volume corresponding to the parent trunk cascade node.

[0021] In some examples, optionally, the data storage method further includes:

[0022] (iv) in response to a snapshot rollback initiated based on any target snapshot volume, configuring the topology node of the snapshot metadata topology to further include:

[0023] A branch root node having a mapping relationship with a block-based granularity with the volume space of the regenerated data volume generated in response to the snapshot rollback, wherein:

[0024] The branch root node takes the corresponding trunk cascade node of the target snapshot volume based on which the snapshot rollback is based as a parent node;

[0025] The regenerated data of the regenerated data volume at the time of initial creation includes: snapshot data of all valid blocks of the target snapshot volume based on which the snapshot rollback is based; and

[0026] The node information of the branch root node when initially created indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume.

[0027] In some examples, optionally, the data storage method further includes:

[0028] (v) In response to a data snapshot of the regenerated data volume at any time, configuring the topology nodes of the snapshot metadata topology to further include:

[0029] A side branch cascade node is created at the end of the chain cascade starting from the side branch root node corresponding to the regenerated snapshot volume, and a mapping relationship with a block granularity exists between the side branch cascade node and the volume space of the corresponding regenerated snapshot volume;

[0030] The regenerated snapshot volume corresponding to the side branch cascade node at the end of the chain cascade is created, and the regenerated data of all valid blocks of the regenerated data volume when the data snapshot is executed is used as the snapshot data;

[0031] Furthermore, the node information of the side branch cascade node created at the end of the chain cascade at the time of initial creation indicates that the snapshot data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node;

[0032] (vi) In response to data update of any valid block in the regenerated data volume after the regenerated snapshot volume is generated:

[0033] The updated regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume, and the node information of the branch root node corresponding to the regenerated data volume is updated to indicate that the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume;

[0034] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is stored in the volume space of the regenerated data volume, then the obsolete data is transferred as snapshot data to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade;

[0035] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is not stored in the volume space of the regenerated data volume, then the snapshot data copied from the volume space where the obsolete data is located is stored in the mapping area of ​​the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade of the valid block;

[0036] Furthermore, the node information of the side branch cascade node is updated to indicate that the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0037] In some examples, optionally, each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topological node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to variably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; the bit corresponding to each valid block in the block reference bitmap of the branch root node is used to variably indicate whether the current data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; the bit corresponding to each valid block in the block reference bitmap of the branch cascade node is used to variably indicate whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the branch cascade node.

[0038] In some examples, optionally, the data storage method further includes:

[0039] (vii) in response to deletion of a snapshot of any regenerated snapshot volume generated for the regenerated data volume, deleting a side branch cascade node corresponding to the deleted regenerated snapshot volume in the snapshot metadata topology;

[0040] If the side branch cascade node corresponding to the deleted regenerated snapshot volume has a parent side branch cascade node, any valid block has snapshot data stored in the volume space of the deleted regenerated snapshot volume, and the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node does not store the snapshot data of the valid block, then:

[0041] Transferring the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; and

[0042] The node information of the parent regeneration cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted regeneration snapshot volume is stored in the volume space of the regeneration snapshot volume corresponding to the parent branch cascade node;

[0043] The regenerated data volume is configured such that it is allowed to be deleted only after all the regenerated snapshot volumes of the regenerated data volume are deleted.

[0044] In another embodiment of the present application, a snapshot-based data query method is provided, comprising:

[0045] (i) In response to a snapshot query initiated for any target snapshot volume of the target data volume, a node information search based on the snapshot metadata topology is initiated, wherein:

[0046] The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume.

[0047] The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, starting from the trunk cascade node corresponding to the queried target snapshot volume as the search start position, searching node by node toward the cascade end until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found, and if the trunk cascade node at the cascade end is reached and still no node information indicating that the valid block is stored in the corresponding volume space is found, then jumping back to the trunk root node;

[0048] (ii) Based on the search results of the node information search, determine the volume space where the snapshot data of all valid blocks of the target snapshot volume being queried is located, wherein:

[0049] The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data;

[0050] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume;

[0051] The node information of each trunk cascade node indicates whether the snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0052] (iii) by referencing the determined volume space at a block granularity by the queried target snapshot volume, snapshot data of all valid blocks of the target snapshot volume are obtained from mapping areas of all valid blocks in the determined volume space.

[0053] In some examples, optionally, the node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, wherein: each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to changeably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0054] In some examples, optionally, the topology node of the snapshot metadata topology further includes: a branch root node having a mapping relationship with a volume space of a regenerated data volume with a block granularity, the regenerated data volume is generated in response to a snapshot rollback based on any target snapshot volume, and the branch root node has a corresponding trunk cascade node of the target snapshot volume based on the snapshot rollback as a parent node; the data query method further includes:

[0055] (iv) in response to a data query on the regenerated data volume, initiating a node information search based on the snapshot metadata topology;

[0056] The node information search initiated for the regenerated data volume is configured to, for each valid block:

[0057] If the node information of the side branch root node indicates that the regenerated data of the valid block is stored in the volume space of the corresponding regenerated data volume, then the node information search for the valid block is stopped;

[0058] If the node information of the side branch root node indicates that the regenerated data of the valid block is not stored in the volume space of the corresponding regenerated data volume, a jump-level query is initiated:

[0059] Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node;

[0060] (v) based on the search results of the node information search, determining the volume space where the regenerated data of all valid blocks of the regenerated data volume being queried are located;

[0061] The regenerated data of the regenerated data volume at the initial stage is: the snapshot data of all valid blocks of the target snapshot volume based on which the regenerated data volume is generated;

[0062] The node information of the branch root node at the time of initial creation indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume;

[0063] (vi) By referencing the determined volume space with blocks as granularity through the queried regenerated data volume, the regenerated data of all valid blocks of the regenerated data volume are obtained from the mapping areas of all valid blocks in the determined volume space.

[0064] In some examples, optionally, the topology node of the snapshot metadata topology further includes a side branch cascade node having a mapping relationship with a volume space of the corresponding regenerated snapshot volume with a block granularity, and the side branch cascade nodes form a chain cascade starting from the side branch root node in the order of the generation time of the corresponding regenerated snapshot volume; the data query method further includes:

[0065] (vii) In response to a snapshot query initiated for any regenerated snapshot volume of the regenerated data volume, a node information search based on the snapshot metadata topology is initiated, wherein:

[0066] The search path for the node information search initiated for the queried regenerated snapshot volume is configured as follows, for each valid block:

[0067] Taking the side branch cascade node corresponding to the regenerated snapshot volume being queried as the search start position, searching node by node in the side branch cascade link where the side branch cascade node is located toward the end of the cascade until a side branch cascade node indicating that the valid block is stored in the corresponding volume space is found and stops;

[0068] If the side branch cascade node that reaches the end of the cascade still has not searched for the node information indicating that the valid block is stored in the corresponding volume space, then a jump-layer query is initiated:

[0069] Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node;

[0070] (viii) Based on the search results of the node information search, determine the volume space where the snapshot data of all valid blocks of the regenerated snapshot volume being queried is located, wherein:

[0071] The regenerated snapshot volume corresponding to each side branch cascade node uses the current data of all valid blocks of the regenerated data volume when being executed to generate a data snapshot of the regenerated snapshot volume as the snapshot data;

[0072] The node information of the side branch root node indicates whether the regenerated data of all valid blocks of the regenerated data volume are stored in the volume space of the regenerated data volume;

[0073] The node information of each side branch cascade node indicates whether the snapshot data of each valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node;

[0074] (ix) By referencing the determined volume space with blocks as granularity by the queried regenerated snapshot volume, snapshot data of all valid blocks of the regenerated snapshot volume are obtained from the mapping areas of all valid blocks in the determined volume space.

[0075] In some examples, optionally, each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topological node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to variably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; the bit corresponding to each valid block in the block reference bitmap of the branch root node is used to variably indicate whether the current data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; the bit corresponding to each valid block in the block reference bitmap of the branch cascade node is used to variably indicate whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the branch cascade node.

[0076] In another embodiment of the present application, a snapshot-based data storage device is provided, comprising:

[0077] The data snapshot module is used to configure the snapshot metadata topology of the target data volume in response to the data snapshot of the target data volume, so that the topological nodes of the snapshot metadata topology include:

[0078] The trunk root node that has a block-based mapping relationship with the volume space of the target data volume, and,

[0079] A trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot in a block-sized granularity, the trunk cascade node being created at the end of a chain cascade starting from the trunk root node in response to generation of a corresponding target snapshot volume;

[0080] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the node information of the trunk cascade node created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the target data volume are not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0081] A data update module is used to respond to data update of any valid block in the target data volume after the target snapshot volume is generated, if the node information of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then:

[0082] The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and

[0083] The node information of the trunk cascade node is updated to indicate that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0084] In some examples, optionally, the node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, wherein: each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to changeably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0085] In some examples, optionally, the data storage device further includes: a snapshot deletion module, which is used to delete the trunk cascade node corresponding to the deleted target snapshot volume in the snapshot metadata topology in response to the deletion of the snapshot of any target snapshot volume generated for the target data volume; wherein, if the trunk cascade node corresponding to the deleted target snapshot volume has a parent trunk cascade node, any valid block stores snapshot data in the volume space of the deleted target snapshot volume, and the volume space of the target snapshot volume corresponding to the parent trunk cascade node does not store the snapshot data of the valid block, then: the snapshot data of the valid block in the volume space of the deleted target snapshot volume is transferred to a mapping area of ​​the valid block in the volume space of the target snapshot volume corresponding to the parent trunk cascade node; and the node information of the parent trunk cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted target snapshot volume is stored in the volume space of the target snapshot volume corresponding to the parent trunk cascade node.

[0086] In some examples, optionally, the data storage device further includes: a rollback regeneration module, which is used to, in response to a snapshot rollback initiated based on any target snapshot volume, configure the topology node of the snapshot metadata topology to further include: a side root node that has a block-granularity mapping relationship with the volume space of the regenerated data volume generated in response to the snapshot rollback, wherein: the side root node has the corresponding trunk cascade node of the target snapshot volume on which the snapshot rollback is based as a parent node; the regenerated data of the regenerated data volume at the initial creation includes: the snapshot data of all valid blocks of the target snapshot volume on which the snapshot rollback is based; and the node information of the side root node at the initial creation indicates that: the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume.

[0087] In some examples, optionally, the data storage device further includes: a regeneration snapshot module, which is used to respond to a data snapshot of the regenerated data volume at any time, and configure the topology node of the snapshot metadata topology to further include: a side branch cascade node created at the end of the chain cascade starting from the side branch root node corresponding to the regenerated snapshot volume, and there is a mapping relationship with the side branch cascade node and the volume space of the corresponding regenerated snapshot volume at a block granularity; wherein the regenerated snapshot volume corresponding to the side branch cascade node created at the end of the chain cascade is used to regenerate all valid blocks of the data volume when the data snapshot is executed The regenerated data is snapshot data; and the node information of the side branch cascade node created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node; the regeneration update module is used to respond to the data update of any valid block in the regenerated data volume after the regenerated snapshot volume is generated: store the updated regenerated data of the valid block of the regenerated data volume into the volume space of the regenerated data volume, and update the node information of the side branch root node corresponding to the regenerated data volume to indicate that the valid block of the regenerated data volume The regenerated data is stored in the volume space of the regenerated data volume; if the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is stored in the volume space of the regenerated data volume, then, the obsolete data is transferred as snapshot data to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade; if the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block If the data is not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is not stored in the volume space of the regenerated data volume, then the snapshot data copied from the volume space where the obsolete data is located is stored in the mapping area of ​​the volume space of the regenerated snapshot volume corresponding to the side branch cascade node at the end of the side branch chain cascade for the valid block; and the node information of the side branch cascade node is updated to indicate that the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0088] In some examples, optionally, each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topological node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to variably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; the bit corresponding to each valid block in the block reference bitmap of the branch root node is used to variably indicate whether the current data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; the bit corresponding to each valid block in the block reference bitmap of the branch cascade node is used to variably indicate whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the branch cascade node.

[0089] In some examples, optionally, the data storage device further includes: a regeneration deletion module, which is used to delete the side branch cascade node corresponding to the deleted regenerated snapshot volume in the snapshot metadata topology in response to the snapshot deletion of any regenerated snapshot volume generated for the regenerated data volume; wherein, if the side branch cascade node corresponding to the deleted regenerated snapshot volume has a parent side branch cascade node, any valid block stores snapshot data in the volume space of the deleted regenerated snapshot volume, and the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node , then: the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume is transferred to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; and the node information of the parent side branch cascade node is updated to indicate that: the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume is stored in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; wherein the regenerated data volume is configured to be deleted only after all the regenerated snapshot volumes of the regenerated data volume are deleted.

[0090] In another embodiment of the present application, a snapshot-based data query device is provided, comprising:

[0091] The first information search module is configured to initiate a node information search based on a snapshot metadata topology in response to a snapshot query initiated for any target snapshot volume of the target data volume, wherein:

[0092] The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume.

[0093] The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, starting from the trunk cascade node corresponding to the queried target snapshot volume as the search start position, searching node by node toward the cascade end until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found, and if the trunk cascade node at the cascade end is reached and still no node information indicating that the valid block is stored in the corresponding volume space is found, then jumping back to the trunk root node;

[0094] The first space determination module is used to determine the volume space where the snapshot data of all valid blocks of the queried target snapshot volume are located based on the search result of the node information search, wherein:

[0095] The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data;

[0096] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume;

[0097] The node information of each trunk cascade node indicates whether the snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0098] The first space reference module is used to obtain snapshot data of all valid blocks of the target snapshot volume from the mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with blocks as granularity through the queried target snapshot volume.

[0099] In some examples, optionally, the node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, wherein: each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to changeably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0100] In some examples, optionally, the topology node of the snapshot metadata topology further includes: a branch root node having a block-based mapping relationship with the volume space of the regenerated data volume, the regenerated data volume is generated in response to a snapshot rollback based on any target snapshot volume, and the branch root node has a corresponding trunk cascade node of the target snapshot volume based on the snapshot rollback as a parent node; the data query device further includes: a second information search module for initiating a node information search based on the snapshot metadata topology in response to a data query for the regenerated data volume; The node information search initiated by the volume is configured as follows: for each valid block: if the node information of the side branch root node indicates that the regenerated data of the valid block is stored in the volume space of the corresponding regenerated data volume, then the node information search for the valid block is stopped; if the node information of the side branch root node indicates that the regenerated data of the valid block is not stored in the volume space of the corresponding regenerated data volume, then a jump query is initiated: wherein each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the lower cascade link is used as the link. The parent node of the side branch root node in the search is the search starting position to search towards the cascade end, and it is allowed to jump back to the root node (side branch root node or trunk root node) of the cascade link at this level when the node information indicating that the valid block is stored in the corresponding volume space is not found at the cascade end; and the end-layer link of the jump-layer query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node; the second space determination module is used to determine the regeneration data of all valid blocks of the queried regeneration data volume based on the search result of the node information search the volume space where the regenerated data volume is located; the regenerated data of the regenerated data volume at the initial stage is: the snapshot data of all valid blocks of the target snapshot volume on which the regenerated data volume is based; the node information of the branch root node at the initial stage of creation indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume; the second space reference module is used to obtain the regenerated data of all valid blocks of the regenerated data volume from the mapping areas of all valid blocks in the determined volume space through the reference of the queried regenerated data volume to the determined volume space with blocks as the granularity.

[0101] In some examples, optionally, the topological nodes of the snapshot metadata topology further include side branch cascade nodes that have a block-based mapping relationship with the volume space of the corresponding regenerated snapshot volume, and the side branch cascade nodes form a chain cascade starting from the side branch root node in the order of the generation time of the corresponding regenerated snapshot volume; the data query device further includes: a third information search module, which is used to initiate a node information search based on the snapshot metadata topology in response to a snapshot query initiated for any regenerated snapshot volume of the regenerated data volume, wherein: the search path for the node information search initiated for the queried regenerated snapshot volume is configured to, for each valid block: start from the node information of the queried regenerated snapshot volume. The side branch cascade node corresponding to the regenerated snapshot volume being queried is the search starting position, and the search is performed node by node in the side branch cascade link where the side branch cascade node is located toward the end of the cascade until the side branch cascade node indicating that the valid block is stored in the corresponding volume space is found and stopped; if the side branch cascade node at the end of the cascade is reached and the node information indicating that the valid block is stored in the corresponding volume space is still not found, then a jump-level query is initiated: wherein each jump-level in the jump-level query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump-level query, the parent node of the side branch root node in the cascade link of the lower layer is the search node. The method further comprises the following steps: searching from the starting position of the search to the end of the cascade, and allowing jumping back to the root node of the cascade link at this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end-layer link of the jump-layer query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node; a third space determination module is used to determine the volume space where the snapshot data of all valid blocks of the queried regenerated snapshot volume are located based on the search result of the node information search, wherein: the regenerated snapshot volume corresponding to each side branch cascade node is based on all valid blocks of the regenerated data volume when the execution for generating the regenerated snapshot volume is executed. The current data at the time of a data snapshot of the regenerated snapshot volume is the snapshot data; the node information of the side branch root node indicates whether the regenerated data of all valid blocks of the regenerated data volume are stored in the volume space of the regenerated data volume; the node information of each side branch cascade node indicates whether the snapshot data of each valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node; the third space reference module is used to obtain the snapshot data of all valid blocks of the regenerated snapshot volume from the mapping areas of all valid blocks in the determined volume space through the reference of the queried regenerated snapshot volume to the determined volume space with block as the granularity.

[0102] In some examples, optionally, each bit in the block allocation bitmap corresponds to a block in the target data volume, and the bit corresponding to each block in the block allocation bitmap of each topological node is used to indicate whether the block in the target data volume is a valid block; each bit in the block reference bitmap corresponds to a block in the target data volume, and: the bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to fixedly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to variably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; the bit corresponding to each valid block in the block reference bitmap of the branch root node is used to variably indicate whether the current data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; the bit corresponding to each valid block in the block reference bitmap of the branch cascade node is used to variably indicate whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the branch cascade node.

[0103] In another embodiment of the present application, an electronic device is provided, including a processor, wherein the processor is used to execute at least one of the data storage method and the data query method as described in the above embodiments.

[0104] In another embodiment of the present application, a data storage system is provided, including a server and a disk array, wherein the server is configured to execute at least one of the data storage method and the data query method described in the aforementioned embodiments, and the disk array is configured to provide volume space.

[0105] In another embodiment of the present application, a non-transitory computer-readable storage medium is provided, which stores instructions, and when the instructions are executed by a processor, the processor executes at least one of the data storage method and the data query method described in the aforementioned embodiments.

[0106] Based on the above embodiment, a snapshot metadata topology based on chain cascading can be provided, wherein different topological nodes in the snapshot metadata topology respectively represent the target data volume on which the snapshot is executed and the target snapshot volume generated in response to the snapshots at different times, each topological node and the corresponding volume space can have a mapping relationship with blocks as the granularity, and each topological node can record whether the data of each block is in the volume space corresponding to the topological node, so that:

[0107] Through cascading references between topological nodes, each target snapshot volume can reference the snapshot data of all blocks it contains at block granularity without recording address information in metadata. In addition, the volume space where the snapshot data of each snapshot is located can be represented by an independent topological node without involving the update operation of the recorded address information.

[0108] This can avoid the problem of high maintenance difficulty caused by updating address information, thereby helping to reduce the difficulty of maintaining metadata.

[0109] In addition, by deriving a side branch cascade link from a topological node corresponding to any snapshot volume, snapshot rollback based on the snapshot volume can be achieved without affecting any other snapshot volumes, thus supporting multiple snapshot rollbacks. BRIEF DESCRIPTION OF THE DRAWINGS

[0110] The following drawings are only used to illustrate and explain the present application, and do not limit the scope of the present application:

[0111] Figure 1 A schematic diagram of an example of mapping each topological node of the snapshot metadata topology in an embodiment of the present application with blocks as the granularity;

[0112] Figure 2 This is a schematic diagram of an exemplary process of a snapshot-based data storage method in an embodiment of the present application;

[0113] Figure 3 A schematic diagram of a first snapshot example implemented based on the data storage method in an embodiment of the present application;

[0114] Figure 4 A schematic diagram of a second snapshot example implemented based on the data storage method in an embodiment of the present application;

[0115] Figure 5 It is a schematic diagram of a third snapshot example implemented based on the data storage method in the embodiment of the present application;

[0116] Figure 6 This is a schematic diagram of an exemplary process of a snapshot-based data query method in an embodiment of the present application;

[0117] Figure 7 A schematic diagram of a first query example implemented based on the data query method in an embodiment of the present application;

[0118] Figure 8 A schematic diagram of a second query example implemented based on the data query method in an embodiment of the present application;

[0119] Fig. 9 A schematic diagram of a snapshot deletion example implemented based on the data storage method in an embodiment of the present application;

[0120] Fig.10 A schematic diagram of an extended process of a snapshot-based data storage method for supporting snapshot rollback in an embodiment of the present application;

[0121] Fig.11 A schematic diagram of a rollback regeneration example implemented based on the data storage method in an embodiment of the present application;

[0122] Fig.12 A schematic diagram of an extended process of a snapshot-based data storage method in an embodiment of the present application for supporting a snapshot after rollback;

[0123] Fig.13 It is a schematic diagram of a fourth snapshot example implemented based on the data storage method in the embodiment of the present application;

[0124] Fig.14 This is a schematic diagram of an extended process of adapting a snapshot rollback to a snapshot-based data query method in an embodiment of the present application;

[0125] Fig.15 It is a schematic diagram of a third query example implemented based on the data storage method in the embodiment of the present application;

[0126] Fig.16 This is a schematic diagram of an extended process of adapting a snapshot after rollback using a snapshot-based data query method in an embodiment of the present application;

[0127] Fig.17 It is a schematic diagram of a fourth query example implemented based on the data storage method in the embodiment of the present application;

[0128] Fig.18 This is a schematic diagram of an exemplary structure of a data storage device based on snapshots in an embodiment of the present application;

[0129] Fig.19 A schematic diagram of an extended structure of a snapshot-based data storage device in an embodiment of the present application for supporting snapshot rollback and snapshot after rollback;

[0130] Fig. 20 This is a schematic diagram of an exemplary structure of a data query device based on snapshots in an embodiment of the present application;

[0131] Fig.21 A schematic diagram of an extended structure of a snapshot-based data query device in an embodiment of the present application for adapting to snapshot rollback and snapshot after rollback;

[0132] Fig. 22 is a schematic diagram of an exemplary structure of an electronic device in an embodiment of the present application;

[0133] Fig.23 This is a schematic diagram of an exemplary structure of a data storage system in an embodiment of the present application. DETAILED DESCRIPTION

[0134] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and examples.

[0135] In order to avoid recording the storage address information of the data in the metadata, and thus avoid the problem of difficulty in metadata maintenance caused by the storage address information, in an embodiment of the present application, a snapshot metadata topology based on chain cascading is provided, wherein each topology node in the snapshot metadata topology can be cascaded step by step in a parent-child relationship between two nodes according to the time sequence of creation, and the snapshot metadata topology also uses different topology nodes to respectively represent the target data volume of the executed snapshot and the target snapshot volume generated in response to the snapshots at different times, and each topology node and the corresponding volume space can have a mapping relationship with block granularity.

[0136] Figure 1 This is a schematic diagram of an example of mapping each topological node of the snapshot metadata topology in the embodiment of the present application with block as the granularity. Figure 1 In an embodiment of the present application, each topological node may be configured with corresponding node information Info_Node, and the node information Info_Node of each topological node may specifically include the status information of each block of the target data volume, and the status information of each block corresponds to the mapping area Chunk_i corresponding to the block in the volume space corresponding to the topological node, where i is a positive integer greater than or equal to 1. Specifically, the block status information of each block in the node information Info_Node of each topological node may include a block allocation status and a block reference status.

[0137] The block allocation status of each topological node can be used to indicate whether each block is a valid block within the snapshot range. That is, the "valid" used in this article for valid blocks mainly refers to the blocks involved when the snapshot occurs, and is not intended to introduce other unnecessary limitations.

[0138] The block reference state of each topology node only involves valid blocks, and can be used to indicate whether snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the topology node.

[0139] Whether the snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the topological node can further represent:

[0140] If the snapshot data of any valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the topology node, then the mapping area Chunk_i of the valid block in the volume space corresponding to the topology node can be referenced by other topology nodes;

[0141] If the snapshot data of any valid block of the target data volume is not stored in the volume space of the target snapshot volume corresponding to the topology node, the topology node can reference the mapping area Chunk_j of the valid block in the volume space corresponding to other topology nodes, where j is a positive integer greater than or equal to 1 and different from i.

[0142] In order to better understand the node information Info_Node, Figure 1 In the example, the node information Info_Node of each topological node includes a block allocation bitmap BMP_alloc and a block reference bitmap BMP_quote.

[0143] Each bit in the block allocation bitmap BMP_alloc included in the node information Info_Node of each topological node can correspond to a block in the target data volume; and each bit in the block reference bitmap BMP_quote included in the node information Info_Node of each topological node can also correspond to a block in the target data volume.

[0144] The bit value corresponding to each block in the block allocation bitmap BMP_alloc in the node information Info_Node of each topological node can represent the block allocation status of the block. That is, the bit corresponding to each block in the block allocation bitmap BMP_alloc in the node information Info_Node of each topological node can:

[0145] When the bit value is the first value (e.g., 1), it indicates that the block in the target data volume is a valid block within the snapshot range;

[0146] When the bit value is the second bit value (for example, 0), it indicates that the block in the target data volume is a non-valid block outside the snapshot range.

[0147] The bit value corresponding to each valid block in the block reference bitmap BMP_quote included in the node information Info_Node of each topology node is valid, and the bit value corresponding to the invalid block can be ignored. Among them, the bit value corresponding to each valid block in the block reference bitmap BMP_quote included in the node information Info_Node of each topology node can indicate the reference status of the valid block. That is, the bit corresponding to each valid block in the block reference bitmap BMP_quote included in the node information Info_Node of each topology node can indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the topology node.

[0148] Furthermore, the bit corresponding to each valid block in the block reference bitmap BMP_quote included in the node information Info_Node of each topological node can be:

[0149] When the bit value is the first value (for example, 1), it means that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the topology node (for example, Figure 1 Chunk_2 represented by the shaded block in the figure, and further indicates that the mapping area Chunk_i of the valid block in the volume space corresponding to the topological node can be referenced by other topological nodes;

[0150] When the bit value is the second bit value (for example, 0), it indicates that the snapshot data of the valid block of the target data volume is not stored in the volume space of the target snapshot volume corresponding to the topology node (for example, Figure 1 In the example, Chunk_1 is represented by a blank block, and it can be further indicated that the topological node can reference the mapping area Chunk_j of the valid block in the volume space corresponding to other topological nodes.

[0151] Thus, based on the snapshot metadata topology having the above-mentioned node information in each topological node, each target snapshot volume can reference the snapshot data of all blocks it contains at a block granularity through cascade references between the topological nodes, without recording the address information in the metadata. Moreover, the volume space where the snapshot data of each snapshot is located can be represented by an independent topological node without involving the update operation of the recorded address information.

[0152] Furthermore, if the node information Info_Node of each topological node adopts a bitmap mode, that is, the node information Info_Node includes a block allocation bitmap BMP_alloc and a block reference bitmap BMP_quote, then, compared with the mode of recording address information in metadata, it can help reduce the data volume of metadata.

[0153] Figure 2 FIG. 1 is an exemplary flow chart of a snapshot-based data storage method in an embodiment of the present application. Figure 2 In an embodiment of the present application, the snapshot-based data storage method may include the following steps that are triggered and executed in response to each data snapshot of the target data volume:

[0154] S210: In response to the data snapshot of the target data volume, configure the snapshot metadata topology of the target data volume so that the topological nodes of the snapshot metadata topology include:

[0155] The trunk root node that has a block-based mapping relationship with the volume space of the target data volume, and,

[0156] A trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot in a block-sized granularity, the trunk cascade node being created at the end of a chain cascade starting from the trunk root node in response to generation of a corresponding target snapshot volume;

[0157] Among them, the node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the node information of the trunk cascade node created at the end of the chain cascade at the initial creation indicates that: the snapshot data of all valid blocks of the target data volume are not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0158] If the node information is in bitmap form, then:

[0159] The block allocation bitmap of the backbone cascade node is the same as the fast allocation bitmap of the backbone root node;

[0160] The bit corresponding to each valid block in the block reference bitmap of the trunk root node is used to solidly indicate that the current data of the valid block of the target data volume is stored in the volume space of the target data volume;

[0161] The bit corresponding to each valid block in the block reference bitmap of the trunk cascade node is used to variably indicate whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0162] That is, the node information (block reference bitmap) of the trunk cascade node created at the end of the chain cascade at the time of initial creation is changeable.

[0163] S230: In response to data update of any valid block in the target data volume after the target snapshot volume is generated, detect the node information of the trunk cascade node at the end of the cascade. If the node information of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then transfer the snapshot data of the valid block and update the node information of the corresponding topological node, that is:

[0164] The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and

[0165] The node information of the trunk cascade node is updated to indicate that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0166] In addition, in response to the data update of any valid block in the target data volume after the target snapshot volume is generated, if the node information of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block has been stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then it means that the current data update is a re-modification after the snapshot data is transferred, and therefore there is no need to perform the transfer of the snapshot data for the valid block.

[0167] In an embodiment of the present application, the data snapshot that triggers the above process can be the first snapshot after the target data volume is generated, or it can be another snapshot after the data of any valid block of the target data volume is updated; and after the above process is triggered each time, the delay duration of S230 compared to S210 is determined according to the time interval between the data update and the data snapshot.

[0168] In order to better understand the above process of the snapshot-based data storage method in the embodiment of the present application, several snapshot examples will be used for illustration below.

[0169] Figure 3 Schematic diagram of a first snapshot example implemented based on the data storage method in the embodiment of the present application. Figure 3 :

[0170] First, in response to the first data snapshot S1 after the target data volume F_root is created, a first target snapshot volume F_s1 may be generated. At this time, the snapshot metadata topology of the target data volume has topological nodes including:

[0171] The trunk root node N_root that has a block-based mapping relationship with the volume space of the target data volume F_root, and

[0172] There is a first trunk cascade node N_s1 that has a block-based mapping relationship with the volume space of the first target snapshot volume F_s1 generated by the data snapshot S1, and the first trunk cascade node N_s1 is created at the end of the chain cascade starting from the trunk root node F_root in response to the generation of the corresponding first target snapshot volume F_s1, and has a direct parent-child relationship with the trunk root node F_root.

[0173] Among them, in the node information of the backbone root node N_root:

[0174] The bit corresponding to each block in the block allocation bitmap Ba_root is used to indicate whether the block in the target data volume is a valid block. In the graphic expression, the three bits with the first bit value (e.g., 1) representing the three valid blocks occupied by the data "AAA" are taken as an example;

[0175] The bit corresponding to each valid block in the block reference bitmap Bq_root solidly indicates that the current data of the valid block of the target data volume F_root is stored in the volume space of the target data volume F_root, that is, the bit value corresponding to each valid block in the block reference bitmap Ba_root is the first value (for example, 1).

[0176] Thus, the node information of the trunk root node N_root may indicate that current data of all valid blocks of the target data volume F_root are stored in the volume space of the target data volume F_root.

[0177] Create a first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1 at the end of the chain cascade, using the current data (for example, "AAA") of all valid blocks of the target data volume F_root when the data snapshot is executed as snapshot data;

[0178] Furthermore, the first trunk cascade node N_s1 created at the end of the chain cascade has the following node information when it is initially created:

[0179] The block allocation bitmap Ba_s1 is the same as the block allocation bitmap Ba_root of the backbone root node N_root;

[0180] The current bit value of the bit of each valid block represented by the right block allocation bitmap Ba_s1 in the block reference bitmap Bq_s1 is the second bit value (for example, 0), which is used to indicate that the snapshot data of the valid block of the target data volume F_root (for example, the corresponding one in "AAA") is not stored in the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1.

[0181] Therefore, the node information of the first trunk cascade node N_s1 created at the end of the chain cascade at the initial creation can indicate that the snapshot data of all valid blocks of the target data volume F_root are not stored in the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1.

[0182] At this time, the snapshot data of all valid blocks of the first target snapshot volume F_s1 can be obtained by referencing the mapping area of ​​the valid blocks in the volume space of the target data volume F_root.

[0183] Then, in response to data update of any valid block of F_root in the target data volume (e.g., the one in the middle of "AAA") after the first target snapshot volume F_s1 is created, since the node information of the first trunk cascade node N_s1 at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1, therefore:

[0184] The obsolete data (e.g., "A" in the middle of "AAA") of the valid block in the volume space of the target data volume F_root that is replaced by data update (e.g., replaced by "B") is transferred as snapshot data to the mapping area of ​​the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1 at the end of the chain cascade; and

[0185] The node information of the first trunk cascade node N_s1 is updated to indicate that the snapshot data of the valid block of the target data volume F_root is stored in the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1. For example, the bit value of the bit corresponding to the valid block in the block reference bitmap Bq_s1 of the first trunk cascade node N_s1 is changed to the first bit value (for example, 1), and the bit values ​​of the bits corresponding to the remaining valid blocks that have not been updated by the data still maintain the second bit value (for example, 0).

[0186] Therefore, even if the target data volume F_root undergoes data update after the first target snapshot volume F_s1 is created, for the first target snapshot volume F_s1, the snapshot data of the valid blocks stored in the current volume can be obtained from the mapping area within the volume space of the current volume, and the snapshot data of other valid blocks not stored in the current volume can be obtained by referencing the mapping area of ​​other valid blocks in the volume space of the target data volume F_root based on the chain cascade between the topological nodes in the snapshot metadata topology.

[0187] Thereafter, if "B" located in the middle position of "ABA" after the volume space of the target data volume F_root is updated and replaced and eliminated due to another update, then, since the node information of the first trunk cascade node N_s1 at the end of the cascade indicates that the snapshot data "A" of the valid block in the middle position has been stored in the volume space of the first target snapshot volume F_s1 corresponding to the first trunk cascade node N_s1, there is no need to transfer the eliminated data "B" that does not belong to the snapshot data for the valid block in the middle position.

[0188] Figure 4 Schematic diagram of a second snapshot example implemented based on the data storage method in the embodiment of the present application. Figure 4 , the second snapshot instance describes the process after the first snapshot instance, specifically:

[0189] In response to a second snapshot S2 after data update occurs to any valid block of the target data volume F_root, a second target snapshot volume F_s2 may be generated. At this time, the topological nodes of the snapshot metadata topology of the target data volume may further include, based on the first snapshot instance:

[0190] A second trunk cascade node N_s2 has a block-based mapping relationship with the volume space of the second target snapshot volume F_s2 generated by the data snapshot S2, and the second trunk cascade node N_s2 is created at the end of the chain cascade starting from the trunk root node F_root in response to the generation of the corresponding second target snapshot volume F_s2, and has a direct parent-child relationship with the first target snapshot volume F_s1.

[0191] Create a second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2 at the end of the chain cascade, using the current data (for example, "ABA") of all valid blocks of the target data volume F_root when the data snapshot is executed as snapshot data;

[0192] Furthermore, the second trunk cascade node N_s2 created at the end of the chain cascade has the following node information when it is initially created:

[0193] The block allocation bitmap Ba_s2 is the same as the block allocation bitmap Ba_root of the backbone root node N_root;

[0194] The current bit values ​​of the bits in the block reference bitmap Bq_s2 corresponding to each valid block represented by the block allocation bitmap Ba_s2 are all the second bit values ​​(for example, 0), which are used to indicate that the snapshot data of the valid block of the target data volume F_root (for example, the corresponding one in "ABA") is not stored in the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2.

[0195] Therefore, the node information of the second trunk cascade node N_s2 created at the end of the chain cascade at the initial creation can indicate that the snapshot data of all valid blocks of the target data volume F_root are not stored in the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2.

[0196] At this time, the snapshot data of all valid blocks of the second target snapshot volume F_s2 can be obtained by referencing the mapping area of ​​the valid blocks in the volume space of the target data volume F_root.

[0197] Then, in response to data update of any valid block of F_root in the target data volume (for example, the one located at the rightmost position in "AAA") after the second target snapshot volume F_s2 is created, since the node information of the second trunk cascade node N_s2 at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2, therefore:

[0198] The obsolete data (e.g., "A" at the rightmost position in "ABA") of the valid block in the volume space of the target data volume F_root that is replaced by data update (e.g., replaced by "C") is transferred as snapshot data to the mapping area of ​​the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2 at the end of the chain cascade of the valid block; and

[0199] The node information of the second trunk cascade node N_s2 is updated to indicate that the snapshot data of the valid block of the target data volume F_root is stored in the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2. For example, the bit value of the bit corresponding to the valid block in the block reference bitmap Bq_s1 of the second trunk cascade node N_s2 is changed to the first bit value (for example, 1), and the bit values ​​of the bits corresponding to the remaining valid blocks that have not been updated by the data still maintain the second bit value (for example, 0).

[0200] Therefore, even if the target data volume F_root undergoes data update after the second target snapshot volume F_s2 is created, for the second target snapshot volume F_s2, the snapshot data of the valid blocks stored in the current volume can be obtained from the mapping area of ​​the data blocks in the volume space of the current volume, and the snapshot data of other valid blocks not stored in the current volume can be obtained by referencing the mapping areas of other valid blocks in the volume space of the target data volume F_root based on the chain cascade between the topological nodes in the snapshot metadata topology.

[0201] Thereafter, if "C" at the rightmost position in "ABC" after the updated volume space of the target data volume F_root is replaced and eliminated due to another update, then, since the node information of the second trunk cascade node N_s2 at the end of the cascade indicates that the snapshot data "A" of the valid block at the rightmost position has been stored in the volume space of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2, there is no need to transfer the eliminated data "C" that does not belong to the snapshot data for the valid block at the rightmost position.

[0202] Figure 5 FIG. 1 is a schematic diagram of a third snapshot example implemented based on the data storage method in the embodiment of the present application. Figure 5 , the third snapshot instance describes the process after the second snapshot instance, specifically:

[0203] In response to a second snapshot S3 after two data updates to any valid block of the target data volume F_root, a third target snapshot volume F_s3 may be generated. At this time, similar to the second target snapshot F_s2, the topological nodes of the snapshot metadata topology of the target data volume may further include, based on the second snapshot instance:

[0204] A third trunk cascade node N_s3 having a block-based mapping relationship with the volume space of the third target snapshot volume F_s3 generated by the data snapshot S3, and in response to the generation of the corresponding third target snapshot volume F_s3, the third trunk cascade node N_s3 is correspondingly created at the end of the chain cascade starting from the trunk root node F_root and has a direct parent-child relationship with the second target snapshot volume F_s2.

[0205] Create a third target snapshot volume F_s3 corresponding to the third trunk cascade node N_s3 at the end of the chain cascade, using the current data (for example, "ABC") of all valid blocks of the target data volume F_root when the data snapshot is executed as snapshot data;

[0206] Furthermore, the third trunk cascade node N_s3 created at the end of the chain cascade has the following node information when it is initially created:

[0207] The block allocation bitmap Ba_s3 is the same as the block allocation bitmap Ba_root of the trunk root node N_root;

[0208] The current bit values ​​of the bits in the block reference bitmap Bq_s3 corresponding to each valid block represented by the block allocation bitmap Ba_s3 are all the second bit values ​​(for example, 0), which are used to indicate that the snapshot data of the valid block of the target data volume F_root (for example, the corresponding one in "ABC") is not stored in the volume space of the third target snapshot volume F_s3 corresponding to the third trunk cascade node N_s3.

[0209] Therefore, the node information of the third trunk cascade node N_s3 created at the end of the chain cascade at the initial creation can indicate that the snapshot data of all valid blocks of the target data volume F_root are not stored in the volume space of the third target snapshot volume F_s2 corresponding to the third trunk cascade node N_s3.

[0210] Thereafter, if data update of any valid block occurs again in the target data volume F_root, the same principle as that of the first target snapshot volume F_s1 and the second target snapshot volume F_s2 can be referred to, and the obsolete data of the valid block replaced by the data update can be transferred, and the node information of the third trunk topology node Bq_s3 (i.e., the block reference bitmap Bq_s3) can be updated.

[0211] Furthermore, regardless of whether the target data volume F_root is updated after the third target snapshot volume F_s3 is created, the snapshot data of all valid blocks of the third target snapshot volume F_s3 can be obtained by referring to the same principle as the first target snapshot volume F_s1 and the second target snapshot volume F_s2.

[0212] In order to facilitate the acquisition of snapshot data of any target data volume, a snapshot-based data query method is also provided in an embodiment of the present application.

[0213] Figure 6 This is an exemplary flow chart of a snapshot-based data query method in an embodiment of the present application. Figure 6 In an embodiment of the present application, the snapshot-based data query method may include the following steps executed in response to each snapshot query of any target snapshot volume:

[0214] S610: In response to a snapshot query initiated for any target snapshot volume of the target data volume, a node information search based on a snapshot metadata topology is initiated, wherein:

[0215] The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume.

[0216] The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, the search is performed node by node from the trunk cascade node corresponding to the queried target snapshot volume as the search start position toward the cascade end, until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found and stopped; if the trunk cascade node reaching the cascade end still does not find the node information indicating that the valid block is stored in the corresponding volume space, then the search is jumped back to the trunk root node.

[0217] S630: Based on the search result of the node information search, determine the volume space where the snapshot data of all valid blocks of the queried target snapshot volume are located, wherein:

[0218] The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data;

[0219] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume;

[0220] The node information of each trunk cascade node indicates whether the snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0221] S650: Acquire snapshot data of all valid blocks of the target snapshot volume from respective mapping areas of all valid blocks in the determined volume space by referring to the determined volume space by the queried target snapshot volume at a block granularity.

[0222] In the embodiment of the present application, the snapshot query that triggers the above process may be initiated at any time after at least one target snapshot volume is created.

[0223] In order to better understand the above process of the snapshot-based data query method in the embodiment of the present application, several query examples will be used for illustration below.

[0224] Figure 7 Schematic diagram of the first query example implemented based on the data query method in the embodiment of the present application. Figure 7 , the first query instance occurs when Figure 3 After the first snapshot instance shown, and:

[0225] In response to a snapshot query I1 initiated for the first target snapshot volume F_s1 of the target data volume F_root, a node information search based on the snapshot metadata topology is initiated, wherein the search path configured according to the node information search initiated for the queried target snapshot volume is:

[0226] For the first valid block on the left, a node-by-node search is performed toward the end of the cascade with the first trunk cascade node N_s1 corresponding to the first target snapshot volume F_s1 being queried as the search start position. Since the first trunk cascade node N_s1 is located at the end of the cascade, and the node information of the first trunk cascade node N_s1 (for example, the first leftmost bit of the block reference bitmap Bq_s1) indicates that the snapshot data of the valid block is not stored in the space of the first target snapshot volume F_s1, the process jumps back to the trunk root node N_root, and node information indicating that the snapshot data of the first valid block on the left is stored in the corresponding space can be searched at the trunk root node N_root (for example, the first leftmost bit of the block reference bitmap Bq_root), so that the search for the first valid block on the left is stopped at this time, and a cross-volume reference is formed to the mapping area of ​​the first valid block on the left in the volume space of the target data volume F_root;

[0227] For the second valid block in the middle, the search is performed node by node toward the end of the cascade, starting from the first trunk cascade node N_s1 corresponding to the first target snapshot volume F_s1 being queried. Since the first trunk cascade node N_s1 is located at the end of the cascade, and the node information of the first trunk cascade node N_s1 (for example, the second bit in the middle of the block reference bitmap Bq_s1) indicates that the snapshot data of the valid block is stored in the space of the first target snapshot volume F_s1, the search for the second valid block in the middle is stopped at this time, and a local volume reference is formed to the mapping area of ​​the second valid block in the volume space of the first target snapshot volume F_s1;

[0228] For the third valid block on the far right, the search process is the same as that for the first valid block on the far left.

[0229] Based on the above node information search process, for the initiated snapshot query I1, snapshot data (eg "AAA") of all valid blocks of the first target snapshot volume F_s1 can be obtained from the mapping areas of all valid blocks in the determined volume space.

[0230] Figure 8 Schematic diagram of a second query example implemented based on the data query method in the embodiment of the present application. Figure 8 , the second query instance occurs when Figure 4 After the second snapshot instance shown, and:

[0231] In response to the snapshot query I2 initiated for the first target snapshot volume F_s1 of the target data volume F_root, a node information search based on the snapshot metadata topology is initiated, wherein the search path configured according to the node information search initiated for the queried target snapshot volume is:

[0232] For the first valid block on the left, the first trunk cascade node N_s1 corresponding to the first target snapshot volume F_s1 being queried is used as the search start position to search node by node towards the end of the cascade. Since the node information of the first trunk cascade node N_s1 (for example, the first bit on the left of the block reference bitmap Bq_s1) indicates that the snapshot data of the valid block is not stored in the space of the first target snapshot volume F_s1, the query is continued to the second trunk cascade node N_s2 located at the end of the cascade; and the node information of the second trunk cascade node N_s2 (for example, the first bit on the left of the block reference bitmap Bq_s2) indicates that the snapshot data of the valid block is not stored in the space of the first target snapshot volume F_s1. The first leftmost bit of the block reference bitmap Bq_root also indicates that the snapshot data of the valid block is not stored in the volume space of the second target snapshot volume F_s2. Therefore, the process jumps back to the trunk root node N_root. Finally, the trunk root node N_root can be searched for node information indicating that the snapshot data of the first leftmost valid block is stored in the corresponding space (for example, the first leftmost bit of the block reference bitmap Bq_root). Thus, the search for the first leftmost valid block is stopped at this time, and a cross-volume reference is formed to the mapping area of ​​the first leftmost valid block in the volume space of the target data volume F_root.

[0233] For the second valid block in the middle, the query process is the same as that of the first query instance, and will not be repeated here.

[0234] For the third valid block on the far right, the search is performed node by node toward the end of the cascade, starting from the first trunk cascade node N_s1 corresponding to the first target snapshot volume F_s1 being queried. Since the node information of the first trunk cascade node N_s1 (for example, the third bit from the far right of the block reference bitmap Bq_s1) indicates that the snapshot data of the valid block is not stored in the space of the first target snapshot volume F_s1, the search is continued to the second trunk cascade node N_s2 located at the end of the cascade. Finally, the node information of the second trunk cascade node N_s2 (for example, the third bit from the far right of the block reference bitmap Bq_s2) indicates that the snapshot data of the valid block is stored in the volume space of the second target snapshot volume F_s2, so the search for the third valid block on the far right is stopped at this time, and a cross-volume reference is formed for the third valid block on the far right in the volume space of the second target snapshot volume F_s2.

[0235] Based on the above node information search process, for the initiated snapshot query I2, snapshot data (eg, "AAA") of all valid blocks of the first target snapshot volume F_s1 can be obtained from the mapping areas of all valid blocks in the determined volume space.

[0236] In the embodiment of the present application, any created target snapshot volume can be deleted, and accordingly, its corresponding trunk cascade node will also be deleted.

[0237] Specifically, the data storage method in the embodiment of the present application may further include:

[0238] In response to deletion of a snapshot of any target snapshot volume generated for the target data volume, deleting a trunk cascade node corresponding to the deleted target snapshot volume in the snapshot metadata topology;

[0239] If any valid block stores snapshot data in the volume space of the deleted target snapshot volume (for example, there is a bit with the first value in the block reference bitmap of the trunk cascade node corresponding to the target snapshot volume), the trunk cascade node corresponding to the deleted target snapshot volume has a parent trunk cascade node, and the volume space of the target snapshot volume corresponding to the parent trunk cascade node does not store snapshot data of the valid block (for example, there is a bit with the first value in the block reference bitmap of the trunk cascade node corresponding to the target snapshot volume, and the corresponding bit in the block reference bitmap of the parent trunk cascade node is the second value), then:

[0240] Transferring the snapshot data of the valid block in the volume space of the deleted target snapshot volume to the mapping area of ​​the valid block in the volume space of the target snapshot volume corresponding to the parent trunk cascade node; and

[0241] The node information of the parent trunk cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted target snapshot volume is stored in the volume space of the target snapshot volume corresponding to the parent trunk cascade node.

[0242] In addition, no matter which target snapshot volume and its corresponding trunk cascade node are deleted, if the trunk cascade node corresponding to the deleted target snapshot volume is not at the end of the cascade, the adjacent topological nodes on both the upstream and downstream sides of the deleted trunk cascade node are automatically connected.

[0243] Fig. 9 This is a schematic diagram of a snapshot deletion example implemented based on the data storage method in the embodiment of the present application. Fig. 9 , the snapshot deletion instance occurs in Figure 5 After the third snapshot instance shown, specifically, in Fig. 9 In the snapshot deletion example shown:

[0244] First, in response to deletion of a snapshot of the second target snapshot volume F_s2 generated for the target data volume F_root, the second trunk cascade node N_s2 corresponding to the deleted second target snapshot volume F_s2 in the snapshot metadata topology is deleted;

[0245] Among them, since the second trunk cascade node N_s2 corresponding to the deleted second target snapshot volume F_s2 has a parent trunk cascade node (i.e., the first trunk cascade node N_s1), at least one valid block (the third valid block on the rightmost side) stores snapshot data in the volume space of the deleted second target snapshot volume F_s2 (for example, the third valid block on the rightmost side of the block reference bitmap Bq_s2 is in Figure 5 In the third snapshot example shown in FIG. 1 , the first bit value is “1”), and the volume space of the first target snapshot volume F_s1 corresponding to the parent trunk cascade node (i.e., the first trunk cascade node N_s1) does not store the snapshot data of the valid block (for example, the third bit on the right of the block reference bitmap Bq_s1 is Figure 5 In the third snapshot example shown, the second bit value is "0"), therefore, it is also necessary to:

[0246] The snapshot data of the valid block stored for the target data volume in the volume space of the deleted second target snapshot volume F_s2 (for example, the third valid block on the far right) is transferred to the mapping area in the volume space of the first target data volume F_s1 corresponding to the parent trunk cascade node (that is, the first trunk cascade node N_s1); and

[0247] The node information of the parent trunk cascade node (i.e., the first trunk cascade node N_s1) is updated to indicate that the snapshot data of the valid block in the volume space of the deleted second target snapshot volume F_s2 is stored in the volume space of the first target snapshot volume F_s1 corresponding to the parent trunk cascade node (i.e., the first trunk cascade node N_s1) (for example, the third bit from the rightmost side of the block reference bitmap Bq_s1 is updated to the first bit value "1").

[0248] In addition, after the second trunk cascade node N_s2 is deleted, the adjacent topological nodes located on both the upstream and downstream sides thereof (the first trunk cascade node N_s1 and the third trunk cascade node N_s3) can be automatically connected to a direct parent-child relationship.

[0249] It is understandable that:

[0250] If the first target snapshot volume F_s1 and its corresponding first trunk cascade node N_s1 are deleted, then, since the parent node of the first trunk cascade node N_s1 corresponding to the deleted first target snapshot volume F_s1 is the trunk root node N_root, and the volume space of the target data volume F_root corresponding to the trunk root node N_root stores data of all valid blocks, the snapshot data of the valid blocks stored for the target data volume in the volume space of the first target snapshot volume F_s1 (for example, the second valid block in the middle position) does not need to be transferred. In addition, after the first trunk cascade node N_s1 is deleted, the adjacent topological nodes (trunk root node N_root and second trunk cascade node N_s32) located on both the upstream and downstream sides thereof can be automatically connected to a direct parent-child relationship;

[0251] If the third target snapshot volume F_s3 and its corresponding third trunk cascade node N_s3 are deleted, although the third trunk cascade node N_s3 corresponding to the deleted third target snapshot volume F_s2 has a parent trunk cascade node (i.e., the second trunk cascade node N_s2), the volume space of the deleted third target snapshot volume F_s3 does not store any snapshot data of valid blocks, so there is no need to transfer the snapshot data. In addition, since the third trunk cascade node N_s3 is located at the end of the cascade, there is no need to perform additional topology node connection processing.

[0252] No matter which trunk cascade node in the snapshot metadata topology is deleted due to the deletion of the corresponding target snapshot volume, each topology node in the snapshot metadata topology can still maintain the parent-child cascade relationship between each other. Therefore, after any target snapshot volume and its corresponding trunk cascade node are deleted, it is still possible to ensure snapshot data query for any remaining target snapshot volume by executing the snapshot-based data query method in the embodiment of the present application.

[0253] In addition, in the embodiment of the present application, each target snapshot volume corresponding to each independent trunk cascade node can be used as a basis for snapshot rollback for data recovery, and no target snapshot volume will be lost due to snapshot rollback.

[0254] Fig.10 This is a schematic diagram of an extended process of a snapshot-based data storage method in an embodiment of the present application for supporting snapshot rollback. Fig.10 In the embodiment of the present application, by performing at least one Figure 2 After the target snapshot data volume is created according to the process shown, the snapshot-based data storage method may further include:

[0255] S1050: In response to a snapshot rollback initiated based on any target snapshot volume, configuring the topology node of the snapshot metadata topology to further include:

[0256] A branch root node having a mapping relationship with a block-based granularity with the volume space of the regenerated data volume generated in response to the snapshot rollback, wherein:

[0257] The branch root node takes the corresponding trunk cascade node of the target snapshot volume based on which the snapshot rollback is based as a parent node;

[0258] The regenerated data of the regenerated data volume at the time of initial creation includes: snapshot data of all valid blocks of the target snapshot volume based on which the snapshot rollback is based; and

[0259] The node information of the branch root node when initially created indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume.

[0260] Fig.11 This is a schematic diagram of a rollback regeneration example implemented based on the data storage method in the embodiment of the present application. Fig.11 , the rollback regeneration instance occurs when Figure 5 After the third snapshot instance shown, and in this rollback regeneration instance:

[0261] If the snapshot rollback is initiated based on the first target snapshot volume F_s1, a first regenerated data volume F_br1 may be generated accordingly, and the regenerated data of the first regenerated data volume F_br1 at the time of initial creation may include: snapshot data of all valid blocks of the first target snapshot volume F_s1 based on which the snapshot rollback is based. Accordingly, in response to the snapshot rollback initiated based on the first target snapshot volume F_s1, the data storage method in the embodiment of the present application may further configure the topological node of the snapshot metadata topology to further include:

[0262] A first side branch root node N_br1 has a mapping relationship with a block granularity with the volume space of the first regenerated data volume F_br1 generated in response to the snapshot rollback, wherein:

[0263] The first side branch root node N_br1 takes the first trunk cascade node N_s1 corresponding to the first target snapshot volume F_s1 based on which the snapshot rollback is based as a parent node;

[0264] The node information of the first branch root node N_br1 when it is initially created (for example, the block reference bitmap Bq_br1) indicates that the regenerated data of all valid blocks of the first regenerated data volume F_br1 are not stored in the volume space of the first regenerated data volume F_br1 (for example, in the block reference bitmap Bq_br1, all bits indicated as valid blocks in the block allocation bitmap Ba_br1 are the second position "0").

[0265] Similarly, if a snapshot rollback is initiated based on the second target snapshot volume F_s2, a second regenerated data volume F_br2 may be generated accordingly, and the regenerated data of the second regenerated data volume F_br2 at the time of initial creation may include: snapshot data of all valid blocks of the second target snapshot volume F_s2 based on which the snapshot rollback is based. Accordingly, in response to the snapshot rollback initiated based on the second target snapshot volume F_s2, the data storage method in the embodiment of the present application may further configure the topological node of the snapshot metadata topology to further include:

[0266] A second branch root node N_br2 has a mapping relationship with a volume space of a second regenerated data volume F_br2 generated in response to the snapshot rollback, with the granularity of blocks, wherein:

[0267] The second branch root node N_br2 takes the second trunk cascade node N_s2 corresponding to the second target snapshot volume F_s2 based on which the snapshot rollback is based as a parent node;

[0268] The node information of the second branch root node N_br2 when initially created (ie, Bq_br2) indicates that the regenerated data of all valid blocks of the second regenerated data volume F_br2 are not stored in the volume space of the second regenerated data volume F_br2.

[0269] As can be seen above, in the embodiment of the present application, by deriving a side cascade link from a topological node corresponding to any snapshot volume, a snapshot rollback based on the snapshot volume can be achieved without affecting any other snapshot volumes. Therefore, multiple snapshot rollbacks of a number not less than the number of topological nodes corresponding to the target snapshot volume can be supported.

[0270] Since the generation of the regenerated data volume introduces the side branch cascade link into the snapshot metadata topology, and the topological node corresponding to the regenerated data volume in the snapshot metadata topology is a side branch root node with the trunk cascade node as the parent node, the data query for the regenerated data volume is slightly different from the query for the target snapshot volume involving only the trunk cascade link. Accordingly, the snapshot-based data query method in the embodiment of the present application may further include a corresponding query step for the regenerated data volume.

[0271] It is understandable that the regenerated data volume generated in response to the snapshot rollback is used to implement data recovery based on the snapshot, and the regenerated data volume is also allowed to be modified. Therefore, there is also a need for snapshots for the regenerated data volume that may involve modification. Although the data snapshot of the regenerated data volume and the data snapshot of the target data volume are based on the same snapshot mechanism, in the embodiment of the present application, the metadata maintenance method of the snapshot volume generated by the data snapshot of the regenerated data volume is different from the metadata maintenance method of the target snapshot volume generated by the data snapshot of the target data volume. Therefore, in order to distinguish between the two, in the embodiment of the present application, the snapshot volume generated by the data snapshot of the regenerated data volume is called the regenerated snapshot volume.

[0272] Fig.12 FIG. 1 is a schematic diagram of an extended process of a snapshot-based data storage method in an embodiment of the present application for supporting a snapshot after rollback. Fig.12 In an embodiment of the present application, the snapshot-based data storage method may further include the following steps that are triggered and executed in response to each data snapshot of the regenerated data volume after the regenerated data volume is generated:

[0273] S1210: In response to a data snapshot of the regenerated data volume at any time, configuring the topology node of the snapshot metadata topology to further include:

[0274] A side branch cascade node is created at the end of the chain cascade starting from the side branch root node corresponding to the regenerated snapshot volume, and a mapping relationship with a block granularity exists between the side branch cascade node and the volume space of the corresponding regenerated snapshot volume;

[0275] The regenerated snapshot volume corresponding to the side branch cascade node at the end of the chain cascade is created, and the regenerated data of all valid blocks of the regenerated data volume when the data snapshot is executed is used as the snapshot data;

[0276] Furthermore, the node information of the side branch cascade node created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0277] S1230: In response to data update of any valid block in the regenerated data volume after the regenerated snapshot volume is generated, the updated regenerated data of the valid block is stored in the volume space of the regenerated data volume, the snapshot data of the valid block is stored in the volume space of the regenerated snapshot volume, and the node information of the corresponding topological node is updated, that is:

[0278] The updated regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume, and the node information of the branch root node corresponding to the regenerated data volume is updated to indicate that the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume;

[0279] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is stored in the volume space of the regenerated data volume, then the obsolete data is transferred as snapshot data to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade;

[0280] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is not stored in the volume space of the regenerated data volume, then the snapshot data copied from the volume space where the obsolete data is located is stored in the mapping area of ​​the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade of the valid block;

[0281] Furthermore, the node information of the side branch cascade node is updated to indicate that the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0282] Based on the above process, it can be seen that for the case where the node information contains the block allocation bitmap and the block reference bitmap:

[0283] The block allocation bitmaps of the side branch root node and the side branch cascade node may be the same as the block allocation bitmap of the main root node corresponding to the target data volume;

[0284] The bit corresponding to each valid block in the block reference bitmap of the side branch root node can be used to variably indicate: whether the current data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume;

[0285] The bit corresponding to each valid block in the block reference bitmap of the side branch cascade node can be used to variably indicate whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0286] Fig.13 FIG. 4 is a schematic diagram of a fourth snapshot example implemented based on the data storage method in the embodiment of the present application. Fig.13 , the fourth snapshot instance may occur as follows Fig.11 After the snapshot rollback instance shown, and in this fourth snapshot instance:

[0287] In response to the data snapshot of the second regenerated data volume F_br2, the topology nodes of the snapshot metadata topology are configured to further include: a side branch cascade node N_bs21 created at the end of the chain cascade starting from the second side branch root node N_br2 corresponding to the regenerated snapshot volume F_bs21, and a mapping relationship exists between the side branch cascade node N_bs21 and the volume space of the corresponding regenerated snapshot volume F_bs21 with the block as the granularity;

[0288] The regenerated snapshot volume F_bs21 corresponding to the side branch cascade node N_bs21 at the end of the chain cascade is created, and the regenerated data of all valid blocks of the second regenerated data volume F_br2 when the data snapshot is executed is used as the snapshot data;

[0289] Furthermore, the node information of the side branch cascade node N_bs21 created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the second regenerated data volume F_br2 are not stored in the volume space of the regenerated snapshot volume F_bs21 corresponding to the side branch cascade node N_bs21 (for example, in the block reference bitmap Bq_bs21, all bits indicated as valid blocks in the block allocation bitmap Ba_bs21 are the second bit value "0").

[0290] Then, in response to data update of any valid block (for example, the third valid block from the rightmost side) in the second regenerated data volume F_br2 after the regenerated snapshot volume F_bs21 is generated:

[0291] The updated regenerated data of the valid block of the regenerated data volume (i.e., "D" of the third valid block on the rightmost side) is stored in the volume space of the regenerated data volume, and the node information of the branch root node corresponding to the regenerated data volume is updated to indicate that the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume;

[0292] In the fourth snapshot example, since the node information of the side branch cascade node N_bs21 at the end of the cascade indicates that the obsolete data (e.g., "A" of the third valid block on the far right) of the valid block of the second regenerated data volume F_br2 that is replaced due to data update is not stored in the volume space of the regenerated data volume F_br2, the obsolete data is removed from the volume space where the obsolete data is located (e.g., according to the example Fig.13 The snapshot data obtained by copying is determined in the manner of the third query example shown in the figure, and is stored in a mapping area in the volume space of the regenerated snapshot volume F_bs21 corresponding to the side branch cascade node N_bs21 at the end of the side branch chain cascade of the valid block;

[0293] Furthermore, the node information of the side branch cascade node N_bs21 is updated to indicate that the snapshot data of the valid block of the second regenerated data volume F_br2 is stored in the volume space of the regenerated snapshot volume F_bs21 corresponding to the side branch cascade node N_bs21 (for example, the first value of the third rightmost bit of the block reference bitmap Bq_bs21 is changed to "1").

[0294] Thereafter, if "D" at the rightmost position in "ABD" of the updated volume space of the regenerated data volume F_br2 is replaced and eliminated due to another update, then, since the node information of the side cascade node N_bs21 at the end of the cascade indicates that the snapshot data "A" of the valid block at the rightmost position has been stored in the volume space of the regenerated snapshot volume F_bs21 corresponding to the side cascade node N_bs21, there is no need to perform snapshot data replication for the valid block at the rightmost position.

[0295] After the second regenerated data volume F_br2 is updated, the regenerated snapshot volume of the second regenerated data volume F_br2 can be created by referring to the creation method of the target snapshot volume, and the last-level side branch cascade node as the child node of the side branch cascade node N_bs21 can be added accordingly. Thereafter, if the second regenerated data volume F_br2 is updated again, for example, the third valid block on the far right is updated again, then, since the obsolete data (for example, "D" of the third valid block on the far right) that is replaced by the valid block of the second regenerated data volume F_br2 due to the data update is stored in the volume space of the second regenerated data volume F_br, if the node information of the last-level side branch cascade node that is a child node of the side branch cascade node N_bs21 indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node, then the obsolete data can be transferred as snapshot data to the mapping area of ​​the valid block in the volume space of other regenerated snapshot volumes corresponding to the last-level side branch cascade node that is a child node of the side branch cascade node N_bs21.

[0296] Moreover, in the embodiment of the present application, the regenerated snapshot volume can also generate a regenerated data volume through snapshot rollback. At this time, the side branch link node corresponding to the regenerated snapshot volume can be used as the parent node of the next-level side branch root node corresponding to the regenerated data volume generated based on it. Therefore, the number of executable times of snapshot rollback can be increased accordingly with the generation of the regenerated snapshot volume.

[0297] Furthermore, through step-by-step snapshot, rollback, and snapshot methods, a multi-layer iterative link can be formed, which has a trunk cascade link as the first-layer cascade link, a side branch cascade link based on the parent-child relationship between the trunk cascade node and the side branch root node as the secondary cascade link, and supports link expansion starting with a lower-level side branch cascade link based on the parent-child relationship between the side branch cascade node and the lower-level side branch root node.

[0298] Accordingly, in an embodiment of the present application, the side branch root node corresponding to the regenerated data volume for which a data query is initiated may be in any layer of the cascade link starting from the sub-layer cascade link in the multi-layer iterative link; similarly, the side branch cascade node corresponding to the regenerated snapshot volume for which a snapshot query is initiated may also be located in any layer of the cascade link starting from the sub-layer cascade link in the multi-layer iterative link.

[0299] Therefore, the query of the regenerated data volume and the regenerated snapshot volume can include: the query within the layer in the current layer cascade link, and the jump-layer query initiated by jumping from the branch root node of the current layer cascade link to the parent node in the upper layer cascade link. Among them, the end layer link of the jump-layer query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node.

[0300] Fig.14 This is a schematic diagram of an extended process of adapting a snapshot rollback to a snapshot-based data query method in an embodiment of the present application. Fig.14 The snapshot-based data query method in the embodiment of the present application may further include the following steps performed when there is a regenerated data volume:

[0301] S1410: In response to a data query on the regenerated data volume, initiating a node information search based on the snapshot metadata topology;

[0302] The node information search initiated for the regenerated data volume is configured to, for each valid block:

[0303] If the node information of the side branch root node indicates that the regenerated data of the valid block is stored in the volume space of the corresponding regenerated data volume, then the node information search for the valid block is stopped;

[0304] If the node information of the side branch root node indicates that the regenerated data of the valid block is not stored in the volume space of the corresponding regenerated data volume, a jump-level query is initiated:

[0305] Among them, each jump in the jump query is initiated by jumping from the side root node to its parent node; in each cascade link in the jump query, the parent node of the side root node in the lower cascade link is used as the search starting position to search towards the end of the cascade, and it is allowed to jump back to the root node (side root node or trunk root node) of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end-layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node.

[0306] S1430: Based on the search result of the node information search, determine the volume space where the regenerated data of all valid blocks of the queried regenerated data volume are located;

[0307] The regenerated data of the regenerated data volume at the initial stage is: the snapshot data of all valid blocks of the target snapshot volume based on which the regenerated data volume is generated;

[0308] The node information of the branch root node at the time of initial creation indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume;

[0309] S1450: By referencing the determined volume space with blocks as granularity by the queried regenerated data volume, regenerated data of all valid blocks of the regenerated data volume are obtained from the mapping areas of all valid blocks in the determined volume space.

[0310] Fig.15 Schematic diagram of the third query example implemented based on the data storage method in the embodiment of the present application. Fig.15 , the third query instance can occur in Fig.11 After the snapshot rollback instance shown, and in the third query instance:

[0311] In response to a data query on the second regenerated data volume F_br2, a node information search based on the snapshot metadata topology may be initiated. During the node information search:

[0312] For each of the first valid block on the leftmost side, the second valid block in the middle, and the third valid block on the rightmost side, the corresponding bits of the node information of the second branch root node N_br2 corresponding to the second regenerated data volume F_br2 (i.e., the block reference bitmap Bq_br2) indicate that the regenerated data of the valid block is not stored in the volume space of the corresponding second regenerated data volume F_br2. Therefore, a jump-level query can be initiated for the node information search of these three valid blocks.

[0313] In the third query instance, it is possible to jump from the second branch root node N_br2 to the second trunk cascade node N_s2 which is its parent node, so as to jump to the trunk cascade link which is the end-layer link of the jump-layer query, and in the trunk cascade link, the node information query can be implemented according to the search path such as the snapshot query of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2.

[0314] Among them, for the first valid block on the leftmost side and the second valid block in the middle, the node information (i.e., block reference bitmap Bq_root) of the trunk root node N_root can be queried eventually, indicating that the regenerated data of these two valid blocks are stored in the volume space of the corresponding target data volume F_boot, thereby terminating the node information search for the first valid block on the leftmost side and the second valid block in the middle at the trunk root node N_root; and for the third valid block on the rightmost side, the node information (i.e., block reference bitmap Bq_root) of the second trunk cascade node N_s2 can be queried, indicating that the regenerated data of the valid block are stored in the volume space of the corresponding second target snapshot volume F_s2, thereby terminating the node information search for the third valid block on the rightmost side at the second trunk cascade node N_s2.

[0315] Thus, based on the search results of the node information search, the volume space where the regenerated data of all valid blocks of the queried second regenerated data volume F_br2 are located can be determined, that is, the regenerated data of the first valid block on the far left and the second valid block in the middle are both in the corresponding mapping area in the volume space of the target data volume F_boot, and the regenerated data of the third valid block on the far right is stored in the corresponding mapping area in the volume space of the second target snapshot volume F_s2.

[0316] Furthermore, by referencing the determined volume space with blocks as granularity through the second regenerated data volume F_br2 being queried, the regenerated data of all valid blocks of the second regenerated data volume F_br2 (for example, the same "ABA" as the second target snapshot volume F_s2) are obtained from the mapping areas of all valid blocks in the determined volume space.

[0317] Fig.16 This is a schematic diagram of an extended process of adapting a snapshot after rollback using a snapshot-based data query method in an embodiment of the present application. Fig.16 In an embodiment of the present application, the snapshot-based data query method may further include the following steps executed in response to each snapshot query of any regenerated snapshot volume:

[0318] S1610: In response to a snapshot query initiated for any regenerated snapshot volume of the regenerated data volume, a node information search based on the snapshot metadata topology is initiated, wherein:

[0319] The search path for the node information search initiated for the queried regenerated snapshot volume is configured as follows, for each valid block:

[0320] Taking the side branch cascade node corresponding to the regenerated snapshot volume being queried as the search start position, searching node by node in the side branch cascade link where the side branch cascade node is located toward the end of the cascade until a side branch cascade node indicating that the valid block is stored in the corresponding volume space is found and stops;

[0321] If the side branch cascade node that reaches the end of the cascade still has not searched for the node information indicating that the valid block is stored in the corresponding volume space, then a jump-layer query is initiated:

[0322] Among them, each jump in the jump query is initiated by jumping from the side root node to its parent node; in each cascade link in the jump query, the parent node of the side root node in the lower cascade link is used as the search starting position to search towards the end of the cascade, and it is allowed to jump back to the root node (side root node or trunk root node) of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end-layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node.

[0323] S1630: Based on the search result of the node information search, determine the volume space where the snapshot data of all valid blocks of the regenerated snapshot volume being queried are located, wherein:

[0324] The regenerated snapshot volume corresponding to each side branch cascade node uses the current data of all valid blocks of the regenerated data volume when being executed to generate a data snapshot of the regenerated snapshot volume as the snapshot data;

[0325] The node information of the side branch root node indicates whether the regenerated data of all valid blocks of the regenerated data volume are stored in the volume space of the regenerated data volume;

[0326] The node information of each side branch cascade node indicates whether the snapshot data of each valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node;

[0327] S1650: Acquire snapshot data of all valid blocks of the regenerated snapshot volume from mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with blocks as granularity of the queried regenerated snapshot volume.

[0328] Fig.17 Schematic diagram of the fourth query example implemented based on the data storage method in the embodiment of the present application. Fig.17 In the embodiment of the present application, the fourth query instance may occur in Fig.13 After the fourth snapshot instance shown, and in the fourth query instance:

[0329] In response to a snapshot query I4 initiated for any regenerated snapshot volume F_bs21 of the second regenerated data volume F_br2, a node information search based on the snapshot metadata topology can be initiated, wherein, for each of the first valid block on the leftmost side, the second valid block in the middle, and the third valid block on the rightmost side, the side branch cascade node N_bs21 corresponding to the queried regenerated snapshot volume F_bs21 is taken as the search starting position, and the side branch cascade link where the side branch cascade node N_bs21 is located is searched node by node toward the cascade end until the side branch cascade node indicating that the valid block is stored in the corresponding volume space is found.

[0330] Among them, for the first valid block on the far left and the second valid block in the middle, since the side branch cascade node N_bs21 as the starting position of the search is located at the end of the cascade, and the node information of the side branch cascade node N_bs21 (for example, the fast reference bitmap Bq_bs21) indicates that the snapshot data of the two valid blocks are not stored in the volume space of the corresponding regenerated snapshot volume F_bs21, therefore, it returns to the side branch root node N_br2 in the side branch cascade link where the side branch cascade node N_bs21 is located, but since the node information of the side branch root node N_br2 (for example, the fast reference bitmap Bq_bs21) indicates that the snapshot data of the two valid blocks are not stored in the volume space of the corresponding second regenerated data volume F_br2, it is necessary to initiate a jump-layer query.

[0331] In the fourth query instance, it is possible to jump from the second branch root node N_br2 to the second trunk cascade node N_s2 which is its parent node, so as to jump to the trunk cascade link which is the end-layer link of the jump-layer query, and in the trunk cascade link, the node information query can be implemented according to the search path like the snapshot query of the second target snapshot volume F_s2 corresponding to the second trunk cascade node N_s2, and finally the node information (such as the block reference bitmap Bq_root) table of the trunk root node N_root can be queried. The regenerated data of the two valid blocks are stored in the volume space of the corresponding target data volume F_boot, thereby terminating the node information search for the first valid block on the leftmost side and the second valid block in the middle position at the trunk root node N_root.

[0332] As for the third valid block on the far right, the snapshot data of the valid block can be directly queried from the node information of the side-branch cascade node N_bs21 at the end of the cascade (for example, the fast reference bitmap Bq_bs21), and is stored in the volume space of the corresponding regenerated snapshot volume F_bs21. Therefore, the search for the node information of the third valid block on the far right can be stopped at the side-branch cascade node N_bs21 at the end of the cascade.

[0333] Thus, based on the search results of the node information search, the volume space where the snapshot data of all valid blocks of the queried regenerated snapshot volume F_bs21 are located can be determined, that is, the regenerated data of the first valid block on the leftmost side and the second valid block in the middle are both in the corresponding mapping areas within the volume space of the target data volume F_boot, and the regenerated data of the third valid block on the rightmost side is stored in the corresponding mapping area within the volume space of the regenerated snapshot volume F_bs21.

[0334] Furthermore, by referencing the determined volume space with blocks as granularity through the queried regenerated snapshot volume F_bs21, the regenerated data of all valid blocks of the regenerated snapshot volume F_bs21 (for example, the same "ABA" as the second target snapshot volume F_s2) are obtained from the mapping areas of all valid blocks in the determined volume space.

[0335] In addition, any regenerated snapshot volume can also be deleted, that is, the snapshot-based data storage method in the embodiment of the present application may further include:

[0336] In response to deletion of a snapshot of any regenerated snapshot volume generated for the regenerated data volume, deleting a side branch cascade node corresponding to the deleted regenerated snapshot volume in the snapshot metadata topology;

[0337] If the side branch cascade node corresponding to the deleted regenerated snapshot volume has a parent side branch cascade node (for example, there is a bit with a first value in the block reference bitmap of the side branch cascade node corresponding to the regenerated snapshot volume), any valid block stores snapshot data in the volume space of the deleted regenerated snapshot volume, and the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node does not store snapshot data of the valid block (for example, the bit with a first value in the block reference bitmap of the side branch cascade node corresponding to the regenerated snapshot volume has a corresponding bit with a second value in the block reference bitmap of the parent side branch cascade node), then:

[0338] Transferring the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; and

[0339] The node information of the parent regeneration cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted regeneration snapshot volume is stored in the volume space of the regeneration snapshot volume corresponding to the parent branch cascade node.

[0340] Furthermore, the regenerated data volume is configured such that deletion is allowed only after all regenerated snapshot volumes of the regenerated data volume are deleted; and the target snapshot volume or regenerated snapshot volume based on which the regenerated data volume is generated (i.e., the target snapshot volume or regenerated snapshot volume corresponding to the parent node of the branch root node corresponding to the regenerated snapshot volume) is configured such that deletion is allowed only after the regenerated data volume is deleted.

[0341] In an embodiment of the present application, a snapshot-based data storage device is also provided.

[0342] Fig.18 This is an exemplary structural diagram of a data storage device based on snapshots in an embodiment of the present application. Fig.18 In an embodiment of the present application, the snapshot-based data storage device may include:

[0343] The data snapshot module 1810 is used to configure the snapshot metadata topology of the target data volume in response to the data snapshot of the target data volume, so that the topological nodes of the snapshot metadata topology include:

[0344] The trunk root node that has a block-based mapping relationship with the volume space of the target data volume, and,

[0345] A trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot in a block-sized granularity, the trunk cascade node being created at the end of a chain cascade starting from the trunk root node in response to generation of a corresponding target snapshot volume;

[0346] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the node information of the trunk cascade node created at the end of the chain cascade at the initial creation indicates that the snapshot data of all valid blocks of the target data volume are not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0347] The data update module 1830 is used to update the node information of the trunk cascade node at the end of the cascade in response to any valid block in the target data volume after the target snapshot volume is generated. If the node information of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then:

[0348] The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and

[0349] The node information of the trunk cascade node is updated to indicate that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

[0350] In an embodiment of the present application, the node information involved in the above-mentioned data storage device can adopt the bitmap method mentioned above.

[0351] Moreover, the data storage device may also support deletion of any target snapshot volume, that is, the data storage device further comprises: a snapshot deletion module 1850, for deleting a trunk cascade node corresponding to the deleted target snapshot volume in the snapshot metadata topology in response to deletion of a snapshot of any target snapshot volume generated for the target data volume;

[0352] If any valid block stores snapshot data in the volume space of the deleted target snapshot volume, the trunk cascade node corresponding to the deleted target snapshot volume has a parent trunk cascade node, and the volume space of the target snapshot volume corresponding to the parent trunk cascade node does not store snapshot data of the valid block, then:

[0353] Transferring the snapshot data of the valid block in the volume space of the deleted target snapshot volume to the mapping area of ​​the valid block in the volume space of the target snapshot volume corresponding to the parent trunk cascade node; and

[0354] The node information of the parent trunk cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted target snapshot volume is stored in the volume space of the target snapshot volume corresponding to the parent trunk cascade node.

[0355] Based on the target snapshot volume, the data storage device can support snapshot rollback.

[0356] Fig.19 Schematic diagram of an extended structure of a snapshot-based data storage device for supporting snapshot rollback in an embodiment of the present application. Fig.19 The data storage device in the embodiment of the present application may further include:

[0357] The rollback regeneration module 1900 is used to, in response to a snapshot rollback initiated based on any target snapshot volume, configure the topology node of the snapshot metadata topology to further include:

[0358] A branch root node having a mapping relationship with a block-based granularity with the volume space of the regenerated data volume generated in response to the snapshot rollback, wherein:

[0359] The branch root node takes the corresponding trunk cascade node of the target snapshot volume based on which the snapshot rollback is based as a parent node;

[0360] The regenerated data of the regenerated data volume at the time of initial creation includes: snapshot data of all valid blocks of the target snapshot volume based on which the snapshot rollback is based; and

[0361] The node information of the branch root node when initially created indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume.

[0362] Still see Fig.19 , the regenerated data volume generated by snapshot rollback also supports data snapshots. Accordingly, the data storage device further includes:

[0363] The regeneration snapshot module 1910 is used to configure the topology nodes of the snapshot metadata topology in response to regenerating the data snapshot of the data volume at any time to further include:

[0364] A side branch cascade node is created at the end of the chain cascade starting from the side branch root node corresponding to the regenerated snapshot volume, and a mapping relationship with a block granularity exists between the side branch cascade node and the volume space of the corresponding regenerated snapshot volume;

[0365] The regenerated snapshot volume corresponding to the side branch cascade node at the end of the chain cascade is created, and the regenerated data of all valid blocks of the regenerated data volume when the data snapshot is executed is used as the snapshot data;

[0366] Furthermore, the node information of the side branch cascade node created at the end of the chain cascade at the time of initial creation indicates that the snapshot data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node;

[0367] The regeneration update module 1930 is used to respond to the data update of any valid block in the regenerated data volume after the regenerated snapshot volume is generated:

[0368] The updated regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume, and the node information of the branch root node corresponding to the regenerated data volume is updated to indicate that the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume;

[0369] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is stored in the volume space of the regenerated data volume, then the obsolete data is transferred as snapshot data to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade;

[0370] If the node information of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data of the valid block of the regenerated data volume that is replaced due to data update is not stored in the volume space of the regenerated data volume, then the snapshot data copied from the volume space where the obsolete data is located is stored in the mapping area of ​​the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade of the valid block;

[0371] Furthermore, the node information of the side branch cascade node is updated to indicate that the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

[0372] In addition, if Fig.19 As shown, in order to support deletion of the regenerated snapshot volume, the data storage device may further include:

[0373] The regeneration deletion module 1950 is used for deleting the side branch cascade node corresponding to the deleted regeneration snapshot volume in the snapshot metadata topology in response to the snapshot deletion of any regeneration snapshot volume generated for the regeneration data volume;

[0374] If the side branch cascade node corresponding to the deleted regenerated snapshot volume has a parent side branch cascade node, any valid block has snapshot data stored in the volume space of the deleted regenerated snapshot volume, and the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node does not store the snapshot data of the valid block, then:

[0375] Transferring the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; and

[0376] The node information of the parent regeneration cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted regeneration snapshot volume is stored in the volume space of the regeneration snapshot volume corresponding to the parent branch cascade node;

[0377] The regenerated data volume is configured to be deleted only after all regenerated snapshot volumes of the regenerated data volume are deleted; and the target snapshot volume or the regenerated snapshot volume based on which the regenerated data volume is generated can be configured to be deleted only after the regenerated data volume is deleted.

[0378] In an embodiment of the present application, a snapshot-based data storage device is also provided.

[0379] Fig. 20 FIG. 1 is a schematic diagram of an exemplary structure of a data query device based on a snapshot in an embodiment of the present application. Fig. 20 As shown, in an embodiment of the present application, a snapshot-based data query device may include:

[0380] The first information search module 2010 is used to initiate a node information search based on the snapshot metadata topology in response to a snapshot query initiated for any target snapshot volume of the target data volume, wherein:

[0381] The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume.

[0382] The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, starting from the trunk cascade node corresponding to the queried target snapshot volume as the search start position, searching node by node toward the cascade end until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found, and if the trunk cascade node at the cascade end is reached and still no node information indicating that the valid block is stored in the corresponding volume space is found, then jumping back to the trunk root node;

[0383] The first space determination module 2030 is used to determine the volume space where the snapshot data of all valid blocks of the queried target snapshot volume are located based on the search result of the node information search, wherein:

[0384] The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data;

[0385] The node information of the trunk root node indicates that the current data of all valid blocks of the target data volume are stored in the volume space of the target data volume;

[0386] The node information of each trunk cascade node indicates whether the snapshot data of each valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node;

[0387] The first space reference module 2050 is used to obtain snapshot data of all valid blocks of the target snapshot volume from the mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with blocks as granularity of the queried target snapshot volume.

[0388] Fig.21 Schematic diagram of the extended structure of the snapshot-based data query device in the embodiment of the present application for adapting snapshot rollback and snapshot after rollback. Fig.21 In the case where it is allowed to generate a regenerated data volume based on the target snapshot volume, the snapshot-based data query device in the embodiment of the present application may further include:

[0389] The second information search module 2110 is used to initiate a node information search based on the snapshot metadata topology in response to a data query on the regenerated data volume;

[0390] The node information search initiated for the regenerated data volume is configured to, for each valid block:

[0391] If the node information of the side branch root node indicates that the regenerated data of the valid block is stored in the volume space of the corresponding regenerated data volume, then the node information search for the valid block is stopped;

[0392] If the node information of the side branch root node indicates that the regenerated data of the valid block is not stored in the volume space of the corresponding regenerated data volume, a jump-level query is initiated:

[0393] Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node (side branch root node or trunk root node) of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node;

[0394] The second space determination module 2130 is used to determine the volume space where the regenerated data of all valid blocks of the queried regenerated data volume are located based on the search result of the node information search;

[0395] The regenerated data of the regenerated data volume at the initial stage is: the snapshot data of all valid blocks of the target snapshot volume based on which the regenerated data volume is generated;

[0396] The node information of the branch root node at the time of initial creation indicates that the regenerated data of all valid blocks of the regenerated data volume are not stored in the volume space of the regenerated data volume;

[0397] The second space reference module 2150 is used to obtain the regenerated data of all valid blocks of the regenerated data volume from the mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with block granularity through the queried regenerated data volume.

[0398] Still see Fig.21 In the case where a data snapshot is allowed to be executed on a regenerated data volume and a regenerated snapshot volume is generated, the data query device in the embodiment of the present application may further include:

[0399] The third information search module 2210 is used to initiate a node information search based on the snapshot metadata topology in response to a snapshot query initiated for any regenerated snapshot volume of the regenerated data volume, wherein:

[0400] The search path for the node information search initiated for the queried regenerated snapshot volume is configured as follows, for each valid block:

[0401] Taking the side branch cascade node corresponding to the regenerated snapshot volume being queried as the search start position, searching node by node in the side branch cascade link where the side branch cascade node is located toward the end of the cascade until a side branch cascade node indicating that the valid block is stored in the corresponding volume space is found and stops;

[0402] If the side branch cascade node that reaches the end of the cascade still has not searched for the node information indicating that the valid block is stored in the corresponding volume space, then a jump-layer query is initiated:

[0403] Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node (side branch root node or trunk root node) of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node;

[0404] The third space determination module 2230 is used to determine the volume space where the snapshot data of all valid blocks of the regenerated snapshot volume being queried is located based on the search result of the node information search, wherein:

[0405] The regenerated snapshot volume corresponding to each side branch cascade node uses the current data of all valid blocks of the regenerated data volume when being executed to generate a data snapshot of the regenerated snapshot volume as the snapshot data;

[0406] The node information of the side branch root node indicates whether the regenerated data of all valid blocks of the regenerated data volume are stored in the volume space of the regenerated data volume;

[0407] The node information of each side branch cascade node indicates whether the snapshot data of each valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node;

[0408] The third space reference module 2250 is used to obtain snapshot data of all valid blocks of the regenerated snapshot volume from the mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with blocks as granularity of the queried regenerated snapshot volume.

[0409] Fig. 22 Schematic diagram of an exemplary structure of an electronic device in an embodiment of the present application. Fig. 22 The electronic device in the embodiment of the present application may include a processor 3010, and the processor 3010 is used to execute at least one of the data storage method and the data query method in the embodiment.

[0410] Moreover, if Fig. 22 As shown, the electronic device may also include a non-transitory computer-readable storage medium 3030, which stores instructions. When these instructions are executed by the processor 3010, the processor can execute at least one of the data storage method and data query method in the described embodiments.

[0411] In an embodiment of the present application, a non-transitory computer-readable storage medium independent of the electronic device is also provided. The instructions stored in the non-transitory computer-readable storage medium can trigger a processor of any electronic device to execute at least one of the data storage method and data query method in the embodiment.

[0412] In some instances, such as Fig. 22 The electronic device shown may be configured as a server.

[0413] Fig.23 This is an exemplary structural diagram of the data storage system in the embodiment of the present application. Fig.23 The data storage system in the embodiment of the present application may include a server 300 (e.g. Fig. 22The electronic device shown in the figure) and the disk array 400, wherein the server 300 is configured to execute at least one of the data storage method and the data query method in the embodiments, and the disk array 400 can be configured to provide volume space for the target data volume, the target snapshot volume, the regenerated data volume, and the regenerated snapshot volume, and the snapshot metadata topology can be stored in the device storage medium of the server 300.

[0414] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. 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 data storage method based on snapshot, characterized in that: include: (i) in response to a data snapshot of a target data volume, configuring a snapshot metadata topology of the target data volume, so that the snapshot metadata topology has topological nodes including: a trunk root node having a mapping relationship with a volume space of the target data volume at a block granularity, and a trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot at a block granularity, the trunk cascade node being created at a corresponding end of a chain cascade starting from the trunk root node in response to generation of a corresponding target snapshot volume; wherein: The node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, each bit in the block allocation bitmap corresponds to a block in the target data volume, each bit in the block reference bitmap corresponds to a block in the target data volume, the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block, and the bit corresponding to each valid block in the block reference bitmap of each topology node is used to indicate whether the valid block is stored in the volume space of the target snapshot volume corresponding to the topology node; The bit corresponding to each valid block in the block reference bitmap of the trunk root node indicates that the current data of the valid block is stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node created at the end of the chain cascade at the time of initial creation indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; (ii) In response to data update of any valid block in the target data volume after the target snapshot volume is generated, if the bit corresponding to the valid block in the block reference bitmap of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then: The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and The bit corresponding to the valid block in the block reference bitmap of the trunk cascade node is updated to indicate that the snapshot data of the valid block is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

2. The data storage method according to claim 1, characterized in that: The data storage method further comprises: (iii) in response to deletion of a snapshot of any target snapshot volume generated for the target data volume, deleting a trunk cascade node corresponding to the deleted target snapshot volume in the snapshot metadata topology; If the trunk cascade node corresponding to the deleted target snapshot volume has a parent trunk cascade node, any valid block has snapshot data stored in the volume space of the deleted target snapshot volume, and the volume space of the target snapshot volume corresponding to the parent trunk cascade node does not store snapshot data of the valid block, then: Transferring the snapshot data of the valid block in the volume space of the deleted target snapshot volume to the mapping area of ​​the valid block in the volume space of the target snapshot volume corresponding to the parent trunk cascade node; and The bit corresponding to the valid block in the block reference bitmap of the parent trunk cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted target snapshot volume is stored in the volume space of the target snapshot volume corresponding to the parent trunk cascade node.

3. The data storage method according to claim 1, characterized in that: The data storage method further comprises: (iv) in response to a snapshot rollback initiated based on any target snapshot volume, configuring the topology node of the snapshot metadata topology to further include: A branch root node having a mapping relationship with a block-based granularity with the volume space of the regenerated data volume generated in response to the snapshot rollback, wherein: The branch root node takes the corresponding trunk cascade node of the target snapshot volume based on which the snapshot rollback is based as a parent node; The regenerated data of the regenerated data volume at the time of initial creation includes: snapshot data of all valid blocks of the target snapshot volume based on which the snapshot rollback is based; and The bit corresponding to each valid block in the block reference bitmap of the branch root node when it is initially created indicates that the regenerated data of the valid block of the regenerated data volume is not stored in the volume space of the regenerated data volume.

4. The data storage method according to claim 3, characterized in that: The data storage method further comprises: (v) In response to a data snapshot of the regenerated data volume at any time, configuring the topology nodes of the snapshot metadata topology to further include: A side branch cascade node is created at the end of the chain cascade starting from the side branch root node corresponding to the regenerated snapshot volume, and a mapping relationship with a block granularity exists between the side branch cascade node and the volume space of the corresponding regenerated snapshot volume; The regenerated snapshot volume corresponding to the side branch cascade node at the end of the chain cascade is created, and the regenerated data of all valid blocks of the regenerated data volume when the data snapshot is executed is used as the snapshot data; Furthermore, the bit corresponding to each valid block in the block reference bitmap of the side branch cascade node created at the end of the chain cascade when it is initially created indicates that the snapshot data of the valid block of the regenerated data volume is not stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node; (vi) In response to data update of any valid block in the regenerated data volume after the regenerated snapshot volume is generated: The updated regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume, and the bit corresponding to the valid block in the block reference bitmap of the side branch root node corresponding to the regenerated data volume is updated to indicate that the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; If the bit corresponding to the valid block in the block reference bitmap of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data replaced by the valid block of the regenerated data volume due to data update is stored in the volume space of the regenerated data volume, then the obsolete data is transferred as snapshot data to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade; If the bit corresponding to the valid block in the block reference bitmap of the side-branch cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node, and the obsolete data replaced by the valid block of the regenerated data volume due to data update is not stored in the volume space of the regenerated data volume, then the snapshot data copied from the volume space where the obsolete data is located is stored in the mapping area of ​​the volume space of the regenerated snapshot volume corresponding to the side-branch cascade node at the end of the side-branch chain cascade of the valid block; Furthermore, the bit corresponding to the valid block in the block reference bitmap of the side branch cascade node is updated to indicate that the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node.

5. The data storage method according to claim 4, characterized in that: The data storage method further comprises: (vii) in response to deletion of a snapshot of any regenerated snapshot volume generated for the regenerated data volume, deleting a side branch cascade node corresponding to the deleted regenerated snapshot volume in the snapshot metadata topology; If the side branch cascade node corresponding to the deleted regenerated snapshot volume has a parent side branch cascade node, any valid block has snapshot data stored in the volume space of the deleted regenerated snapshot volume, and the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node does not store the snapshot data of the valid block, then: Transferring the snapshot data of the valid block in the volume space of the deleted regenerated snapshot volume to the mapping area of ​​the valid block in the volume space of the regenerated snapshot volume corresponding to the parent side branch cascade node; and The bit corresponding to the valid block in the block reference bitmap of the parent regeneration cascade node is updated to indicate that the snapshot data of the valid block in the volume space of the deleted regeneration snapshot volume is stored in the volume space of the regeneration snapshot volume corresponding to the parent branch cascade node; The regenerated data volume is configured such that it is allowed to be deleted only after all the regenerated snapshot volumes of the regenerated data volume are deleted.

6. A data query method based on snapshot, characterized in that: include: (i) In response to a snapshot query initiated for any target snapshot volume of the target data volume, a node information search based on the snapshot metadata topology is initiated, wherein: The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume. The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, starting from the trunk cascade node corresponding to the queried target snapshot volume as the search start position, searching node by node toward the cascade end until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found, and if the trunk cascade node at the cascade end is reached and still no node information indicating that the valid block is stored in the corresponding volume space is found, then jumping back to the trunk root node; (ii) Based on the search results of the node information search, determine the volume space where the snapshot data of all valid blocks of the target snapshot volume being queried is located, wherein: The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data; The node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, each bit in the block allocation bitmap corresponds to a block in the target data volume, each bit in the block reference bitmap corresponds to a block in the target data volume, the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block, and the bit corresponding to each valid block in the block reference bitmap of each topology node is used to indicate whether the valid block is stored in the volume space of the target snapshot volume corresponding to the topology node; The bit corresponding to each valid block in the block reference bitmap of the trunk root node indicates that the current data of the valid block of the target data volume is stored in the volume space of the target data volume; The bit corresponding to each valid block in the block reference bitmap of each backbone cascade node indicates whether the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the backbone cascade node; (iii) by referencing the determined volume space at a block granularity by the queried target snapshot volume, snapshot data of all valid blocks of the target snapshot volume are obtained from mapping areas of all valid blocks in the determined volume space.

7. The data query method according to claim 6, characterized in that: The topology nodes of the snapshot metadata topology further include: a side branch root node having a mapping relationship with a volume space of a regenerated data volume with a block granularity, the regenerated data volume being generated in response to a snapshot rollback based on any target snapshot volume, and the side branch root node having a corresponding trunk cascade node of the target snapshot volume based on which the snapshot rollback is based as a parent node; The data query method further comprises: (iv) in response to a data query on the regenerated data volume, initiating a node information search based on the snapshot metadata topology; The node information search initiated for the regenerated data volume is configured to, for each valid block: If the bit corresponding to the valid block in the block reference bitmap of the branch root node indicates that the regenerated data of the valid block is stored in the volume space of the corresponding regenerated data volume, then the node information search for the valid block is stopped; If the bit corresponding to the valid block in the block reference bitmap of the side branch root node indicates that the regenerated data of the valid block is not stored in the volume space of the corresponding regenerated data volume, a jump-level query is initiated: Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node; (v) based on the search results of the node information search, determining the volume space where the regenerated data of all valid blocks of the regenerated data volume being queried are located; The regenerated data of the regenerated data volume at the initial stage is: the snapshot data of all valid blocks of the target snapshot volume based on which the regenerated data volume is generated; The bit corresponding to each valid block in the block reference bitmap of the branch root node when it is initially created indicates that the regenerated data of the valid block of the regenerated data volume is not stored in the volume space of the regenerated data volume; (vi) By referencing the determined volume space with blocks as granularity through the queried regenerated data volume, the regenerated data of all valid blocks of the regenerated data volume are obtained from the mapping areas of all valid blocks in the determined volume space.

8. The data query method according to claim 7, characterized in that: The topology node of the snapshot metadata topology further includes a side branch cascade node having a mapping relationship with the volume space of the corresponding regenerated snapshot volume with a block granularity, and the side branch cascade nodes form a chain cascade starting from the side branch root node according to the generation time sequence of the corresponding regenerated snapshot volume; The data query method further comprises: (vii) In response to a snapshot query initiated for any regenerated snapshot volume of the regenerated data volume, a node information search based on the snapshot metadata topology is initiated, wherein: The search path for the node information search initiated for the queried regenerated snapshot volume is configured as follows, for each valid block: Taking the side branch cascade node corresponding to the regenerated snapshot volume being queried as the search start position, searching node by node in the side branch cascade link where the side branch cascade node is located toward the end of the cascade until a side branch cascade node indicating that the valid block is stored in the corresponding volume space is found and stops; If the side branch cascade node that reaches the end of the cascade still has not searched for the node information indicating that the valid block is stored in the corresponding volume space, then a jump-layer query is initiated: Each jump in the jump query is initiated by jumping from the side branch root node to its parent node; in each cascade link in the jump query, the parent node of the side branch root node in the cascade link of the next layer is used as the search start position to search towards the end of the cascade, and it is allowed to jump back to the root node of the cascade link of this layer when the node information indicating that the valid block is stored in the corresponding volume space is not found at the end of the cascade; and the end layer link of the jump query is the trunk cascade link where the trunk root node is located, and the search end position in the trunk cascade link is the trunk root node; (viii) Based on the search results of the node information search, determine the volume space where the snapshot data of all valid blocks of the regenerated snapshot volume being queried is located, wherein: The regenerated snapshot volume corresponding to each side branch cascade node uses the current data of all valid blocks of the regenerated data volume when being executed to generate a data snapshot of the regenerated snapshot volume as the snapshot data; The bit corresponding to each valid block in the block reference bitmap of the side branch root node indicates whether the regenerated data of the valid block of the regenerated data volume is stored in the volume space of the regenerated data volume; The bit corresponding to the valid block in the block reference bitmap of each side branch cascade node indicates whether the snapshot data of the valid block of the regenerated data volume is stored in the volume space of the regenerated snapshot volume corresponding to the side branch cascade node; (ix) By referencing the determined volume space with blocks as granularity by the queried regenerated snapshot volume, snapshot data of all valid blocks of the regenerated snapshot volume are obtained from the mapping areas of all valid blocks in the determined volume space.

9. A data storage device based on snapshot, characterized in that: include: A data snapshot module, configured to configure a snapshot metadata topology of a target data volume in response to a data snapshot of a target data volume, so that the snapshot metadata topology has topological nodes including: a trunk root node having a mapping relationship with a volume space of the target data volume with a block granularity, and a trunk cascade node having a mapping relationship with a volume space of a target snapshot volume generated by the data snapshot with a block granularity, the trunk cascade node being correspondingly created at a chain cascade end starting from the trunk root node in response to generation of a corresponding target snapshot volume; wherein: The node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, each bit in the block allocation bitmap corresponds to a block in the target data volume, each bit in the block reference bitmap corresponds to a block in the target data volume, the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block, and the bit corresponding to each valid block in the block reference bitmap of each topology node is used to indicate whether the valid block is stored in the volume space of the target snapshot volume corresponding to the topology node; The bit corresponding to each valid block in the block reference bitmap of the trunk root node indicates that the current data of the valid block is stored in the volume space of the target data volume; the target snapshot volume corresponding to the trunk cascade node created at the end of the chain cascade uses the current data of all valid blocks of the target data volume when the data snapshot is executed as snapshot data; and the bit corresponding to each valid block in the block reference bitmap of the trunk cascade node created at the end of the chain cascade at the time of initial creation indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node; The data update module is used to respond to the data update of any valid block in the target data volume after the target snapshot volume is generated, if the bit corresponding to the valid block in the block reference bitmap of the trunk cascade node at the end of the cascade indicates that the snapshot data of the valid block is not stored in the volume space of the target snapshot volume corresponding to the trunk cascade node, then: The obsolete data of the valid block in the volume space of the target data volume that is replaced by the data update is transferred as snapshot data to the mapping area of ​​the volume space of the target snapshot volume corresponding to the trunk cascade node at the end of the chain cascade of the valid block; and The bit corresponding to the valid block in the block reference bitmap of the trunk cascade node is updated to indicate that the snapshot data of the valid block of the target data volume is stored in the volume space of the target snapshot volume corresponding to the trunk cascade node.

10. A data query device based on snapshot, characterized in that: include: The first information search module is configured to initiate a node information search based on a snapshot metadata topology in response to a snapshot query initiated for any target snapshot volume of the target data volume, wherein: The topological nodes of the snapshot metadata topology include a trunk root node and a trunk cascade node. A mapping relationship with a block granularity exists between the trunk root node and the volume space of the target data volume. A mapping relationship with a block granularity exists between each trunk cascade node and the volume space of the corresponding target snapshot volume. In addition, each trunk cascade node forms a chain cascade starting from the trunk root node in the order of the generation time of the corresponding target snapshot volume. The search path for the node information search initiated for the queried target snapshot volume is configured as follows: for each valid block, starting from the trunk cascade node corresponding to the queried target snapshot volume as the search start position, searching node by node toward the cascade end until a trunk cascade node indicating that the valid block is stored in the corresponding volume space is found, and if the trunk cascade node at the cascade end is reached and still no node information indicating that the valid block is stored in the corresponding volume space is found, then jumping back to the trunk root node; The first space determination module is used to determine the volume space where the snapshot data of all valid blocks of the queried target snapshot volume are located based on the search result of the node information search, wherein: The target snapshot volume corresponding to each trunk cascade node uses the current data of all valid blocks of the target data volume when being executed to generate a data snapshot of the target snapshot volume as snapshot data; The node information of each topology node in the snapshot metadata topology includes a block allocation bitmap and a block reference bitmap, each bit in the block allocation bitmap corresponds to a block in the target data volume, each bit in the block reference bitmap corresponds to a block in the target data volume, the bit corresponding to each block in the block allocation bitmap of each topology node is used to indicate whether the block in the target data volume is a valid block, and the bit corresponding to each valid block in the block reference bitmap of each topology node is used to indicate whether the valid block is stored in the volume space of the target snapshot volume corresponding to the topology node; The bit corresponding to each valid block in the block reference bitmap of the trunk root node indicates that the current data of the valid block is stored in the volume space of the target data volume; The bit corresponding to each valid block in the block reference bitmap of each backbone cascade node indicates whether the snapshot data of the valid block is stored in the volume space of the target snapshot volume corresponding to the backbone cascade node; The first space reference module is used to obtain snapshot data of all valid blocks of the target snapshot volume from the mapping areas of all valid blocks in the determined volume space by referencing the determined volume space with blocks as granularity through the queried target snapshot volume.

11. An electronic device, characterized in that: The method comprises a processor, wherein the processor is used to execute at least one of the data storage method according to any one of claims 1 to 5 and the data query method according to any one of claims 6 to 8.

12. A data storage system, characterized in that: It comprises a server and a disk array, wherein the server is configured to execute at least one of the data storage methods described in any one of claims 1 to 5 and the data query methods described in any one of claims 6 to 8, and the disk array is configured to provide volume space.

13. A non-transitory computer-readable storage medium, characterized in that The non-transitory computer-readable storage medium stores instructions, which, when executed by a processor, cause the processor to perform at least one of the data storage method according to any one of claims 1 to 5 and the data query method according to any one of claims 6 to 8.

Citation Information

Patent Citations

  • Zero-copy snapshot method

    CN102012853A

  • Managing access of multiple executing programs to non-local block data storage

    CN105138435A