A system and method for virtual snapshot consolidation and fast recovery
By using differentiated labeling and fingerprint-oriented merging, the problems of inaccurate differentiation of redundant data and long recovery paths in snapshot merging are solved, achieving efficient snapshot merging and fast recovery, reducing IO overhead and recovery latency, and optimizing storage space utilization.
Patent Information
- Application Number
- CN202611312398.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-11-27
AI Technical Summary
The existing snapshot merging process suffers from inconsistent content fingerprinting criteria, resulting in insufficient accuracy in distinguishing between valid incremental data blocks and redundant data blocks. This leads to long hot data recovery paths, high recovery IO latency, a lack of background triggering mechanisms linked to business IO load, and failure to promptly reclaim differential storage space after merging.
A differentiated labeling mechanism is used to distinguish between hot and cold data. Based on computing resources, a comprehensive scoring or pure access frequency counting mechanism is used to perform fingerprint calculation, comparison and targeted merging. Cold data is silently fixed to the base image in the background, while hot data is saved to differential incremental snapshots. During the merging process, only redundant data blocks are merged by pointer redirection. During recovery, hot data is read first from the differential snapshot.
It reduces the amount of merged I/O, shortens the recovery path, improves recovery efficiency, balances the efficient use of computing resources and business stability, and realizes dynamic reclamation of storage space.
Smart Images

Figure CN123178346A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data storage technology, specifically to a system and method for virtual snapshot merging and rapid recovery. Background Technology
[0002] In modern distributed storage systems and virtualization environments, snapshot technology is widely used for data protection, version management, and fault recovery. Snapshot mechanisms based on copy-on-write or redirected write can generate point-in-time copies of data without interrupting business operations. As the number of snapshots increases, the snapshot chain length extends, leading to increased storage space usage and longer read paths. Therefore, it is necessary to periodically merge or flatten the snapshot chain.
[0003] The invention patent with application number 202411351946.2 discloses a snapshot data processing method, apparatus, electronic device, and storage medium that obtains multiple snapshots to form a snapshot chain, determines a target flattened snapshot, and searches and fills non-empty data blocks along the snapshot chain for each empty data block in the target flattened snapshot to improve snapshot reading efficiency. However, this invention adopts a uniform flattening strategy and does not distinguish between hot and cold data in the snapshots. As a result, hot data is solidified to the base image during the flattening process, and subsequent recovery must be performed by reading the entire data from the base image, thus losing the fast recovery advantage of differential snapshots. In addition, this invention searches and fills all empty data blocks along the snapshot chain in the target flattened snapshot without performing duplicate determination of data block content. This results in a large number of data blocks with duplicate content being copied and merged repeatedly, resulting in high merging IO overhead.
[0004] In addition, existing technologies generally have the following shortcomings: (1) The criteria for determining the content fingerprint in the existing snapshot merging are not uniform, resulting in insufficient accuracy in distinguishing between valid incremental data blocks and redundant data blocks; (2) The existing snapshot recovery does not design differentiated read paths for hot and cold data partitions, resulting in long recovery paths and high recovery IO latency; (3) The existing snapshot merging lacks a background triggering mechanism that is linked to business IO load, and the differential storage space is not reclaimed in time after the merging is completed; Therefore, there is an urgent need for a system and method for virtual snapshot merging and rapid recovery that can reduce unnecessary data merging operations and solve the above-mentioned technical problems. Summary of the Invention
[0005] This invention discloses a system and method for virtual snapshot merging and rapid recovery, aiming to solve the above-mentioned technical problems.
[0006] According to a first aspect of the present invention, a method for virtual snapshot merging and fast recovery is disclosed, comprising: S1: Based on the sufficiency of computer configuration resources, a differentiated labeling mechanism is adopted to label data blocks as cold data or hot data; S2: Based on the duration of continuous inaccessibility of cold data, the current business IO load, and the recent access interval of hot data, adopt a differentiated merging strategy: solidify cold data to the base image, save hot data to differential incremental snapshots, and convert hot data into cold data and solidify it. S3: During the cold data background solidification and merging process, fingerprint calculation, comparison, secondary verification, and targeted merging are performed on the target data block; S4: After the cold data is solidified, update the metadata index and release the differential snapshot storage space occupied by the merged data blocks; S5: Receives snapshot recovery requests, reads cold data from the base image, and reads hot data from differential incremental snapshots.
[0007] Furthermore, the marking mechanism in step S1 specifically includes: in scenarios with limited computer resources, a pure access frequency counting mechanism is adopted; in scenarios with abundant computer resources, a comprehensive scoring mechanism including access frequency, recent access time interval, and IO popularity score is adopted.
[0008] Furthermore, it also includes: a first marking threshold, a second marking threshold, and a third marking threshold; wherein, under the comprehensive scoring mechanism, when the access frequency of a data block is less than or equal to the first marking threshold, the recent access time interval is greater than or equal to the second marking threshold, and the IO popularity score is less than or equal to the third marking threshold, the data block is marked as cold data; when the access frequency of a data block is greater than the first marking threshold, the recent access time interval is less than the second marking threshold, and the IO popularity score is greater than the third marking threshold, it is marked as hot data; Under the pure access frequency technology mechanism, when the access frequency of a data block is less than or equal to the first marking threshold, the data block is marked as cold data, and when the access frequency of a data block is greater than the first marking threshold, the data block is marked as hot data.
[0009] Further, step S2 specifically includes: When the duration of cold data not being accessed is greater than or equal to the first policy threshold and the current business IO load of the snapshot chain is less than or equal to the second policy threshold, the cold data will be silently batch-frozen to the base image in the background. When the most recent access time interval of hot data is less than or equal to the third policy threshold, or when hot data is marked as copy-on-write protected, hot data is saved to differential incremental snapshot; When the most recent access time interval of hot data is greater than the third policy threshold and it is not marked as copy-on-write protection, its hot data retention qualification is removed and it is transferred to the cold data solidification evaluation queue. Its continuous inaccessible time is accumulated from the most recent access time, and it can be solidified only when it is greater than or equal to the first policy threshold and the business IO load is less than or equal to the second policy threshold.
[0010] Furthermore, during the cold data solidification process, the current business IO load of the snapshot chain is monitored in real time. If the current business IO load is greater than or equal to the second policy threshold, the solidification operation of the current batch is paused, the breakpoint is marked and the solidification progress is recorded. When the business IO load drops back to below the second policy threshold, the solidification operation is resumed from the breakpoint. If a target data block is detected to be re-marked as hot data during the solidification process, the solidification operation for that data block is terminated, it is removed from the current solidification batch, any solidification operations that have not yet been performed on that data block are no longer performed, any targeted merge operations that have already been performed on that data block are revoked, and its storage in the differential incremental snapshot is restored. The differential storage space it occupies is not released.
[0011] Furthermore, step S3 specifically includes: S31: Calculate the content fingerprint of the target data block: Different fingerprint generation algorithms are used depending on the scenario, specifically including: In scenarios where real-time merging is critical, the BLAKE3 hash algorithm is used. In scenarios where accuracy requirements are relatively low but I / O is sensitive, cyclic redundancy check codes are used. In the standard default scenario, the SHA-256 hash algorithm is used to output a 32-byte hash value; In scenarios where content addressing management is used in storage systems, content addressing identifiers are used, and the addressing identifiers generated by the storage system based on the data block content are directly reused as content fingerprints; S32: Compare the content fingerprint with the content fingerprint of the data block at the corresponding position in the base image, and perform a secondary verification based on the length of the content fingerprint; Furthermore, the secondary verification specifically includes: if the content fingerprint length is less than a preset security length threshold, performing a byte-by-byte content comparison between the target data block and the corresponding data block in the base image; if the comparison matches, the data block is determined to be a redundant data block; otherwise, it is determined to be a fingerprint collision, and the data block is marked as a valid incremental data block, skipping this merging; if the content fingerprint length is not less than the preset security length threshold, the first fingerprint comparison matches, and the data block is determined to be a redundant data block; the first fingerprint comparison does not match, and the data block is determined to be a valid incremental data block.
[0012] S33: If the comparison is consistent, it is determined to be a redundant data block and a targeted merge is performed; if the comparison is inconsistent, it is determined to be a valid incremental data block, the current merge is skipped, and the data block in the original differential snapshot is retained for re-evaluation in a subsequent merge cycle; the targeted merge specifically means: redirecting the metadata pointer of the data block in the differential snapshot to the storage address of the corresponding data block in the base image, without the need for actual data copying.
[0013] Furthermore, the differential path recovery in step S5 specifically includes: prioritizing the reading of hot data and valid incremental data blocks from the differential incremental snapshot, and prioritizing the reading of cold data that has been solidified to the base image from the base image; if the required hot data block or valid incremental data block does not exist in the differential incremental snapshot, then reverting to the corresponding position in the base image for reading.
[0014] According to a second aspect of the present invention, a system for virtual snapshot merging and fast recovery is disclosed, for performing the method of any one of claims 1 to 8, specifically comprising: The cold / hot identification module identifies data blocks in the snapshot chain as either cold or hot data. The fingerprint-directed merging module performs fingerprint verification on the target data block during the merging process, performs targeted merging only on redundant data blocks, and skips valid incremental data blocks; Furthermore, the fingerprint directional merging module includes: a fingerprint calculation unit, a fingerprint comparison unit, and a merging execution unit; The fingerprint calculation unit calculates the content fingerprint of the target data block; The fingerprint comparison unit compares the content fingerprint with the content fingerprint of the data block at the corresponding position in the base image. The merge execution unit performs a targeted merge when the content fingerprints are consistent and skips the merge when the content fingerprints are inconsistent.
[0015] The strategy decision-making module determines differentiated snapshot merging strategies based on the identification results of hot and cold data. When the recovery acceleration module receives a snapshot recovery request, it reads hot data and valid incremental data blocks from the differential incremental snapshot and cold data from the base image. The trigger control module monitors the duration of continuous inaccessibility of cold data and the load of business IO, and will trigger the corresponding operation only when the conditions are met. The space release module releases the corresponding storage space in the differential snapshot after the cold data has been solidified. The outputs of the hot / cold identification module, the trigger control module, and the recovery acceleration module are connected to the input of the strategy decision module. The output of the strategy decision module is connected to the input of the fingerprint orientation merging module. The fingerprint orientation merging module is also connected to the hot / cold identification module to obtain data block marking information. The output of the fingerprint orientation merging module is connected to the input of the space release module.
[0016] Compared with the prior art, the beneficial effects of the present invention include: (1) By linking cold and hot identification with differentiated merging strategies, cold data is silently solidified to the base image in the background, while hot data is stored separately with differential increments. This solves the problem of the hot data recovery path becoming longer due to unified merging, and at the same time reduces the amount of merging IO. (2) Through the dual-mechanism cold and hot marking of the scenario, the pure access frequency counting mechanism and the comprehensive scoring mechanism are adopted respectively in scenarios with limited and sufficient computing resources, which takes into account the marking accuracy and computing resource overhead, and meets the needs of users in different scenarios. (3) By using multiple fingerprint generation algorithms and fingerprint-directed merging, redundant data blocks and valid incremental data blocks are accurately distinguished by content fingerprints. Only redundant data blocks are subjected to pointer redirection merging without data copying, which greatly reduces unnecessary data transfer IO. (4) By implementing the interruption control strategy in the solidification process, the linkage between the merging process and the business IO load is realized, which avoids business peaks and reduces the impact on the business, while also leaving an observation window for the data switching between hot and cold states, avoiding false solidification caused by state fluctuations, and taking into account both the snapshot chain sorting effect and the business operation stability. (5) Recovery via a differentiated path prioritizes reading hot data and valid incremental data blocks from the differential incremental snapshot and reading solidified cold data from the base image, thus shortening the recovery path and reducing recovery IO latency; (6) Dynamic reclamation of storage space is achieved by updating the metadata index and releasing the differential space after the solidification is completed. Attached Figure Description
[0017] Figure 1 is a flowchart illustrating the virtual snapshot merging and fast recovery method of the present invention; Figure 2 This is a schematic diagram of the system architecture for virtual snapshot merging and rapid recovery according to the present invention. Detailed Implementation
[0018] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] As shown in Figure 1, this embodiment of the present invention provides a method for virtual snapshot merging and fast recovery. In this embodiment, a snapshot chain exists in a distributed storage system, including a base image SnapshotBase and three-layer differential snapshots Snapshot1, Snapshot2, and Snapshot3; each snapshot contains 8 data blocks BLK1 to BLK8. This embodiment of a method for merging and quickly restoring virtual snapshots specifically includes: S1: Based on different scenarios, different marking mechanisms are used to mark data blocks as cold data or hot data; Specifically, the marking mechanism includes two types: a pure access frequency counting mechanism is used in scenarios with limited computer resources; and a comprehensive scoring mechanism, including access frequency, recent access time interval, and IO heat score, is used in scenarios with abundant computer resources. The system can pre-determine whether the current computing resources are limited based on the processor performance, memory capacity, or system configuration parameters of the operating environment. If a comprehensive scoring mechanism is uniformly adopted, it may cause system lag or even crashes for users with poor computer configurations; if a pure access frequency counting mechanism is uniformly adopted, the marking accuracy may not meet the requirements for fine-grained merging for users with good computer configurations. Therefore, this embodiment adaptively selects the marking mechanism according to the computing resource scenario. The marking accuracy of the comprehensive scoring mechanism is greater than that of the pure access frequency counting mechanism, thereby achieving a balance between marking accuracy and computing resource overhead.
[0020] Under the comprehensive scoring mechanism, this embodiment sets a first marking threshold, a second marking threshold, and a third marking threshold. When the access frequency of a data block is less than or equal to the first marking threshold, the recent access time interval is greater than or equal to the second marking threshold, and the IO popularity score is less than or equal to the third marking threshold, the data block is marked as cold data; conversely, when the access frequency of a data block is greater than the first marking threshold, the recent access time interval is less than the second marking threshold, and the IO popularity score is greater than the third marking threshold, the data block is marked as hot data. Under the pure access frequency counting mechanism, when the access frequency of a data block is less than or equal to the first marking threshold, the data block is marked as cold data; when the access frequency of a data block is greater than the first marking threshold, the data block is marked as hot data.
[0021] In this embodiment, the first marker threshold represents the upper limit of the number of accesses within the preset statistical window, with a value range of 0 to 5 times, a preferred value of 0 times, and a limit value of 5 times; the second marker threshold represents the lower limit of the time interval between the most recent access to the data block and the current time, with a value range of 24 hours to 72 hours, a preferred value of 48 hours, and a limit value of 72 hours; the third marker threshold represents the upper limit of the IO popularity score, with a value range of 10 to 50 points, a preferred value of 20 points, and a limit value of 50 points. The IO popularity score adopts a score system from 0 to 100.
[0022] Furthermore, the IO popularity score is calculated based on the access logs within a preset statistical window. In this embodiment, the preset statistical window is the past 72 hours. The calculation formula for the IO popularity score is: ; Where S is the IO popularity score, ranging from 0 to 100; N is the number of times the data block was accessed within a 72-hour window; D is the cumulative read / write data volume of the data block within a 72-hour window; D ref For reference read / write volume, the larger of twice the average read / write volume of all data blocks in the snapshot chain within the window and a preset lower limit is taken. The preset lower limit ranges from 1MB to 64MB, with a preferred value of 8MB and an extreme value of 64MB. This setting is to avoid the reference read / write volume being 0 and the scoring calculation failing when the average read / write volume of the entire chain is 0 when the system has just created a snapshot and the business has not yet started. Δt is the time interval between the most recent access to the data block and the current time, in hours. When there are no access records in the window, Δt is taken as 72. α, β, and γ are weighting coefficients that satisfy α+β+γ=1. In this embodiment, α is preferably 0.4, β is 0.3, and γ is preferably 0.3. The above access frequency and most recent access time interval are obtained from the access log, and the parameters in the IO heat scoring formula are also obtained based on the access log statistics. Cold and hot marking is performed according to a preset period. In this embodiment, it is preferred to update the cold and hot marking of each data block every hour based on the incremental access log within the window, and only data blocks with access records within the window are re-evaluated to reduce computational overhead.
[0023] In this embodiment, the hot / cold data identification module collects the access logs of each data block over the past 72 hours and marks the data blocks as hot or cold based on access frequency, recent access time interval, and IO heat score. BLK1, BLK3, and BLK5 have zero accesses in the past 72 hours, and their IO heat score S≈1.5 points, which is far below the preferred value of 20 points for the third marking threshold. Furthermore, their recent access time interval is greater than or equal to the preferred value of 48 hours for the second marking threshold. They meet all the conditions for cold data determination and are marked as cold data. BLK2, BLK4, BLK6, BLK7, and BLK8 have access records or recent write operations in the past 72 hours. For example, BLK2 was accessed 10 times within the window, the cumulative read / write data volume is half of the reference read / write volume, and the most recent access was 6 hours ago. Its IO heat score S≈43.9 points is higher than the preferred value of 20 points for the third marking threshold. It does not meet the conditions for cold data determination and is marked as hot data.
[0024] S2: Different merging strategies are adopted based on the duration of inaccessibility of cold data, the current business IO load, and the recent access interval of hot data. It should be noted that after a data block is marked as cold or hot data, it will not be immediately saved to the corresponding location. Instead, the corresponding merging strategy will only be triggered when the triggering conditions are met.
[0025] Specifically, when the duration of continuous inaccessibility of cold data is greater than or equal to the first policy threshold and the current business IO load of the snapshot chain is less than or equal to the second policy threshold, the cold data will be silently batch-frozen to the base image in the background. When the time interval between the most recent accesses of hot data is less than or equal to the third policy threshold, or when hot data is marked as being in a copy-on-write protection state, the hot data will be saved to the differential incremental snapshot. When the time interval between the most recent accesses of hot data is greater than the third policy threshold and it is not marked as being in a copy-on-write protection state, its hot data retention qualification will be revoked, and it will be transferred to the cold data solidification evaluation queue. Its duration of continuous inaccessibility will be accumulated from the most recent access time, and it can only be solidified when it is greater than or equal to the first policy threshold and the business IO load is less than or equal to the second policy threshold.
[0026] In this embodiment, the first strategy threshold represents the lower limit of the duration during which cold data remains unaccessed, with a value range of 72 hours to 168 hours, a preferred value of 72 hours, and a maximum value of 168 hours; the second strategy threshold represents the upper limit of the current business IO load of the snapshot chain, with a value range of 10% to 30%, a preferred value of 20%, and a maximum value of 10%; the third strategy threshold represents the upper limit of the time interval between the most recent accesses to hot data, with a value range of 1 hour to 24 hours, a preferred value of 24 hours, and a maximum value of 1 hour.
[0027] The above range values are set based on the following: First, a threshold of less than 72 hours may cause short pauses during business downtime to be misjudged as cold data and thus solidified, while a threshold of more than 168 hours may cause cold data to occupy differential storage space for a long time; Second, a threshold of more than 30% may cause backend merging to interfere with business IO, while a threshold of less than 10% may cause the triggering conditions to be too strict, and the business may never have a merging opportunity if there is even a slight load; Third, a threshold of less than 1 hour may be too sensitive to hot data protection, while a threshold of more than 24 hours may not be sufficient to protect hot data.
[0028] In this embodiment, the trigger control module continuously monitors the duration of inaccessibility of cold data BLK1, BLK3, and BLK5 and the current business IO load of the snapshot chain. When the duration of inaccessibility of cold data BLK1, BLK3, and BLK5 is greater than or equal to the preferred value of 72 hours (first policy threshold), and the current business IO load of the snapshot chain is less than or equal to the preferred value of 20% (second policy threshold), the trigger control module sends a trigger signal to the policy decision module. The policy decision module then initiates a background silent batch solidification process to solidify the data block content corresponding to cold data BLK1, BLK3, and BLK5 to the corresponding location in SnapshotBase. For hot data BLK2, BLK4, BLK6, BLK7, and BLK8, the policy decision module determines that their most recent access interval is less than or equal to the preferred value of 24 hours (third policy threshold), or that some hot data is marked as copy-on-write protected. Therefore, the hot data is retained in the differential incremental snapshot of Snapshot3 and is prohibited from being merged into SnapshotBase. For hot data blocks that do not meet the retention conditions, such as a hot data block whose recent access time interval is greater than the third policy threshold and which is not marked as copy-on-write protection, their hot data retention qualification is revoked and they are transferred to the cold data solidification evaluation queue. Their continuous unaccessed time is accumulated from the most recent access time, and they can be solidified only when it is greater than or equal to the first policy threshold and the business IO load is less than or equal to the second policy threshold.
[0029] Furthermore, the silent batch solidification process for cold data in the background also includes an interruption control strategy. During the cold data solidification process, the current business IO load of the snapshot chain is monitored in real time. If the current business IO load is greater than or equal to the second policy threshold, the solidification operation of the current batch is paused, a breakpoint is marked, and the solidification progress is recorded. When the business IO load drops back below the second policy threshold, the solidification operation is resumed from the breakpoint. Solidification is performed with data blocks as the smallest atomic unit, and solidified data blocks are not processed repeatedly. For example, during the solidification process of BLK1, BLK3, and BLK5, if the business IO load increases from 15% to 25%, which is greater than or equal to the preferred value of 20% of the second policy threshold, the solidification of the current batch is paused and a breakpoint is marked. Solidification is resumed from the breakpoint when the business IO load drops back below 20%.
[0030] If a target data block is detected to be re-marked as hot data during the solidification process, the solidification operation for that data block is terminated, it is removed from the current solidification batch, any unexecuted solidification operations for that data block are not performed, the targeted merge operation already performed on that data block is revoked, and its storage in the differential incremental snapshot is restored. The differential storage space it occupies is not released. For example, if BLK3 is re-marked as hot data due to being accessed again by the business during the solidification process, the solidification of BLK3 is terminated and it is removed from the current batch. BLK3 remains in the differential incremental snapshot, and its differential storage space is not released. Since the targeted merge in this solution is a metadata pointer redirection operation rather than a physical data copy, the data block at the corresponding location in the base image is the original data asset. Therefore, revoking the targeted merge only requires restoring the metadata pointer from the corresponding storage address in the base image to the original storage address in the differential incremental snapshot. There is no need to perform any deletion or rollback operations on any data in the base image. Furthermore, since the space release action is only performed after the solidification batch is completed, the data of that data block in the differential snapshot is still present when revoking, and there is no data loss during rollback.
[0031] S3: During the cold data backend solidification and merging process, fingerprint calculation, comparison, and targeted merging are performed on the target data block. Specifically, step S3 includes: S31: Calculating the content fingerprint of the target data block; S32: Comparing the content fingerprint with the content fingerprint of the corresponding data block in the base image, and performing a secondary verification based on the length of the content fingerprint; S33: If the comparison matches, it is determined to be a redundant data block and targeted merging is performed; if the comparison does not match, it is determined to be a valid incremental data block, skipping this merging, retaining the data block in the original differential snapshot, and re-evaluating it in a subsequent merging cycle. Specifically, the targeted merging in step S33 involves redirecting the metadata pointer of the data block in the differential snapshot to the storage address of the corresponding data block in the base image, without requiring actual data copying.
[0032] Furthermore, step S31 employs different fingerprint generation algorithms depending on the scenario, specifically including: in scenarios with high real-time merging requirements, the BLAKE3 hash algorithm is used, which maintains high collision resistance while offering higher computational speed; in scenarios with relatively low precision requirements but IO sensitivity, Cyclic Redundancy Check (CRC) is used, as CRC has lower computational overhead; in conventional default scenarios, the SHA-256 hash algorithm is used, outputting a 32-byte hash value with extremely low collision probability and the highest accuracy; in scenarios where the storage system uses content addressing management, content addressing identifiers are used, directly reusing the addressing identifiers generated by the storage system according to the data block content as the content fingerprint, eliminating the need for additional computation and further reducing fingerprint computation overhead. In this embodiment, the fingerprint calculation unit calculates the content fingerprint of the target data block, and the content fingerprint uses the SHA-256 hash value.
[0033] Furthermore, step S32, based on comparing the content fingerprint with the content fingerprint of the corresponding data block in the base image, performs additional secondary verification. A differentiated verification strategy is implemented to address the differences in collision risk among different types of fingerprints, effectively solving the technical problems of fingerprint collisions and misjudged data redundancy that easily occur in short fingerprint algorithms. This balances the security of fingerprint verification with system operating efficiency, specifically including: If the content fingerprint length is less than the preset security length threshold, a byte-by-byte content comparison is performed between the target data block and the corresponding data block in the base image. If the comparison matches, the data block is determined to be a redundant data block; otherwise, it is determined to be a fingerprint collision, and the data block is marked as a valid incremental data block, skipping this merging. If the content fingerprint length is not less than the preset security length threshold, the first fingerprint comparison matches and the data block is determined to be a redundant data block; the first fingerprint comparison does not match and the data block is determined to be a valid incremental data block. In this embodiment, the fingerprint security length threshold is preferably set to 16 bytes. This threshold is the optimal boundary value that balances verification security and computational overhead. For short fingerprints such as Cyclic Redundancy Check (CRC) codes, which are usually 4 or 8 bytes long, their length is less than the 16-byte security threshold, and the probability of hash collisions is relatively high. Therefore, a byte-by-byte secondary verification must be initiated to prevent erroneous merging caused by repeated fingerprint matching. For SHA-256, BLAKE3, etc., the output lengths are 32 bytes and 16 bytes respectively. Fingerprints longer than one byte (with a length greater than or equal to a preset security threshold) have a large value range, reducing the risk of collisions in engineering applications. They eliminate the need for additional byte comparisons, achieving accurate judgment through a single fingerprint comparison. By setting a fixed security threshold, layered verification is implemented. Low-confidence short fingerprints undergo mandatory reinforcement verification, while the verification process is simplified for high-confidence long fingerprints. This reduces the risk of false fingerprint collisions while avoiding the additional I / O overhead and computational loss from full byte-by-byte comparisons, precisely balancing the accuracy and efficiency of snapshot merging.
[0034] In step S3 of this embodiment, the fingerprint calculation unit calculates the content fingerprint of cold data BLK1 to obtain HashA. The fingerprint comparison unit compares this HashA with the content fingerprint of the corresponding data block BLK1 in SnapshotBase. Both are HashA, and the comparison is consistent. Therefore, BLK1 is determined to be a redundant data block. The merge execution unit performs a directed merge, redirecting the metadata pointer of BLK1 in Snapshot3 to the storage address of BLK1 in SnapshotBase. No actual data copy is required, thus completing the solidification of BLK1. The fingerprint calculation unit calculates the content fingerprint of cold data BLK5 to obtain HashB. The fingerprint comparison unit compares this HashB with the content fingerprint HashC of the corresponding data block BLK5 in SnapshotBase. The two are inconsistent. Since the data block in the differential snapshot is necessarily later than the corresponding data block in the base image on the snapshot timeline, the inconsistent content fingerprint indicates that the data block is a new write generated after the base image. Therefore, BLK5 is determined to be a valid incremental data block. The merge execution unit skips this merge and retains BLK5 in the differential incremental snapshot for re-evaluation in subsequent merge cycles.
[0035] S4: After the cold data is solidified, update the metadata index and release the differential snapshot storage space occupied by the merged data blocks. Specifically, after the cold data BLK1 and BLK3 are solidified to SnapshotBase, the space release module updates the snapshot chain metadata index and releases the storage space occupied by BLK1 and BLK3 in the original differential snapshots Snapshot1, Snapshot2, and Snapshot3. The data blocks that are skipped and retained in step S33 are not included in this category. For example, the effective incremental data block BLK5 is still retained in the differential incremental snapshot, and the differential storage space it occupies will not be released. It will be processed after re-evaluation in subsequent merging cycles.
[0036] S5: Receive a snapshot recovery request and perform differentiated path recovery. Specifically, differentiated path recovery includes: prioritizing the reading of hot data and valid incremental data blocks from the differential incremental snapshot, and prioritizing the reading of cold data already embedded in the base image from the base image; if the required hot data block or valid incremental data block is not present in the differential incremental snapshot, the process falls back to the corresponding position in the base image for reading. For example, upon receiving a snapshot recovery request, the recovery acceleration module prioritizes reading hot data BLK2, BLK4, BLK6, BLK7, BLK8 and valid incremental data block BLK5 from the differential incremental snapshot of Snapshot3, and reads cold data BLK1 and BLK3 already embedded in the base image from SnapshotBase, in order to shorten the recovery path and reduce recovery IO latency; if the required hot data block or valid incremental data block is not present in the differential incremental snapshot (e.g., the data block has been embedded in the base image), the process falls back to the corresponding position in the base image for reading.
[0037] To verify the technical effect of the present invention, three comparative examples were also set up for comparison testing with this embodiment.
[0038] Comparative example A uses the traditional full merge scheme, which performs a unified full merge on all data blocks in the snapshot chain, merging all data blocks of Snapshot3 into SnapshotBase regardless of whether the data is hot or cold.
[0039] Comparative Example B uses the existing flattening scheme, selects Snapshot3 as the target flattening snapshot, and retrieves and fills all empty data blocks along the snapshot chain with non-empty data.
[0040] Comparative Example C uses cold and hot data recognition but no fingerprint verification scheme. It only performs solidification on cold data and retention on hot data, but does not perform fingerprint verification during the merging process. All cold data is physically copied and merged.
[0041] Tests were conducted under the same snapshot chain conditions, and the results are as follows: The merged IO overhead of this embodiment is reduced by approximately 65% compared to Comparative Example A, approximately 45% compared to Comparative Example B, and approximately 30% compared to Comparative Example C; the snapshot recovery time of this embodiment is shortened by approximately 55% compared to Comparative Example A, approximately 25% compared to Comparative Example B, and comparable to Comparative Example C, but with superior merged IO. The above data demonstrates that this invention, through the linkage of cold and hot fingerprint recognition and fingerprint-directed merging, achieves a significantly better synergistic optimization effect than existing technologies in reducing merged IO overhead and ensuring recovery efficiency.
[0042] Embodiment 2 of the present invention also provides a system for virtual snapshot merging and rapid recovery, such as... Figure 2As shown, the method for performing the above-mentioned virtual snapshot merging and recovery includes a cold / hot identification module, a strategy decision module, a fingerprint-oriented merging module, a trigger control module, a space release module, and a recovery acceleration module; wherein the fingerprint-oriented merging module includes a fingerprint calculation unit, a fingerprint comparison unit, and a merging execution unit.
[0043] The cold / hot identification module is used to perform step S1, to identify the data blocks in the snapshot chain as cold or hot data; The strategy decision module is used to execute step S2, which determines a differentiated snapshot merging strategy based on the identification results of hot and cold data. The fingerprint-directed merging module is used to execute step S3. During the merging process, fingerprint verification is performed on the target data block. Directed merging is only performed on redundant data blocks, and valid incremental data blocks are skipped. The fingerprint calculation unit is used to calculate the content fingerprint of the target data block, the fingerprint comparison unit is used to compare the content fingerprint with the content fingerprint of the data block at the corresponding position of the base image, and the merging execution unit is used to perform directed merging when the content fingerprint is consistent and skip merging when the content fingerprint is inconsistent. The trigger control module is used to monitor the duration of continuous inaccessibility of cold data and the load of business IO in step S2. When the conditions are met, it triggers the corresponding operation and is responsible for interrupt control during the hardening process. The space release module is used to execute step S4, which releases the corresponding storage space in the differential snapshot after the cold data is solidified; The recovery acceleration module is used to execute step S5. When a snapshot recovery request is received, it reads hot data and valid incremental data blocks from the differential incremental snapshot and reads cold data that has been solidified to the base image from the base image. If the required hot data blocks or valid incremental data blocks are not found in the differential incremental snapshot, it rolls back to the corresponding position in the base image to read them.
[0044] The outputs of the hot / cold identification module, the trigger control module, and the recovery acceleration module are connected to the input of the strategy decision module. The output of the strategy decision module is connected to the input of the fingerprint orientation merging module. The fingerprint orientation merging module is also connected to the hot / cold identification module to obtain data block marking information. The output of the fingerprint orientation merging module is connected to the input of the space release module.
[0045] Those skilled in the art will understand that all or part of the steps in the above embodiments can be implemented by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor. Therefore, embodiments of the present invention provide a computer-readable storage medium storing multiple instructions that, when executed by a processor, implement the steps in the virtual snapshot merging method described above. Embodiments of the present invention also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor, when executing the computer program, implements the virtual snapshot merging method described above.
[0046] The above provides a detailed description of a system and method for virtual snapshot merging and rapid recovery provided by embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the invention. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for merging and quickly restoring virtual snapshots, characterized in that, include: S1: Based on the sufficiency of computer configuration resources, a differentiated labeling mechanism is adopted to label data blocks as cold data or hot data; S2: Based on the duration of continuous inaccessibility of cold data, the current business IO load, and the recent access interval of hot data, adopt a differentiated merging strategy: solidify cold data to the base image, save hot data to differential incremental snapshots, and convert hot data into cold data and solidify it. S3: During the cold data background solidification and merging process, fingerprint calculation, comparison, secondary verification and targeted merging processing are performed on the target data block; S4: After the cold data is solidified, update the metadata index and release the differential snapshot storage space occupied by the merged data blocks; S5: Receives snapshot recovery requests, reads cold data from the base image, and reads hot data from differential incremental snapshots.
2. The method according to claim 1, characterized in that, Step S3 specifically includes: S31: Based on the system's requirements for real-time merging, sensitivity to IO overhead, and storage architecture type, select the corresponding fingerprint generation algorithm to calculate the content fingerprint of the target data block; S32: Compare the content fingerprint with the content fingerprint of the data block at the corresponding position in the base image, and perform a secondary verification based on the length of the content fingerprint; S33: Execute the corresponding merging strategy based on the comparison results.
3. The method according to claim 2, characterized in that, Step S31 specifically includes: using the BLAKE3 hash algorithm in scenarios with high real-time requirements for merging; using cyclic redundancy check code in scenarios with relatively low precision requirements but sensitive to IO; using the SHA-256 hash algorithm in conventional default scenarios; and directly reusing the addressing identifier generated by the storage system according to the data block content as the content fingerprint in scenarios where the storage system adopts content addressing management.
4. The method according to claim 2, characterized in that, The secondary verification in step S32 specifically includes: if the content fingerprint length is less than a preset security length threshold, performing a byte-by-byte content comparison between the target data block and the corresponding data block in the base image; if the comparison matches, the data block is determined to be a redundant data block; otherwise, it is determined to be a fingerprint collision, and the data block is marked as a valid incremental data block, skipping this merging; if the content fingerprint length is not less than the preset security length threshold, if the first fingerprint comparison matches, it is determined to be a redundant data block; if the first fingerprint comparison does not match, it is determined to be a valid incremental data block.
5. The method according to claim 2, characterized in that, Step S33 specifically includes: if it is a redundant data block, then perform targeted merging; if it is a valid incremental data block, then skip this merging, retain the data block in the original differential snapshot, and re-evaluate it in a subsequent merging cycle.
6. The method according to claim 5, characterized in that, The targeted merging specifically involves redirecting the metadata pointer of the data block in the differential snapshot to the storage address of the corresponding data block in the base image.
7. The method according to claim 1, characterized in that, Step S2 specifically includes: When the duration of cold data not being accessed is greater than or equal to the first policy threshold and the current business IO load of the snapshot chain is less than or equal to the second policy threshold, the cold data will be silently batch-frozen to the base image in the background. When the most recent access time interval of hot data is less than or equal to the third policy threshold, or when hot data is marked as copy-on-write protected, hot data is saved to differential incremental snapshot; When the most recent access time interval of hot data is greater than the third policy threshold and it is not marked as copy-on-write protection, its hot data retention qualification is removed and it is transferred to the cold data solidification evaluation queue. Its continuous inaccessible time is accumulated from the most recent access time, and it can be solidified only when it is greater than or equal to the first policy threshold and the business IO load is less than or equal to the second policy threshold.
8. The method according to claim 7, characterized in that, The silent batch solidification process for cold data in the background includes: During the cold data solidification process, the current business IO load of the snapshot chain is monitored in real time. If the current business IO load is greater than or equal to the second policy threshold, the solidification operation of the current batch is paused, the breakpoint is marked and the solidification progress is recorded. When the business IO load drops back below the second policy threshold, the solidification operation is resumed from the breakpoint.
9. The method according to claim 8, characterized in that, The cold data background silent batch solidification process also includes: if the target data block is detected to be re-marked as hot data during the solidification process, the solidification operation of the data block is terminated, it is removed from the current solidification batch, the solidification operation that has not yet been performed on the data block is no longer performed, the targeted merging operation that has been performed on the data block is undone, and its storage in the differential incremental snapshot is restored.
10. A system for virtual snapshot merging and rapid recovery, used to perform the method according to any one of claims 1 to 8, characterized in that, include: The cold / hot identification module identifies data blocks in the snapshot chain as either cold or hot data. The fingerprint targeted merging module includes a fingerprint calculation unit, a fingerprint comparison unit, and a merging execution unit. During the merging process, fingerprint calculation, comparison, and secondary verification are performed on the target data block. Targeted merging is only performed on redundant data blocks, and valid incremental data blocks are skipped. The strategy decision-making module determines differentiated snapshot merging strategies based on the identification results of hot and cold data. When the recovery acceleration module receives a snapshot recovery request, it reads hot data and valid incremental data blocks from the differential incremental snapshot and cold data from the base image. The trigger control module monitors the duration of continuous inaccessibility of cold data and the load of business IO, and will trigger the corresponding operation only when the conditions are met. The space release module releases the corresponding storage space in the differential snapshot after the cold data has been solidified.
Citation Information
Patent Citations
Snapshot data processing method and device, electronic equipment and storage medium
CN119311640A
