Block storage volume rollback method, device and storage medium
By creating temporary snapshots and lists of differential data blocks in the block storage volume, the business interruption problem caused by offline full replication in existing technologies is solved, online rollback is achieved, and data integrity and business continuity are guaranteed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA ELECTRONICS CLOUD DIGITAL INTELLIGENCE TECH CO LTD
- Filing Date
- 2026-02-06
- Publication Date
- 2026-06-05
AI Technical Summary
Existing block storage volume rollback methods require offline full copying, which causes business read and write operations to be suspended for a long time, affecting storage system resources and reducing data usage flexibility.
By creating temporary snapshots in the storage volume, a list of differential data blocks is generated, and the differential data blocks are written back to the current active volume with past timestamps. At the same time, logical view switching is performed to maintain business read and write continuity and process business write requests in parallel.
It enables online rollback, avoiding the performance impact of full data replication, ensuring the continuity of business read and write operations and data integrity, and providing flexible support for switching historical states.
Smart Images

Figure CN122152229A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer storage technology, specifically to a block storage volume rollback method, device, and storage medium. Background Technology
[0002] In modern data center and cloud computing environments, block storage services are a core foundational component supporting various business operations. Snapshot functionality, as a crucial means of ensuring data security and achieving business continuity, has become a standard feature of block storage systems. A snapshot is essentially a complete data image of a storage volume at a specific point in time. It is widely used in various scenarios such as data backup, fault recovery, and business testing. When data is damaged due to misoperation, software failure, or malicious attack, rolling back the storage volume to a historical, normal snapshot state is a core operation for restoring business operations.
[0003] Currently, the industry's primary method for rolling back storage volumes is the offline full rollback method: first, the storage volume is taken offline from the business system, and then all data blocks of the target snapshot are completely copied back to the original volume. This offline full rollback method has the following drawbacks: During the entire data replication process, the application cannot access the storage volume, causing business read and write operations to be suspended for a long time. Furthermore, the full data replication process is time-consuming, consuming storage system resources and affecting the performance response of the storage volume to other services. Moreover, after some rollback schemes are executed, all subsequent snapshots created after the rollback target snapshot will be forcibly deleted or invalidated, reducing the flexibility of data usage. Summary of the Invention
[0004] To address the shortcomings of existing technologies, this application solves the technical problem of how to achieve online rollback while maintaining business read and write operations.
[0005] To achieve the above objectives, in a first aspect, embodiments of this application provide a block storage volume rollback method, the method comprising the following steps: After initiating the instruction to roll back the state of the current active volume to the target snapshot, a temporary snapshot corresponding to the state of the current active volume is created; Generate a list of difference data blocks based on the target snapshot and the temporary snapshot, read the data content corresponding to the difference data blocks from the target snapshot, and write it back to the current active volume.
[0006] In conjunction with the first aspect, in one implementation, after creating a temporary snapshot corresponding to the current active volume state, a logical view switch is performed. The logical view switch is performed by switching the active metadata pointer of the storage volume from the current active volume to the target snapshot.
[0007] In conjunction with the first aspect, in one implementation, before generating the list of difference data blocks, it is determined whether the epoch version number corresponding to the data blocks in the target snapshot and the temporary snapshot is consistent. If so, it indicates that the rollback was successful; otherwise, the list of difference data blocks is generated.
[0008] In conjunction with the first aspect, in one implementation, the process of generating the list of difference data blocks includes: The data blocks corresponding to epoch version numbers that are inconsistent between the target snapshot and the temporary snapshot are taken as difference data blocks, all difference data blocks are recorded, and a list of difference data blocks is obtained.
[0009] In conjunction with the first aspect, in one implementation, the process of reading the data content corresponding to the difference data block from the target snapshot and writing it back to the current active volume includes: Based on the list of differential data blocks, read the data content corresponding to the differential data blocks from the target snapshot, and write the data content back to the current active volume with past timestamps. After traversing the list of difference data blocks, the rollback is completed.
[0010] In conjunction with the first aspect, in one implementation, during the rollback process, parallel service read / write operations are performed, and the process of parallel service read / write operations includes: When responding to a read request from a business, read the latest version of the storage volume data from the target snapshot.
[0011] When responding to a business write request, data is written to the space where the target snapshot is located in the storage volume using the current timestamp.
[0012] In conjunction with the first aspect, in one implementation, the method for obtaining the latest version data of the storage volume includes: Determine whether the difference data block in the target snapshot has been written or modified by the business. If so, use the difference data block after the business write as the latest version data; otherwise, use the difference data block in the target snapshot as the latest version data.
[0013] In conjunction with the first aspect, in one implementation, when writing data content back to the current active volume of the storage volume with past timestamps is done in parallel with business writes, business writes have higher priority than writing data content back to the current active volume with past timestamps.
[0014] In a second aspect, embodiments of this application provide a block storage volume rollback device, characterized in that the block storage volume rollback device includes a processor, a memory, and a block storage volume rollback program stored in the memory and executable by the processor, wherein when the block storage volume rollback program is executed by the processor, it implements the method provided in the first aspect.
[0015] Thirdly, embodiments of this application provide a computer-readable storage medium, characterized in that the computer-readable storage medium stores a block storage volume rollback program, wherein when the block storage volume rollback program is executed, it implements the method provided in the first aspect.
[0016] Compared with the prior art, the advantages of this application are: By creating temporary snapshots in the storage volume, the system maintains the storage volume's online presence and continuous processing of business read / write requests. It also performs targeted data write-backs based on the differences between the temporary and target snapshots, avoiding the impact on storage performance caused by full data replication. This ensures the continuity of business read / write operations. Furthermore, it utilizes past timestamps to isolate rollback read / write operations from business read / write operations, avoiding the risks of data conflicts and inconsistencies. Moreover, it eliminates the need to delete any snapshots after the target rollback snapshot, ensuring complete historical versions of data while providing reliable support for users to flexibly switch between different historical states. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the block storage volume rollback process in this application; Figure 2 This is a schematic diagram of the hardware structure of the block storage volume rollback device involved in the embodiments of this application. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0020] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0022] In a first aspect, embodiments of this application provide a block storage volume rollback method, the method comprising the following steps: After initiating the instruction to roll back the state of the current active volume (i.e., the physical space in the storage volume used to store real-time business data) to the target snapshot (Snap_Target), a temporary snapshot (Snap_Temp, used to lock the current data state) corresponding to the current active volume state is created. A list of differential data blocks is generated based on the target snapshot and the temporary snapshot. The data content corresponding to the differential data blocks is read from the target snapshot and written back (using data overwrite method) to the current active volume (i.e. the physical space in the storage volume used to store real-time business data).
[0023] By creating temporary snapshots in the storage volume, targeted data write-back is performed based on the differences between the temporary snapshot and the target snapshot. This avoids the impact on storage performance caused by full data copying and eliminates the need to delete any snapshots after the target snapshot. This ensures the integrity of historical data versions while providing reliable support for users to flexibly switch between different historical states.
[0024] In one embodiment, after creating a temporary snapshot corresponding to the current active volume state, a logical view switch is performed. The logical view switch is performed by switching the active metadata pointer of the storage volume (the metadata index pointing to the current readable and writable data of the storage volume) from the current active volume to the target snapshot.
[0025] In this way, when switching logical views, only metadata (such as offset and time) is modified, without the need to move actual data. The switching speed is fast (it can be completed in milliseconds to seconds). At this time, from the perspective of the application and the user, the storage volume has been successfully rolled back and business read and write can be resumed immediately, providing a support foundation for ensuring the continuity of business read and write.
[0026] In one embodiment, before generating the list of differential data blocks, it is determined whether the epoch version number corresponding to the data block in the target snapshot and the temporary snapshot is consistent (a corresponding logical version identifier is generated each time the data block is written, which is used to identify the content status of the data block at a certain point in time). If they are consistent, it means that the rollback is successful; otherwise, the list of differential data blocks is generated.
[0027] Based on this, the process for generating a list of difference data blocks includes: The data blocks corresponding to epoch version numbers that are inconsistent between the target snapshot and the temporary snapshot are taken as difference data blocks, all difference data blocks are recorded, and a list of difference data blocks is obtained.
[0028] In one embodiment, the process of reading the data content corresponding to the difference data block from the target snapshot and writing it back to the current active volume includes: Based on the list of difference data blocks, read the data content corresponding to the difference data blocks from the target snapshot, and write the data content back to the current active volume with a past timestamp (such as the current system time minus 30 seconds). After traversing the list of difference data blocks, the rollback is completed.
[0029] Based on this, during the rollback process using the above method, parallel business read and write operations are performed. The process for parallel business read and write operations includes: When responding to a business read request, the latest version of the storage volume data is read from the target snapshot (at this time, the snapshots corresponding to the time after the target snapshot are no longer considered, such as snapshots A, B, and C arranged in chronological order. When snapshot A is the target snapshot, snapshots B and C are skipped directly).
[0030] When responding to a business write request, data is written to the space where the target snapshot is located in the storage volume using the current timestamp.
[0031] The methods for obtaining the latest version data of the aforementioned storage volume include: Determine whether the difference data block in the target snapshot has been written or modified by the business (i.e., after the epoch version number changes, it means that it has been written or modified by the business). If so, the difference data block after the business write is taken as the latest version data; otherwise, the difference data block in the target snapshot is taken as the latest version data.
[0032] Furthermore, when writing data content back to the current active volume of the storage volume with past timestamps in parallel with business writes, business writes have higher priority than writing data content back to the current active volume with past timestamps.
[0033] In this way, data is isolated by using the current timestamp and past timestamps during the data writing process. Due to the difference in timestamps, data will not interfere with or conflict with each other. Furthermore, by setting priorities, the impact of rollback on business write performance can be avoided.
[0034] In one embodiment, reference is made to Figure 1 , Figure 1 This is a schematic diagram of the block storage volume rollback process in this application. For example... Figure 1 As shown, the block storage volume rollback process includes: S1. Initiate the command to roll back the state of the current active volume to the target snapshot; S2. Create a temporary snapshot of the current active volume's real-time state; S3. Determine whether the epoch version number corresponding to the data block in the target snapshot and the temporary snapshot are consistent. If yes, go to S7; otherwise, go to S4. S4. Generate a list of differential data blocks (see the above process for generating a list of differential data blocks). S5. Based on the list of differential data blocks, read the data content corresponding to the differential data blocks from the target snapshot, and write the data content back to the current active volume of the storage volume with a past timestamp (such as the current system time minus 30 seconds). (Note that after writing back a differential data block, delete the differential data block from the list of differential data blocks.) S6. Determine whether the traversal of the difference data block list has been completed. If yes, go to S7; otherwise, go to S5. S7. Complete the rollback (at this point, you can delete the temporary snapshot).
[0035] Secondly, embodiments of this application provide a block storage volume rollback device, which can be a device with data processing capabilities such as a personal computer (PC), a laptop computer, or a server.
[0036] Reference Figure 2 , Figure 2 This is a schematic diagram of the hardware structure of the block storage volume rollback device involved in the embodiments of this application. In the embodiments of this application, the block storage volume rollback device may include a processor, a memory, a communication interface, and a communication bus.
[0037] The communication bus can be of any type and is used to interconnect the processor, memory, and communication interface.
[0038] The communication interface includes input / output (I / O) interfaces, physical interfaces, and logical interfaces used for interconnecting devices within the block storage volume rollback device, as well as interfaces used for interconnecting the block storage volume rollback device with other devices (such as other computing devices or user equipment). Physical interfaces can be Ethernet interfaces, fiber optic interfaces, ATM interfaces, etc.; user equipment can be displays, keyboards, etc.
[0039] Memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0040] The processor can be a general-purpose processor, which can call the block storage volume rollback program stored in memory and execute the block storage volume rollback method provided in the embodiments of this application. For example, the general-purpose processor can be a central processing unit (CPU). The method executed when the block storage volume rollback program is called can be referred to in various embodiments of the block storage volume rollback method of this application, and will not be repeated here.
[0041] Those skilled in the art will understand that Figure 2 The hardware structure shown does not constitute a limitation of this application and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0042] Thirdly, embodiments of this application also provide a computer-readable storage medium.
[0043] The computer-readable storage medium of this application stores a block storage volume rollback program, wherein when the block storage volume rollback program is executed by a processor, it implements the steps of the block storage volume rollback method as described above.
[0044] The method implemented when the block storage volume rollback procedure is executed can be referred to in various embodiments of the block storage volume rollback method of this application, and will not be repeated here.
[0045] It should be noted that the sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0046] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.
[0047] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.
[0048] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0049] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.
[0050] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.
[0051] The above are merely specific embodiments of this application, but the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the scope of the claims.
Claims
1. A block storage volume rollback method, characterized in that, The method includes the following steps: After initiating the instruction to roll back the state of the current active volume to the target snapshot, a temporary snapshot corresponding to the state of the current active volume is created; Generate a list of difference data blocks based on the target snapshot and the temporary snapshot, read the data content corresponding to the difference data blocks from the target snapshot, and write it back to the current active volume.
2. The block storage volume rollback method as described in claim 1, characterized in that: After creating a temporary snapshot corresponding to the current active volume state, a logical view switch is performed. The logical view switch is performed by switching the active metadata pointer of the storage volume from the current active volume to the target snapshot.
3. The block storage volume rollback method as described in claim 1, characterized in that: Before generating the list of difference data blocks, it is determined whether the epoch version number corresponding to the data blocks in the target snapshot and the temporary snapshot is consistent. If they are consistent, it indicates that the rollback is successful; otherwise, the list of difference data blocks is generated.
4. The block storage volume rollback method as described in claim 3, characterized in that: The process for generating the list of differential data blocks includes: The data blocks corresponding to epoch version numbers that are inconsistent between the target snapshot and the temporary snapshot are taken as difference data blocks, all difference data blocks are recorded, and a list of difference data blocks is obtained.
5. The block storage volume rollback method as described in claim 1, characterized in that: The process of reading the data content corresponding to the difference data block from the target snapshot and writing it back to the current active volume includes: Based on the list of differential data blocks, read the data content corresponding to the differential data blocks from the target snapshot, and write the data content back to the current active volume with past timestamps. After traversing the list of difference data blocks, the rollback is completed.
6. The block storage volume rollback method as described in claim 5, characterized in that: During the rollback process, parallel business read and write operations are performed. The process for parallel business read and write operations includes: When responding to a read request from a business, read the latest version of the storage volume data from the target snapshot. When responding to a business write request, data is written to the space where the target snapshot is located in the storage volume using the current timestamp.
7. A block storage volume rollback method as described in claim 6, characterized in that: The methods for obtaining the latest version data of the storage volume include: Determine whether the difference data block in the target snapshot has been written or modified by the business. If so, use the difference data block after the business write as the latest version data; otherwise, use the difference data block in the target snapshot as the latest version data.
8. The block storage volume rollback method as described in claim 7, characterized in that: When writing data content back to the current active volume of the storage volume with past timestamps in parallel with business writes, business writes have higher priority than writing data content back to the current active volume with past timestamps.
9. A block storage volume rollback device, characterized in that, The block storage volume rollback device includes a processor, a memory, and a block storage volume rollback program stored in the memory and executable by the processor, wherein when the block storage volume rollback program is executed by the processor, it implements the steps of the block storage volume rollback method as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a block storage volume rollback procedure, wherein when the block storage volume rollback procedure is executed, it implements the steps of the block storage volume rollback method as described in any one of claims 1 to 8.