Volume snapshot difference query method and electronic device
By creating a difference cache for each snapshot and sorting queries based on logical block address identifiers, the problem of low efficiency in snapshot difference queries is solved, achieving efficient and accurate snapshot difference queries.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHONGKE SUGUANG INFORMATION IND CHENGDU CO LTD
- Filing Date
- 2026-05-11
- Publication Date
- 2026-07-14
AI Technical Summary
Existing technologies are inefficient when querying differences between multiple snapshots, especially in scenarios where data state changes are sparse, increasing unnecessary query counts and system load.
By creating a differential cache for each snapshot, the storage area where the data state changes is independently queried according to the capacity threshold of the differential cache, and sorted and read using the logical block address identifier of the differential cache, duplicate queries and omissions are avoided, thus enabling autonomous forward progress.
It reduces the number of snapshot queries, improves query efficiency, ensures the accuracy and timeliness of data reading, and reduces the number of I/O operations and interactions in the system.
Smart Images

Figure CN122387751A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method and electronic device for querying volume snapshot differences. Background Technology
[0002] In computer storage systems, a volume snapshot captures the complete logical state of a storage volume at a specific point in time, generating a static, readable copy of the data. As system storage scales and data update frequencies increase, quickly querying the differences between multiple snapshots becomes a key technical challenge.
[0003] In related technologies, snapshot difference queries typically employ a fixed query interval, dividing the volume space into multiple intervals with a fixed query step size. Within each fixed query interval, all snapshots are traversed with the same query step size, increasing the number of volume space interactions and input / output (I / O) operations. In scenarios where the storage area where the data state changes in a snapshot is relatively sparse, this will further increase the number of snapshot queries, leading to reduced query efficiency. Summary of the Invention
[0004] In view of this, this application provides a volume snapshot difference query method and electronic device.
[0005] One aspect of this application provides a volume snapshot difference query method, comprising: acquiring T snapshots of a volume space in a storage system, wherein the t-th snapshot indicates the change information of a first data state in each storage area of the volume space at time t relative to the change of a second data state in each storage area of the volume space at time t-1, where T is an integer greater than 1, and t=1,…,T; for the t-th snapshot, if the number of logical block addresses written to the difference cache associated with the t-th snapshot satisfies a predetermined query condition, in response to the target address identifier of the previous round of query ending as a starting point, querying the storage area in the current round where the data state has changed in the t-th snapshot, and writing the logical block address identifier of the storage area where the data state has changed into the difference cache, wherein the logical block address identifier written into the difference cache includes the target address identifier indicating the end of the current round of query.
[0006] According to an embodiment of this application, by creating associated differential caches for T snapshots, for the t-th snapshot of the T snapshots, if the number of logical block address identifiers written to the differential cache associated with the t-th snapshot meets a predetermined query condition, in response to the target address identifier at the end of the previous round of query, the storage area in the t-th snapshot of the current round where the data state has changed is queried, and the logical block address identifier of the storage area where the data state has changed is written to the differential cache associated with the t-th snapshot. Since the distribution of storage areas where the data state has changed on each snapshot is random and independent, the query of each snapshot can be pushed forward autonomously within the maximum storage range of the volume space without the need for a fixed unified query interval. The queries between each snapshot do not affect each other. In scenarios where the storage areas where the data state changes in the snapshot are relatively sparse, the number of queries on the snapshot can be reduced, thereby improving query efficiency.
[0007] According to an embodiment of this application, satisfying the predetermined query conditions includes the number of logical block addresses written to the differential cache being less than a predetermined capacity threshold of the differential cache; in response to the target address identifier of the previous round of query ending as the starting point, querying the storage area where the data state has changed in the t-th snapshot of the current round, and writing the logical block address identifier of the storage area where the data state has changed to the differential cache, including: in response to the target address identifier of the previous round of query ending as the starting point, querying the storage area where the data state has changed in the t-th snapshot of the current round, and writing the logical block address identifier of the storage area where the data state has changed to the differential cache, until the number of logical block address identifiers written to the differential cache is equal to the predetermined capacity threshold.
[0008] According to the embodiments of this application, starting from the target address identifier at the end of the previous round of query, the storage area in the t-th snapshot of the current round where the data state has changed is queried to avoid duplicate queries or query omissions; the logical block address identifier when the number of storage areas where the data state has changed reaches the predetermined capacity threshold of the differential cache is written to the corresponding differential cache, until the number of logical block address identifiers written to the differential cache is equal to the predetermined capacity threshold, thereby enabling independent querying of each snapshot, reducing the randomness of addressing and I / O operations during the query of each snapshot, and improving query efficiency.
[0009] According to an embodiment of this application, the method further includes: responding to the target address identifier at the end of the previous round of query as the starting point, querying the storage area where the data state has changed in the t-th snapshot of the current round, and writing the logical block address identifier of the storage area where the data state has changed into the differential cache, until the end address of the volume space is queried.
[0010] According to the embodiments of this application, starting from the target address identifier at the end of the previous round of query, the storage area where the data state of the current round of the t-th snapshot has changed is queried to avoid duplicate queries or query omissions; and the logical block address identifier of the storage area where the data state has changed is written into the differential cache until the end address of the volume space is found, so that each snapshot performs queries within its own volume space until the end address of its own volume space is found and then the corresponding snapshot query is no longer executed, thereby allowing the queries on each snapshot version to grow forward autonomously without hindering each other.
[0011] According to an embodiment of this application, the method further includes: if the number of logical block addresses written to the difference cache associated with the t-th snapshot is greater than zero and less than a predetermined capacity threshold of the difference cache, the operation of querying the storage area in the t-th snapshot whose data state has changed, starting from the target address identifier at the end of the previous round of query, is not performed.
[0012] According to an embodiment of this application, when the number of logical block addresses written in the difference cache associated with the t-th snapshot is greater than zero and less than a predetermined capacity threshold, the operation of querying the storage area in the t-th snapshot whose data state has changed, starting from the target address identifier of the previous round of query, can be omitted. This fully utilizes the difference cache of each snapshot, and performs independent forward push queries for each snapshot without affecting each other. As a result, subsequent queries are not performed on the corresponding snapshots whose storage areas identified by logical block addresses written in the difference cache have not been fully read, thereby reducing the number of interactions with the volume space and the number of system I / O operations.
[0013] According to an embodiment of this application, the above method further includes: reading candidate logical block address identifiers that are less than or equal to the target logical block address identifier from the difference cache associated with each snapshot, based on the target logical block address identifier, wherein the target logical block address identifier is the smallest address identifier among the target address identifiers at the end of the current round of query corresponding to each of the T snapshots; sorting the candidate logical block address identifiers in the T difference caches to obtain the address sequence of the data to be read.
[0014] According to an embodiment of this application, by sorting the candidate logical block address identifiers in T differential caches, an address sequence of data to be read is obtained, and data is read from the storage area of the volume space based on the address sequence of the data to be read, so as to ensure the accuracy and timeliness of reading data.
[0015] According to an embodiment of this application, sorting the candidate logical block address identifiers in T difference caches to obtain the address sequence of the data to be read includes: extracting target candidate logical block address identifiers from the candidate logical block address identifiers in the T difference caches and sorting them; taking the target candidate logical block address identifier at the top as the dequeue element, the dequeue element is used to read data from the target storage area of the volume space, and the target candidate logical block address identifier represents the smallest candidate logical block address identifier in each difference cache; taking the smallest candidate logical block address identifier belonging to the same difference cache as the dequeue element from the remaining candidate logical block address identifiers in the T difference caches as the enqueue element to obtain the address sequence of the data to be read.
[0016] According to the embodiments of this application, by sorting the target candidate logical block address identifiers and dynamically replacing the dequeue and enqueue elements, the address sequence of the data to be read is dynamically obtained, ensuring that the storage area of the newest snapshot is always read, thus ensuring the accuracy of the read data.
[0017] According to an embodiment of this application, selecting and sorting a target candidate logical block address identifier from candidate logical block address identifiers in T difference caches includes: using the target candidate logical block address identifier selected from the candidate logical block address identifiers associated with T snapshots as a queue element of a priority queue, wherein the queue element in the priority queue comprises the target candidate logical block address identifier and the hierarchy identifier of the difference cache to which the target candidate logical block address identifier is written; and sorting the queue elements of the priority queue according to the target candidate logical block address identifier and the hierarchy identifier of the difference cache to which the target candidate logical block address identifier is written.
[0018] According to embodiments of this application, by constructing the composition attributes of queue elements of a priority queue and sorting the queue elements based on the composition attributes of the queue elements, it is ensured that data in the volume space storage area is read in an orderly manner, avoiding system instability caused by out-of-order reading, while ensuring the accuracy of the read data and that the data read is from the latest snapshot.
[0019] According to an embodiment of this application, from the remaining candidate logical block address identifiers in T difference caches, the smallest candidate logical block address identifier belonging to the same difference cache as the dequeued element is taken as the enqueue element, including: determining the difference cache associated with the dequeued element from the T difference caches based on the dequeued element; if there is a candidate logical block identifier in the difference cache associated with the dequeued element, taking the smallest candidate logical block address identifier belonging to the same difference cache as the dequeued element as the target candidate logical block address identifier, and adding the target candidate logical block address identifier as the enqueue element to the tail of the queue.
[0020] According to the embodiments of this application, the corresponding difference cache is quickly associated with the dequeue element, and the smallest candidate logical block address identifier of the associated corresponding difference cache is used as the enqueue element of the priority queue, thereby improving the lookup efficiency of the logical block address identifier to be read, ensuring that the logical block address identifier in the difference cache is not missed, and thus ensuring the accuracy of the read data.
[0021] According to an embodiment of this application, the above method further includes: if the logical block address identifiers of the storage regions whose data status has changed in the t-th snapshot are consecutive, writing the logical block address identifiers of the storage regions whose data status has changed in the t-th snapshots into the difference cache associated with each of the t-th snapshots, and terminating the query operation for all snapshots after the t-th snapshot, 1 < t ≤ T.
[0022] According to an embodiment of this application, if the logical block address identifiers of storage areas where the data state has changed during the query process are consecutive when querying a snapshot, then there is no need to query subsequent snapshots, thereby further reducing the number of queries and improving query efficiency.
[0023] Another aspect of this application provides an electronic device comprising:
[0024] One or more processors;
[0025] Memory, used to store one or more programs.
[0026] Specifically, when one or more programs are executed by one or more processors, the one or more processors implement the methods described above.
[0027] Another aspect of this application provides a computer-readable storage medium storing computer-executable instructions that, when executed, are used to implement the method described above.
[0028] Another aspect of this application provides a computer program product including computer-executable instructions that, when executed, implement the method described above. Attached Figure Description
[0029] The above and other objects, features and advantages of this application will become clearer from the following description of embodiments with reference to the accompanying drawings, in which:
[0030] Figure 1 A schematic diagram illustrating the partitioning of storage regions in a volume space within a storage system, as shown in related technologies, is presented.
[0031] Figure 2 This diagram illustrates how snapshot differences are obtained based on snapshot bitmaps and difference bitmaps in related technologies.
[0032] Figure 3 This diagram illustrates the use of a fixed query interval to obtain snapshot differences in related technologies.
[0033] Figure 4 This diagram illustrates a snapshot difference query in a scenario where data distribution is discrete and sparse due to random writes, as described in related technologies.
[0034] Figure 5 An exemplary system architecture for applying the volume snapshot difference query method and electronic device according to embodiments of this application is shown;
[0035] Figure 6 A flowchart of a volume snapshot difference query method according to an embodiment of this application is shown;
[0036] Figure 7 A schematic diagram of a volume snapshot difference query method according to an embodiment of this application is shown;
[0037] Figure 8 A schematic diagram of the difference cache associated with a corresponding snapshot according to an embodiment of this application is shown;
[0038] Figure 9 A schematic diagram illustrating the priority queue rules and basic operations according to embodiments of this application is shown;
[0039] Figure 10 This illustration shows that the logical block address identifiers of storage regions whose data states have changed according to an embodiment of this application are continuous in the t-th snapshot;
[0040] Figure 11 This diagram illustrates the dequeueing and enqueueing of the address sequence of data to be read according to an embodiment of this application;
[0041] Figure 12 A schematic diagram illustrating the independent query of snapshot differences according to an embodiment of this application is shown;
[0042] Figure 13 A schematic diagram illustrating the dequeue and enqueue operations of a sequence of addresses to be read constructed based on the target logical block address identifier according to an embodiment of this application;
[0043] Figure 14 A block diagram of a volume snapshot difference query apparatus according to an embodiment of this application is shown;
[0044] Figure 15 A block diagram of an electronic device suitable for implementing the volume snapshot difference query method described above, according to an embodiment of this application, is shown. Detailed Implementation
[0045] The embodiments of this application will now be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of this application. In the following detailed description, numerous specific details are set forth to provide a thorough understanding of the embodiments of this application for ease of explanation. However, it will be apparent that one or more embodiments may be implemented without these specific details. Furthermore, descriptions of well-known structures and technologies are omitted in the following description to avoid unnecessarily obscuring the concepts of this application.
[0046] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. The terms “comprising,” “including,” etc., as used herein indicate the presence of features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.
[0047] All terms used herein (including technical and scientific terms) have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.
[0048] When using expressions such as "at least one of A, B and C", they should generally be interpreted in accordance with the meaning that is commonly understood by those skilled in the art (e.g., "a system having at least one of A, B and C" should include, but is not limited to, a system having A alone, a system having B alone, a system having C alone, a system having A and B, a system having A and C, a system having B and C, and / or a system having A, B and C, etc.).
[0049] In the embodiments of this application, the collection, updating, analysis, processing, use, transmission, provision, disclosure, and storage of data (e.g., including but not limited to user personal information) comply with relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures have been taken to prevent unauthorized access to user personal information data and to safeguard user personal information security and network security.
[0050] In the embodiments of this application, the user's authorization or consent was obtained before obtaining or collecting the user's personal information.
[0051] In scenarios involving automated decision-making using personal information, the methods, devices, and systems provided in this application all offer users corresponding entry points for choosing to agree to or reject the automated decision-making results. If the user chooses to reject, the process proceeds to the expert decision-making stage. Here, "automated decision-making" refers to the activity of automatically analyzing and evaluating an individual's behavioral habits, interests, or economic, health, and credit status through computer programs, and then making a decision. Here, "expert decision-making" refers to the activity of making decisions by personnel who specialize in a particular field, possess specialized experience, knowledge, and skills, and have reached a certain level of professional expertise.
[0052] In related technologies, snapshots record the complete logical state of a volume or file at a specific time, which is an important capability of storage systems and forms the basis of disaster recovery or cloning operations.
[0053] Disaster recovery and cloning operations both require backing up independent copies of data. Backups can be divided into full backups and incremental backups. Full backups copy all data completely each time, consuming large amounts of storage space and taking a long time, resulting in high system resource consumption and significant drawbacks. Incremental backups only copy data blocks that have changed since the last specific point in time—that is, newly added and modified data blocks—excluding unchanged data blocks. By reducing redundant storage, incremental backups can shorten backup time, reduce transmission bandwidth, have less impact on system resources, are suitable for frequent operations, and enhance the reliability and stability of the storage system.
[0054] Comparing the differences between two snapshots is fundamental to incremental backups. Snapshot differences refer to the set of blocks where data has changed between two points in time (e.g., T1 and T2, T1 < T2). Essentially, it only needs to track the data modification trajectory, without requiring the entire set of data blocks. For the two snapshots being compared, the earlier one (T1) is typically called the starting snapshot, and the later one (T2) is called the target snapshot (T1 < T2). Many snapshots can exist between the starting and target snapshots. The differences between the starting and target snapshots must include the differences from each snapshot in between.
[0055] It should be noted that the terms "earlier time" or "later time" used in this application refer to the current time. For example, a snapshot of a time that is far from the current time is considered an earlier snapshot; a snapshot of a time that is closer to the current time is considered a later snapshot.
[0056] Figure 1 This diagram illustrates the partitioning of storage regions in a volume space within a storage system, as described in related technologies. For example... Figure 1As shown, the volume space in the storage system is divided into storage regions (e.g., data blocks, blocks, fragments, etc.) according to their size. The data blocks are then numbered from low to high addresses, with Logical Block Addressing (LBA) monotonically increasing from 0 to n, such as LBA0, LBN1, ..., LBAn. The size of the data blocks can be set. Blank cells indicate that the corresponding data block has no data; for example, LBA1 has no data. Non-blank cells indicate that the corresponding data block has data; for example, LBA0 and LBA2 have data.
[0057] The existing methods for querying volume snapshot differences mainly include: (1) directly reading the data blocks on the starting snapshot and the target snapshot respectively, comparing the data byte by byte to determine whether they are the same, and comparing the entire volume space range to find out which data is different. Although this method has high accuracy in querying snapshot differences, it involves comparing all data blocks byte by byte for large-capacity storage (such as TB level), which is computationally intensive and time-consuming (may take several hours), and its efficiency is far lower than that of comparing snapshot metadata. At the same time, repeatedly reading the same unmodified data blocks causes a waste of storage system read bandwidth and affects business performance.
[0058] (2) Starting from the initial snapshot, construct a snapshot bitmap and a difference bitmap for each snapshot between the initial snapshot and the target snapshot. Each block bit in the snapshot bitmap corresponds one-to-one with a data block of the volume, recording the existence status of the data block. Each block bit in the difference bitmap also corresponds one-to-one with a data block of the volume, recording the change status of the data block in the current snapshot compared to the previous snapshot. For example, Figure 2 This diagram illustrates how snapshot differences are obtained based on snapshot bitmaps and difference bitmaps in related technologies. For example... Figure 2 As shown, this example uses the need to capture the snapshot difference between the starting snapshot (snap 0) and the target snapshot (snap 2). Starting from the earlier starting snapshot (snap 0), along... Figure 2 The dashed arrows indicate the direction of iteration, proceeding sequentially to the later target snapshot, snap 2. The iteration follows a sequence from snapshots from more distant times to those from more recent times. The difference bitmap of the current snapshot is calculated using the difference bitmap of the snapshot before the current snapshot and the snapshot bitmap of the current snapshot, continuing until the difference bitmap of the target snapshot is obtained. Finally, by analyzing the difference bitmap of the target snapshot, the difference between the starting snapshot and the target snapshot is determined. For example, to calculate the difference bitmap of the current snapshot, snap 1 is calculated using the difference bitmap of the snapshot before snap 1, snap 0, and the snapshot bitmap of the current snapshot. Each block number in the snapshot bitmap and the difference bitmap has a specific meaning, such as... Figure 2 The explanation shown.
[0059] The above calculation method proceeds from the earliest snapshot to the most recent snapshot, starting with the earliest starting snapshot and calculating sequentially up to the target snapshot. The number of snapshots between the starting and target snapshots corresponds to the number of corresponding snapshot bitmaps and difference bitmaps involved in the calculation, ultimately yielding the difference bitmap of the target snapshot to be analyzed. The difference between the two snapshots is obtained by correcting and analyzing the difference bitmap of the target snapshot. This method requires each snapshot to record its corresponding snapshot bitmap and difference bitmap. The bitmap size is related to the number of data blocks and is proportional to the volume capacity. When the volume capacity is large and the number of snapshots is high, the bitmap requires additional storage space. In high-capacity storage (e.g., TB-level) scenarios with sparse actual data writes, the bitmap represents a significant waste. All snapshots between the starting and target snapshots participate in the bitmap calculation. Furthermore, the correction of the difference bitmap of the target snapshot relies on a Cyclic Redundancy Check (CRC) calculation and comparison with the data blocks of the starting snapshot, adding additional system overhead and impacting system stability.
[0060] (3) Starting from the beginning of the volume space, with fixed query intervals, align the queries on each snapshot and gradually search to the end of the volume. Within each query interval, query in the order of the most recent snapshot to the most distant snapshot, starting from the target snapshot and sequentially querying towards the starting snapshot. Similarly, there may be many snapshots at different times between the target snapshot and the starting snapshot. Within a fixed query interval, if there are data blocks in a more recent snapshot that do not contain newly written data, then query those data blocks in the previous more distant snapshot, sequentially moving forward until the starting snapshot is found. For example, Figure 3 This diagram illustrates a method in related technologies that uses a fixed query interval to obtain snapshot differences. For example... Figure 3As shown, for example, the query step size within a fixed query area is 3 data blocks. The query step size can be adjusted and is usually a small value compared to the entire volume range. In step 0, the query range is fixed at [LBA0, LBA2]. If no newly written data is found in data blocks LBA1 and LBA2 on snap 2, then these two blocks need to be queried from the previous snapshot version, snap 1. If no newly written data is found in LBA2 on snap 1, then the query continues to snap 0. After three queries, the differences between the starting snapshot and the target snapshot within the interval [LBA0, LBA2] are A0, B0, and C0, corresponding to data blocks LBA0, LBA1, and LBA2 respectively, constituting the query result of step 0. The query interval within the volume space moves forward with a fixed step size, and then the queries for step 1, step 2, ..., step n are performed sequentially. The query interval corresponding to step 1 is [LBA3, LBA5]. The corresponding query interval for Step 2 is [LBA6, LBA8], and so on, to query the snapshot differences of each query interval.
[0061] In this query method, each fixed query interval requires querying snapshots between the starting and target snapshots. The advantage is that the query range is consistent across multiple snapshot versions, and the query results all correspond to the same interval. Snapshot versions progress with the same query step size, facilitating management and computation. However, this method results in a relatively high number of queries. The disadvantage is that data on snapshots is not always generated sequentially. For cases where random writes result in a more dispersed and sparse distribution of data blocks on snapshot versions, it adds unnecessary query counts. What could have been queried in one go now needs to be split into multiple intervals based on the step size. Figure 4 This diagram illustrates a snapshot difference query technique used in related technologies to address scenarios where data distribution is discrete and sparse due to random writes. For example... Figure 4 As shown, data blocks are scattered across snap 0, snap 1, and snap 2. On snapshot 1, only position LBA8 contains a newly written data block. If a query is performed with a fixed query interval length of 3, the range [LBA0, LBA8] needs to be split into 3 query intervals, requiring 3 queries, which is unnecessary and wasteful. Similar scenarios frequently occur in random writes, reducing the efficiency of differential queries.
[0062] In view of this, embodiments of this application provide a volume snapshot difference query method, comprising: acquiring T snapshots of a volume space in a storage system, wherein the Tth snapshot indicates the change information of a first data state in each storage area of the volume space at time T relative to the change information of a second data state in each storage area of the volume space at time T-1, and T is an integer greater than 1; sequentially querying the change information of each storage area in the T snapshots according to the order of logical block address identifiers of multiple storage areas, and writing the logical block address identifier of the storage area whose data state has changed into the difference cache associated with the corresponding snapshot; determining the smallest address identifier among multiple target address identifiers as the target logical block address identifier, wherein the target address identifier is the largest logical block address identifier in each difference cache; and in response to determining that data in the target storage area of the volume space has been read, returning to execute the snapshot query operation associated with the target logical block address identifier, starting from the target logical block address identifier, until the target logical block address identifier is the end address of the volume space, and the target storage area is the storage area in the difference cache where the logical block address identifier is less than or equal to the target logical block address identifier.
[0063] The following is a description of the technical terms appearing in the embodiments of this application.
[0064] Volume: In a storage system, a logical disk that is presented to the host after abstracting the underlying physical storage resources and can be used like an independent disk.
[0065] Volume space range: The total available address space covered by a volume in a storage system.
[0066] Block: The basic unit for reading and writing in a storage system.
[0067] A snapshot is a copy of a volume or file in a storage system at a specific point in time. It records the complete state of the data at that point, but it is usually not a complete physical copy.
[0068] Snapshot Difference: The set of data blocks that have changed between any two snapshots, precisely recording which data blocks were modified within the snapshot time range.
[0069] Priority Queue: A special queue data structure where the dequeue order is determined by priority, with higher priority queues being dequeued first.
[0070] Diff Cache: A fast, low-cost storage layer that uses memory as a medium to temporarily store the logical block addresses of recently acquired difference data blocks.
[0071] Logical Block Address (LBA): A unique linear number assigned to each block on a storage device.
[0072] Heapification: The process of reshaping an unordered tree structure into one that conforms to the heap property.
[0073] Figure 5 An exemplary system architecture for applying the volume snapshot difference query method and electronic device according to embodiments of this application is illustrated. It should be noted that... Figure 5 The examples shown are merely examples of system architectures that can be applied to the embodiments of this application, in order to help those skilled in the art understand the technical content of this application, but do not mean that the embodiments of this application cannot be used in other devices, systems, environments or scenarios.
[0074] like Figure 5 As shown, the system architecture according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0075] Users can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 via the network 104 to receive or send messages, etc. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social media platform software, etc. (for example only).
[0076] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with displays and support web browsing, including but not limited to smartphones, tablets, laptops, and desktop computers.
[0077] Server 105 can be a server that provides various services, such as a backend management server that supports websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (this is just an example). The backend management server can analyze and process data such as received user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal devices.
[0078] It should be noted that the volume snapshot difference query method provided in this application embodiment can generally be executed by server 105. Correspondingly, the volume snapshot difference query device provided in this application embodiment can generally be located in server 105. The volume snapshot difference query method provided in this application embodiment can also be executed by a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Correspondingly, the volume snapshot difference query device provided in this application embodiment can also be located in a server or server cluster that is different from server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or server 105. Alternatively, the volume snapshot difference query method provided in this application embodiment can also be executed by the first terminal device 101, the second terminal device 102, or the third terminal device 103, or it can be executed by other terminal devices that are different from the first terminal device 101, the second terminal device 102, or the third terminal device 103. Accordingly, the volume snapshot difference query device provided in this application embodiment can also be set in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0079] For example, the T snapshots of the volume space in the storage system can originally be stored in any one of the first terminal device 101, the second terminal device 102, or the third terminal device 103 (e.g., the first terminal device 101, but not limited thereto), or stored on an external storage device and can be imported into the first terminal device 101. Then, the first terminal device 101 can execute the volume snapshot difference query method provided in the embodiments of this application locally, or send the T snapshots of the volume space in the storage system to other terminal devices, servers, or server clusters, and have the other terminal devices, servers, or server clusters that receive the T snapshots of the volume space in the storage system execute the volume snapshot difference query method provided in the embodiments of this application.
[0080] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.
[0081] Figure 6 A flowchart of a volume snapshot difference query method according to an embodiment of this application is shown.
[0082] like Figure 6 As shown, the method includes operations S610 to S620.
[0083] In operation S610, T snapshots of the volume space in the storage system are obtained. The t-th snapshot indicates the change information of the first data state in each storage area of the volume space at time t relative to the second data state in each storage area of the volume space at time t-1, where T is an integer greater than 1, and t=1,…,T.
[0084] According to embodiments of this application, each storage region of a volume space in a storage system can be the smallest management unit for storing data within the volume space. Each smallest management unit can be referred to as a data block or fragment, etc. Each storage region has a unique logical block address identifier. Change information can be information about changes in the data content of a storage region in the volume space at time t relative to time t-1. For example, changes in data content can be newly added data content or modified data content, etc.
[0085] In operation S620, for the t-th snapshot, if the number of logical block addresses written to the difference cache associated with the t-th snapshot meets a predetermined query condition, in response to the target address identifier of the previous round of query ending, the storage area in the t-th snapshot of the current round whose data state has changed is queried, and the logical block address identifier of the storage area whose data state has changed is written to the difference cache. The logical block address identifier written to the difference cache includes the target address identifier indicating the end of the current round of query.
[0086] According to embodiments of this application, the T snapshots may include a starting snapshot, a target snapshot, and multiple intermediate snapshots between the starting snapshot and the target snapshot. The target snapshot is the snapshot closest to the current time, the starting snapshot is the snapshot furthest from the current time, and the intermediate snapshots are located between the starting snapshot and the target snapshot. Each of the T snapshots can be queried independently, following the order from the target snapshot to the starting snapshot and according to the order of the logical block address identifiers of the volume space's storage areas.
[0087] According to embodiments of this application, a difference cache can be a logical block address identifier used to write the storage region whose data state has changed in the volume space relative to the (t-1)th snapshot in the t-th snapshot. Each snapshot maintains its own difference cache associated with that snapshot, and each difference cache is associated with the logical block address identifier of the storage region whose data state has changed in the snapshot associated with that difference cache. The logical block address identifiers of the storage regions in the corresponding snapshot stored in the difference cache are written in order from low address to high address.
[0088] According to embodiments of this application, satisfying predetermined query conditions includes the number of logical block addresses written to the differential cache being less than a predetermined capacity threshold of the differential cache. T differential caches share the same predetermined capacity threshold, which characterizes the number of logical block address identifiers of storage regions whose data state has changed and can be written to the differential cache. For example, the predetermined capacity threshold is K, where K is an integer greater than 1. The management structure of the differential cache associated with each snapshot has the following key attributes: startLBA: the starting LBA for this query; endLBA: the ending LBA for this query; LBANr: the number of LBAs written to the differential cache; cursor: the LBA index used when reading data from the differential cache.
[0089] During the process of querying T snapshots in order from the target snapshot to the starting snapshot, for the t-th snapshot, if the number of logical block addresses written to the difference cache associated with the t-th snapshot meets a predetermined query condition, a volume snapshot difference query is performed on the t-th snapshot. For example, when t=1, for the 1st snapshot, starting from the target address identifier of the previous round of query, the queries are performed sequentially according to the logical block address identifiers of the storage areas in the volume space in ascending order (i.e., from low address to high address). The logical block address identifiers of the storage areas where the data state has changed are written to the difference cache associated with the 1st snapshot until the query termination condition is met, ending the current round of query for the 1st snapshot. The query termination condition can be that the number of logical block address identifiers written to the difference cache is equal to a predetermined capacity threshold, or that the end address of the volume space (i.e., the end of the volume) is found.
[0090] Based on the query method for the first snapshot described above, other snapshots in the T snapshots are queried sequentially from the target snapshot to the starting snapshot. The logical block address identifiers of the storage regions whose data state has changed are written into the difference cache associated with each snapshot until the query termination condition is met, ending the current round of querying each snapshot. It should be noted that when the difference cache is full of K logical block address identifiers of storage regions whose data state has changed, it does not mean that the query interval during the corresponding snapshot query is [LBA x, LBAx + k). When the storage regions whose data state has changed on the snapshot are sparse, querying enough logical block address identifiers of K storage regions whose data state has changed may have already queried a large number of LBAs of the volume space's storage regions. Specifically, for snapshots where the number of logical block address identifiers of storage regions whose data state has changed is less than the predetermined capacity threshold K, a single query reaches the end of the volume; for snapshots where the logical block address identifiers of storage regions whose data state has changed are closely distributed across K consecutive LBAs, the actual number of LBAs of the volume space's storage regions queried after a single query is K.
[0091] According to an embodiment of this application, since the queries are performed in order from low address to high address in the volume space, the last logical block address identifier written at the end of the current round of queries for the t-th snapshot and associated with the t-th snapshot can be used as the target address identifier for the end of the current round of queries. That is, the largest logical block address identifier in the difference cache associated with the t-th snapshot indicates the end position of each snapshot in the current round of queries.
[0092] According to an embodiment of this application, by creating associated differential caches for T snapshots, for the t-th snapshot of the T snapshots, if the number of logical block address identifiers written to the differential cache associated with the t-th snapshot meets a predetermined query condition, in response to the target address identifier at the end of the previous round of query, the storage area in the t-th snapshot of the current round where the data state has changed is queried, and the logical block address identifier of the storage area where the data state has changed is written to the differential cache associated with the t-th snapshot. Since the distribution of storage areas where the data state has changed on each snapshot is random and independent, the query of each snapshot can be pushed forward autonomously within the maximum storage range of the volume space without the need for a fixed unified query interval. The queries between each snapshot do not affect each other. In scenarios where the storage areas where the data state changes in the snapshot are relatively sparse, the number of queries on the snapshot can be reduced, thereby improving query efficiency.
[0093] According to an embodiment of this application, in response to the target address identifier at the end of the previous round of query, starting from the target address identifier at the end of the previous round, the storage area where the data state has changed in the t-th snapshot of the current round is found, and the logical block address identifier of the storage area where the data state has changed is written into the difference cache, including: in response to the target address identifier at the end of the previous round of query, starting from the target address identifier at the end of the previous round, the storage area where the data state has changed in the t-th snapshot of the current round is found, and the logical block address identifier of the storage area where the data state has changed is written into the difference cache, until the number of logical block address identifiers written into the difference cache is equal to a predetermined capacity threshold.
[0094] According to embodiments of this application, satisfying predetermined query conditions includes the following: the number of logical block addresses written to the difference cache is less than a predetermined capacity threshold of the difference cache. It can be considered that the difference cache associated with the t-th snapshot is empty, that is, the number of logical block addresses written is zero; it can also be considered that the difference cache associated with the t-th snapshot is not empty, that is, the number of logical block addresses written is less than the predetermined capacity threshold of the difference cache. For example, if the predetermined capacity threshold is 5, the number of logical block addresses written is 3.
[0095] In one embodiment, when the difference cache associated with the t-th snapshot is empty, the change information of each storage region of each of the T snapshots is queried sequentially, from the target snapshot to the starting snapshot. During the query of each snapshot, for example, when querying the t-th snapshot of the current round, starting from the target address identifier of the previous round of query, and based on the logical block address identifiers of the volume space from low to high address, each storage region of the t-th snapshot is queried. When the number of LBA identifiers of the storage regions where the data state has changed is equal to a predetermined capacity threshold of the difference cache associated with the t-th snapshot, the LBA identifiers queried from the t-th snapshot are written in batches to the difference cache associated with the t-th snapshot according to the LBA order. Accordingly, based on the above query method, all snapshots are queried sequentially.
[0096] In one embodiment, when the difference cache associated with the t-th snapshot is not empty, for example, if the number of logical block address identifiers already written in the difference cache is 3, then the number of empty positions in the difference cache is 2, that is, the number of logical block address identifiers that can still be written is 2. For example, when querying the t-th snapshot of the current round, starting from the target address identifier of the previous round of query, based on the logical block address identifiers of the volume space from low address to high address, each storage area of the t-th snapshot is queried. When the number of LBA identifiers of the storage area where the data state of the queried data has changed is 2, then these 2 logical block address identifiers are written to the difference cache. Accordingly, based on the above query method, all snapshots are queried sequentially.
[0097] It should be noted that during the snapshot query process described above, the logical block address identifiers of the storage regions whose data states have changed can be written into the difference cache before querying the next storage region whose data states have changed. That is, queries are performed and written simultaneously until the number of logical block address identifiers written into the difference cache reaches the predetermined capacity threshold of the difference cache. In this application, no specific limitations are made on the method of writing to the difference cache.
[0098] According to the embodiments of this application, starting from the target address identifier at the end of the previous round of query, the storage area in the t-th snapshot of the current round where the data state has changed is queried to avoid duplicate queries or query omissions; the logical block address identifier when the number of storage areas where the data state has changed reaches the predetermined capacity threshold of the differential cache is written to the corresponding differential cache, until the number of logical block address identifiers written to the differential cache is equal to the predetermined capacity threshold, thereby enabling independent querying of each snapshot, reducing the randomness of addressing and I / O operations during the query of each snapshot, and improving query efficiency.
[0099] According to an embodiment of this application, the method further includes: responding to the target address identifier at the end of the previous round of query as the starting point, querying the storage area where the data state has changed in the t-th snapshot of the current round, and writing the logical block address identifier of the storage area where the data state has changed into the differential cache, until the end address of the volume space is queried.
[0100] According to embodiments of this application, after multiple rounds of queries, when continuing to query the storage areas where data status has changed in the t-th snapshot of the current round, if the number of logical block address identifiers of the storage areas where data status has changed is less than the number that can be written in the difference cache when the termination address of the volume space is found; or if, for snapshots where the storage areas where data status has changed are sparse, and the number of logical block address identifiers of the storage areas where data status has changed in the entire volume space is less than a predetermined capacity threshold K, and the termination address of the volume space is found in a single query, the logical block address identifiers of the storage areas where data status has changed can be written to the difference cache, and the query for the t-th snapshot ends. Based on the above query method, the differences of all snapshots can be queried.
[0101] According to the embodiments of this application, starting from the target address identifier at the end of the previous round of query, the storage area where the data state of the current round of the t-th snapshot has changed is queried to avoid duplicate queries or query omissions; and the logical block address identifier of the storage area where the data state has changed is written into the differential cache until the end address of the volume space is found, so that each snapshot performs queries within its own volume space until the end address of its own volume space is found and then the corresponding snapshot query is no longer executed, thereby allowing the queries on each snapshot version to grow forward autonomously without hindering each other.
[0102] According to an embodiment of this application, the method further includes: if the number of logical block addresses written to the difference cache associated with the t-th snapshot is greater than zero and less than a predetermined capacity threshold of the difference cache, the operation of querying the storage area in the t-th snapshot whose data state has changed, starting from the target address identifier at the end of the previous round of query, is not performed.
[0103] In one embodiment, if the difference cache associated with the t-th snapshot is not empty, it means that there is still data in the storage area of the volume space corresponding to the written logical block address identifier that has not been read. In this case, the query of the t-th snapshot in the current round can be skipped, and only the query of the snapshots associated with the empty difference cache other than the t-th snapshot in the current round can be performed.
[0104] According to an embodiment of this application, after the current round of queries for each snapshot ends, and after the T differential caches associated with each snapshot are filled with logical block address identifiers of storage areas where the data status queried from each snapshot has changed, the minimum address identifier among the maximum logical block address identifiers in each of the T differential caches is determined as the target logical block address identifier. Then, data from the target storage area in the differential cache whose logical block address identifier is less than or equal to the target logical block address identifier is read from the volume space.
[0105] According to an embodiment of this application, after determining that all data in the target storage area whose logical block address identifier in the differential cache is less than or equal to the target logical block address identifier has been read from the volume space, the target address identifier at the end of the current round of query for each snapshot can be used as the starting point for the next round of query for each snapshot, and the next round of query operation for each snapshot can be executed until the end address of the volume space of each snapshot is found, and then the query for each snapshot ends.
[0106] According to the embodiment of the application, when the number of logical block addresses written in the difference cache associated with the t-th snapshot is greater than zero and less than a predetermined capacity threshold, the operation of querying the storage area in the t-th snapshot whose data state has changed, starting from the target address identifier of the previous round of query, can be omitted. This fully utilizes the difference cache of each snapshot, and performs independent forward push queries for each snapshot without affecting each other. As a result, for the corresponding snapshot whose storage area identified by the logical block address written in the difference cache has not been fully read, subsequent queries are not performed, thereby reducing the number of interactions with the volume space and the number of system I / O operations.
[0107] For the aforementioned embodiments, for example, the volume space in the storage system ranges from LBA0 to LBA25, and there are three snapshots of the volume space: a starting snapshot (snap0), an intermediate snapshot (snap1), and a target snapshot (snap2). The starting snapshot is earlier than the target snapshot. By querying the difference between the target snapshot and the starting snapshot in the order from the target snapshot to the starting snapshot, the predetermined capacity threshold K of the difference cache is 5.
[0108] In the current round, which is the first round of querying, the difference caches associated with each snapshot are all empty, and each snapshot meets the predetermined query conditions. Therefore, after performing difference queries on each snapshot, the LBA identifiers of the storage areas where the data status written to the difference cache of snap2 changes are: LBA1, LBA5, LBA9, LBA16, and LBA17; the LBA identifiers of the storage areas where the data status written to the difference cache of snap1 changes are: LBA0, LBA2, LBA4, LBA6, and LBA7; and the LBA identifiers of the storage areas where the data status written to the difference cache of snap0 changes are: LBA0, LBA3, LBA6, LBA9, and LBA11. For the first round of querying, the target address identifier for the end of the current round of querying for snap2 is LBA17; the target address identifier for the end of the current round of querying for snap1 is LBA7; and the target address identifier for the end of the current round of querying for snap0 is LBA11. The smallest address identifier among the largest logical block address identifiers of the three difference caches is determined as the target logical block address identifier, i.e., LBA7.
[0109] After reading data from the volume space within a storage region less than or equal to LBA7, the logical block address identifiers written to each difference cache are as follows: The LBA identifiers of the storage regions where the data status of the data written to the difference cache of snap2 changes are: LBA9, LBA16, and LBA17; the LBA identifiers of the storage regions where the data status of the data written to the difference cache of snap1 changes are: empty; the LBA identifiers of the storage regions where the data status of the data written to the difference cache of snap0 changes are: LBA9 and LBA11.
[0110] During the second round of queries, if the number of logical block addresses written to the differential cache associated with each snapshot meets a predetermined query condition, in one embodiment, the target address identifier of each snapshot at the end of the first round of queries can be used as the starting point for the second round of queries. The logical block address identifiers of storage areas where the data state has changed in each snapshot in the second round of queries are written into the differential cache associated with each snapshot until a predetermined capacity threshold for the differential cache is reached. Then, based on the method of reading data after the first round of queries, the target logical block address identifier corresponding to the second round is determined. After reading data from the volume space within the storage area less than or equal to the target logical block address identifier corresponding to the second round of queries, the next round of queries for each snapshot is queried, starting from the target address identifier at the end of the second round of queries, until the end address of the volume space for each snapshot is found, thus ending the queries for all snapshots. In one embodiment, during the second round of queries, if logical block address identifiers still exist in the difference cache associated with each snapshot after the first round of queries, it indicates that there are still storage areas in the difference cache where logical block address identifiers have not been read. Therefore, during the second round of queries, only the snapshots associated with empty difference caches (i.e., snapshot snap1) are queried, and the snapshots associated with a number of logical block addresses written to the difference cache that are greater than zero and less than a predetermined capacity threshold of the difference cache are not queried. That is, snapshots snap2 and snap0 do not participate in the second round of queries. In another embodiment, during the second round of queries, for example, if the end address of the volume space of snapshot snap0 is found, and the logical block address identifiers of the storage areas where the data state has changed have not yet reached the predetermined capacity threshold after being written to the difference cache associated with snap0, it indicates that the query for snapshot snap0 has ended. In subsequent queries, snap0 is no longer queried; only the remaining snapshots are queried.
[0111] Based on the above query method, continue querying until the end address of the volume space of each snapshot is found. At this point, the query for all the above snapshots is completed, and the difference between the target snapshot snap2 and the starting snapshot snap0 is obtained.
[0112] According to embodiments of this application, by determining the minimum address among the maximum logical block address identifiers of T difference caches as the target logical block address identifier, and using this target logical block address identifier as the target storage area for reading data from the volume space, it is ensured that data in storage areas within the cache differences that are less than or equal to the target logical block address identifier are not missed during the reading process, and that the read data is the latest. (Each snapshot)
[0113] It should be noted that the logical block address identifier can be one embodiment representing the data storage area, or it can be used according to actual needs. When the state of other data describing data or metadata changes and a difference query is required, other single identifiers or combinations of identifiers representing data or metadata can be used. Based on preset rules, the size of the single identifiers or combinations of identifiers can be compared, and the identifiers can be stored in the difference cache of the corresponding snapshot. The snapshot difference query method of this volume can be used to realize the query of snapshot differences.
[0114] Figure 7 A schematic diagram of a volume snapshot difference query method according to an embodiment of this application is shown; Figure 8 A schematic diagram of a difference cache associated with a corresponding snapshot according to an embodiment of this application is shown.
[0115] Example Explanation: Taking the entire volume space from the start address to the end address as LBA0~LBA25 as an example, the data distribution and query process on snapshots 0, 1, and 2 are shown after three snapshots of the volume space. Snap 0 is the starting snapshot, which is farther from the current time; snapshot 2 is the target snapshot, which is closer to the current time; and snapshot 1 is the intermediate snapshot, which is between the farther and closer times. The storage area in snapshot 0 where the data state has changed is determined relative to the baseline snapshot of the volume space. The predetermined capacity threshold K of the differential cache associated with each snapshot is 5.
[0116] like Figure 7 As shown, in this query, the order is from the target snapshot to the starting snapshot, and from the low address to the high-low address of the volume space, according to the logical block address identifiers of multiple storage regions in the volume space. A blank cell indicates that the storage region in that snapshot has not had any data state change information written compared to the previous snapshot; a non-blank cell indicates that the storage region in that snapshot has had data state change information compared to the previous snapshot. For the first query, the difference cache associated with each snapshot is empty, and each snapshot meets the predetermined query conditions. Starting from LBA0 of the volume space, the logical block address identifiers of the storage regions whose data state has changed in each of the three snapshots are queried sequentially, and the logical block address identifiers of the storage regions whose data state has changed are written to the difference cache of each snapshot in address order until the predetermined capacity threshold of the difference cache is reached. From Figure 7 As can be seen from the first query process:
[0117] The logical block address identifiers of the storage areas whose data status has changed as queried by snapshot2 and written to the corresponding difference cache are: LBA1, LBA5, LBA9, LBA16 and LBA17.
[0118] The logical block addresses of the storage regions whose data status has changed as queried by snapshot1 and written to the corresponding difference cache are: LBA0, LBA2, LBA4, LBA6 and LBA7.
[0119] The logical block addresses of the storage regions whose data status has changed as queried by snapshot0 and written to the corresponding difference cache are: LBA0, LBA3, LBA6, LBA9, and LBA11.
[0120] A diagram illustrating the difference cache associated with each snapshot is shown below. Figure 8 As shown, each difference cache has a corresponding cache management structure. From the management structure, we can see the starting LBA, ending LBA, the number of LBAs written to the difference cache, and the LBA index when reading data from the difference cache for each snapshot. The maximum logical block address in each difference cache is the LBA identifier at the end of the first query. This maximum logical block address is used as the target address identifier in each cache, that is, the target address identifier at the end of the first query. For example, the target address identifier in the difference cache of snapshot snap2 is LBA17, the target address identifier in the difference cache of snapshot snap1 is LBA7, and the target address identifier in the difference cache of snapshot snap0 is LBA11. The smallest address identifier among these three target address identifiers, LBA7, is used as the target logical block address identifier. Based on the target logical block address identifier LBA7, data is read from the storage areas of logical block address identifiers less than or equal to LBA7 in the difference caches of the three snapshots. Specifically, the storage areas of LBA1 and LBA5 in the difference cache of snapshot 2, the storage areas of LBA0, LBA2, LBA4, LBA6, and LBA7 in the difference cache of snapshot 1, and the storage areas of LBA0, LBA3, and LBA6 in the difference cache of snapshot 0 are used as the target storage areas of the volume space, and data in these target storage areas is read. In response to the data in the target storage area of the volume space being read, a second query of each snapshot of the volume space is performed.
[0121] For the second query, if the number of logical block addresses written to the difference cache associated with each snapshot meets the predetermined query conditions, it can be implemented in two ways. The first way is as follows: After the first query, the data in the storage area of LBAs less than or equal to the target logical block address identifier LBA7 has been read. Therefore, the difference caches corresponding to snapshots snap0 and snap2 still have usable LBAs, indicating that the data in the storage area of usable LBAs in the difference caches corresponding to snapshots snap0 and snap2 has not been read. In this case, snapshots snap0 and snap2 do not participate in the second query. The data in the storage area of the LBAs in the difference cache corresponding to snapshot snap1 has been read, and there are no usable LBAs; therefore, snapshot snap1 participates in the second query. Starting with the target logical block address identifier LBA7 (i.e., the target address identifier where the first round of queries for snapshot 1 ends), the query begins from the next logical block address identifier LBA8 in snapshot 1. It queries the LBAs of storage regions in snapshot 1 where the data state has changed, and writes these LBAs to the differential cache associated with snapshot 1. This process continues until a predetermined capacity threshold of 5 is reached, at which point the second query for snapshot 1 ends. At this point, for the second query, the LBA identifiers written to the differential caches associated with each snapshot are:
[0122] The LBA identifiers in the differential cache of snapshot2 are: LBA9, LBA16, and LBA17;
[0123] The LBA identifiers in the differential cache of snapshot 1 are: LBA10, LBA12, LBA14, LBA18, and LBA19;
[0124] The LBA identifiers in the differential cache of snapshot 0 are LBA9 and LBA11.
[0125] Based on the largest logical block address identifier determined from the differential caches associated with each snapshot in the first query, and using the method of determining the target logical block address identifier from the target address identifier in the first query, the target logical block address identifier in the second query is determined to be LBA11. After the data in the storage area with a target logical block address identifier of LBA11 has been read, the third query is executed.
[0126] The second method: After the first query, all data in the storage areas with LBAs less than or equal to the target logical block address identifier LBA7 has been read. Following the order from the target snapshot to the starting snapshot, the target address identifier of each snapshot at the end of the first round of queries is used as the starting point for the second round of queries. Following the query order from low address to high address in each snapshot, the logical block address identifiers of the storage areas whose data state has changed in each snapshot in the second round are written into the differential cache associated with each snapshot, until the predetermined capacity threshold of the differential cache is reached. Specifically, since the differential cache corresponding to snapshot 2 still has usable LBAs, when querying snapshot 2 for the second time, starting from the target address identifier LBA17 at the end of the first query for snapshot 2, the query begins from LBA18, and the LBAs of the storage areas whose data state has changed are written into the differential cache associated with snapshot 2, until the predetermined capacity threshold 5 is reached. Therefore:
[0127] The LBA identifiers for the differential cache associated with snapshot 2 are: LBA9, LBA16, LBA17, LBA20, and LBA24.
[0128] If all LBAs in the difference cache corresponding to snapshot 1 have been used, then starting from the target address identifier LBA7 (which is also the target logical block address identifier) at the end of the first query of snapshot 1, the query begins from the next logical block address identifier LBA8, and the LBAs are written to the difference cache associated with snapshot 1, until the predetermined capacity threshold 5 is reached.
[0129] The LBA identifiers in the differential cache of snapshot 1 are: LBA10, LBA12, LBA14, LBA18, and LBA19;
[0130] Since the differential cache corresponding to snapshot 0 still has usable LBAs, when querying snapshot 0 for the second time, starting from the target address identifier LBA11 where the first query ended, the query begins from LBA12, and the LBAs of the storage areas where the data state has changed are written to the differential cache associated with snapshot 0, until the predetermined capacity threshold of 5 is reached:
[0131] The LBA identifiers of the differential cache associated with snapshot0 are: LBA9, LBA11, and LBA15;
[0132] Since the data status of the storage area LBA15 changed when querying snap0 was changed and written to the associated differential cache before the predetermined capacity threshold was reached, the query of the storage area of snap0 continued until the end address LBA25 of the volume space of snap0 was found. Even if no storage area with changed data status was found at the end address LBA25 of the volume space, the second query of snap0 ended even though the predetermined capacity threshold 5 of the associated differential cache had not been reached. Subsequent queries for snap0 will no longer participate.
[0133] Based on the largest logical block address identifier determined from the differential caches associated with each snapshot in the first query, and using the target logical block address identifier determined from the target address identifier in the first query, the target logical block address identifier in the second query is determined to be LBA15. After the data in the storage area with a target logical block address identifier of LBA15 has been read, the third query is executed.
[0134] For the third query, it can be implemented using either of the two implementation methods described above for the second query. For example, taking the first method as an example: after the second query, the data in the storage area of LBAs less than or equal to the target logical block address identifier LBA11 has been read. Therefore, it can be seen that the difference caches corresponding to snapshots snap1 and snap2 still have usable LBAs, indicating that there is still data in the storage area of usable LBAs in the difference caches corresponding to snapshots snap1 and snap2 that has not been read. At this time, snapshots snap1 and snap2 do not participate in the third query; the data in the storage area of LBAs in the difference cache corresponding to snapshot snap0 has been read, and there are no usable LBAs. Snapshot snap0 participates in the third query. Starting with the target logical block address identifier LBA11, the query begins from the next logical block address identifier LBA12, associated with the target logical block address identifier LBA11. It queries the LBAs of storage regions in snapshot 0 whose data status has changed, and writes these LBAs to the differential cache associated with snapshot 0. This process continues until a predetermined capacity threshold of 5 is reached, or until the predetermined capacity threshold of 5 is reached but the volume space range termination address LBA25 is reached. At this point, the LBA identifiers in the differential cache of snapshot 0 still include the volume space termination address identifier LBA25, indicating that snapshot 0 has been completely queried, and the query for snapshot 0 ends, without participating in any subsequent rounds of querying. Therefore, for the third query, the LBA identifiers written to the differential caches associated with each snapshot are:
[0135] The LBA identifiers in the differential cache of snapshot2 are: LBA16 and LBA17;
[0136] The LBA identifiers in the differential cache of snapshot 1 are: LBA12, LBA14, LBA18, and LBA19;
[0137] The LBA identifiers in the differential cache of snapshot 0 are LBA15 and LBA25.
[0138] Based on the method of determining the target address identifier from the difference cache associated with each snapshot in the first query, and then using the smallest address identifier among the target address identifiers as the target logical block address identifier for the first query, the target logical block address identifier in the third query is determined to be LBA17. After the data in the storage area smaller than the target logical block address identifier LBA17 has been read, the fourth query is executed until the target logical block address reaches the end address LBA25 of the volume space, thus completing the query of the snapshot difference of the volume space.
[0139] Based on the premise of executing the third query using the first of the two implementation methods for the second query mentioned above, and considering the target logical block address identifier determined in each query, it can be determined whether the corresponding snapshot in each query needs to be statistically analyzed in this query. Table 1 shows the location update of the target logical block address during each query and the statistics on whether each snapshot needs to be queried in each query.
[0140] As shown in Table 1:
[0141]
[0142] As shown in Table 1, the table lists the updates to the minimum ending address identifier (i.e., the target logical block address) and statistics on whether the corresponding snapshot needs to be queried again in each round of queries. After the first query, the minimum ending position is equal to LBA8. LBAs before LBA8 are applied and merged. All LBAs in the cache corresponding to snap 1 are then applied, while the caches corresponding to snap 0 and snap 2 still have usable LBAs that can be retained. Therefore, snap 0 and snap 2 do not need to participate in the second query. This process continues for the third...xth query, until the minimum ending position (i.e., the target logical block address) reaches the ending address identifier of the volume space.
[0143] For the third query, the second of the two implementation methods is used. Its specific implementation process is similar to the second implementation method of the second query described above, continuing until the end address LBA25 of the snapshot volume space is found, thus completing the query for the snapshot differences of the volume space. This application will not elaborate further on this point.
[0144] According to an embodiment of this application, the above method further includes: reading candidate logical block address identifiers whose logical block address identifiers are less than or equal to the target logical block address identifier from the difference cache associated with each snapshot, based on the target logical block address identifier; sorting the candidate logical block address identifiers in the T difference caches to obtain an address sequence of the data to be read, wherein the target logical block address identifier is the smallest address identifier among the target address identifiers at the end of the current round of query corresponding to each of the T snapshots.
[0145] According to embodiments of this disclosure, candidate logical block address identifiers are determined from the differential caches associated with each of the T snapshots. These identifiers can be used to construct an address sequence of data to be read. Based on the sorting of the candidate logical block address identifiers within the address sequence of the data to be read, data can be read in an ordered manner from the storage areas of the candidate logical block address identifiers within the volume space of the storage system.
[0146] According to an embodiment of this application, by sorting the candidate logical block address identifiers in T differential caches, an address sequence of data to be read is obtained, and data is read from the storage area of the volume space based on the address sequence of the data to be read, so as to ensure the accuracy and timeliness of reading data.
[0147] According to an embodiment of this application, sorting the candidate logical block address identifiers in T difference caches to obtain the address sequence of the data to be read includes: extracting target candidate logical block address identifiers from the candidate logical block address identifiers in the T difference caches and sorting them; taking the target candidate logical block address identifier at the top as the dequeue element, the dequeue element is used to read data from the target storage area of the volume space, and the target candidate logical block address identifier represents the smallest candidate logical block address identifier in each difference cache; taking the smallest candidate logical block address identifier belonging to the same difference cache as the dequeue element from the remaining candidate logical block address identifiers in the T difference caches as the enqueue element to obtain the address sequence of the data to be read.
[0148] According to an embodiment of this application, the target candidate logical block address identifier can be selected from T candidate logical block address identifiers in the difference cache. The obtained target candidate logical block address identifiers are sorted based on a sorting rule. The sorting can be based on a priority sorting rule, placing the target candidate logical block address identifier with the highest priority at the beginning of the address sequence of the data to be read, and placing the target candidate logical block address identifier with the lowest priority at the end of the address sequence of the data to be read.
[0149] According to an embodiment of this application, during data reading, the top-ranked target candidate logical block address identifier can be used as a dequeue element. The dequeue element comprises the target candidate logical block address identifier and the difference cache identifier to which the dequeue element belongs. Based on the composition of the dequeue element, a corresponding snapshot can be determined from the difference cache to which the dequeue element belongs. Then, based on the target candidate logical block address identifier corresponding to the dequeue element, data can be read from the storage area of the target candidate logical block address identifier in the corresponding snapshot.
[0150] According to embodiments of this application, for each element dequeued, a corresponding snapshot can be determined from the differential cache to which the dequeued element belongs; then, based on the target candidate logical block address identifier corresponding to the dequeued element, data can be read from the storage area of the target candidate logical block address identifier in the corresponding snapshot. Alternatively, for each element dequeued, the target candidate logical block address identifier in the snapshot corresponding to the dequeued element can be temporarily recorded; after dequeuing another element, it can be determined whether the target candidate logical block address identifiers corresponding to the two dequeued elements are consecutive. If they are consecutive, the data can be read from the storage area of the target candidate logical block address identifiers corresponding to the two dequeued elements.
[0151] According to an embodiment of this application, after a dequeue element is dequeued, an enqueue element needs to be determined to construct a new address sequence of data to be read. The enqueue element is determined based on the smallest identifier among the remaining candidate logical block address identifiers in the differential cache to which the dequeue element belongs.
[0152] According to the embodiments of this application, by sorting the target candidate logical block address identifiers and dynamically replacing the dequeue and enqueue elements, the address sequence of the data to be read is dynamically obtained, ensuring that the storage area of the newest snapshot is always read, thus ensuring the accuracy of the read data.
[0153] According to an embodiment of this application, selecting and sorting a target candidate logical block address identifier from candidate logical block address identifiers in T difference caches includes: using the target candidate logical block address identifier selected from the candidate logical block address identifiers associated with T snapshots as a queue element of a priority queue, wherein the queue element in the priority queue comprises the target candidate logical block address identifier and the hierarchy identifier of the difference cache to which the target candidate logical block address identifier is written; and sorting the queue elements of the priority queue according to the target candidate logical block address identifier and the hierarchy identifier of the difference cache to which the target candidate logical block address identifier is written.
[0154] According to an embodiment of this application, following the order from the target snapshot to the starting snapshot, the T difference caches are first marked with the difference cache level identifier, and then the candidate logical block address identifiers in the difference cache corresponding to the level identifier of each difference cache are marked as different indexes in ascending order.
[0155] Based on the hierarchical identifiers and indexes of the differential cache described above, a priority queue is constructed using the target candidate logical block address identifiers selected from the candidate logical block address identifiers associated with T snapshots as queue elements.
[0156] The queue elements of the priority queue consist of three key attributes: LBA: the address identifier of the candidate logical block in the difference cache; Level identifier: the level at which the LBA is located; and Index: the index of the difference cache where the LBA is located.
[0157] According to embodiments of this application, the elements of a priority queue can be sorted based on priority rules. These priority rules can be: 1) when LBA values are unequal, the smaller LBA value takes precedence; 2) when LBA values are equal, the higher Level value takes precedence.
[0158] Figure 9 A schematic diagram illustrating the priority queue rules and basic operations according to an embodiment of this application is shown.
[0159] like Figure 9 As shown, the elements of a priority queue consist of an LBA, a Level identifier, and an Index. The queue elements are sorted based on priority rules. After dequeuing the sorted priority queue, an enqueue operation is performed, and the resulting priority queue is sorted again before dequeuing to obtain a dynamic sequence of addresses for the data to be read.
[0160] According to embodiments of this application, for example, the aforementioned... Figure 7 The logical block address identifiers in the difference cache of the corresponding snapshot obtained after the first query that are less than or equal to the target logical block address identifier LBA7 are used as candidate logical block address identifiers. The candidate logical block address identifiers in the cache difference of the corresponding snapshot are:
[0161] The candidate logical block addresses in the differential cache of snapshot 2 are identified as LBA1 and LBA5, and their level is identified as Level 2.
[0162] The candidate logical block addresses in the differential cache of snapshot 1 are identified as LBA0, LBA2, LBA4, LBA6, and LBA7, and their level is identified as Level 1.
[0163] The candidate logical block addresses in the difference cache of snapshot 0 are identified as LBA0, LBA3, and LBA6, and their level is identified as Level 0.
[0164] In one embodiment, the first candidate logical block address identifiers LBA1, LBA0, and LBA0 of each of the above-mentioned differential caches are used as queue elements to construct an initial priority queue, namely, (LBA1, Level 2), (LBA0, Level 1), and (LBA0, Level 0). Based on the above priority rules, when LBAs are not equal, the smaller LBA value takes precedence. The first candidate logical block address identifiers LBA1, LBA0, and LBA0 of each differential cache are sorted to obtain (LBA0, Level 1), (LBA0, Level 0), and (LBA1, Level 2). Then, based on the principle that when LBAs are equal, the larger Level value takes precedence. Since the first LBA0 belongs to Level 1 and the second LBA0 belongs to Level 0, the larger Level value is given priority. Therefore, the sorted priority queue is: (LBA0, Level 1), (LBA0, Level 0), and (LBA1, Level 2), which is the address sequence of the data to be read.
[0165] According to embodiments of this application, by constructing the composition attributes of queue elements of a priority queue and sorting the queue elements based on the composition attributes of the queue elements, it is ensured that data in the volume space storage area is read in an orderly manner, avoiding system instability caused by out-of-order reading, while ensuring the accuracy of the read data and that the data read is from the latest snapshot.
[0166] According to an embodiment of this application, from the remaining candidate logical block address identifiers in T difference caches, the smallest candidate logical block address identifier belonging to the same difference cache as the dequeued element is taken as the enqueue element, including: determining the difference cache associated with the dequeued element from the T difference caches based on the dequeued element; if there is a candidate logical block identifier in the difference cache associated with the dequeued element, taking the smallest candidate logical block address identifier belonging to the same difference cache as the dequeued element as the target candidate logical block address identifier, and adding the target candidate logical block address identifier as the enqueue element to the tail of the queue.
[0167] According to an embodiment of this application, since the dequeue element includes the target candidate logical block address identifier and the level identifier of the target candidate logical block address identifier difference cache, it is possible to know the cache difference to which the target candidate logical block address identifier belongs. For example, in the above sorted address sequence of data to be read (LBA0, Level 1), (LBA0, Level 0), (LBA1, Level 2), (LBA0, Level 1) is used as the dequeue element. Based on Level 1 in the dequeue element, the smallest address identifier can be selected from the remaining candidate logical block address identifiers in the Level 1 difference cache as the enqueue element, i.e., (LBA2, Level 1), and placed at the tail of the priority queue to generate the address sequence of data to be read.
[0168] According to an embodiment of this application, the queue element may further include the index of the differential cache where the LBA is located and the level identifier of the differential cache layer. For example, the queue element may also be represented as (LBA0, Level 1, Index1). (LBA0, Level 1, Index1) in the address sequence of the sorted data to be read is used as the dequeue element. Based on the index Index1 of the level identifier Level 1 of the differential cache layer to which LBA0 belongs, the candidate logical block identifier with the next index Index2 of the level identifier Level 1 of LBA0 is used as the enqueue element.
[0169] According to the embodiments of this application, the corresponding difference cache is quickly associated with the dequeue element, and the smallest candidate logical block address identifier of the associated corresponding difference cache is used as the enqueue element of the priority queue, thereby improving the lookup efficiency of the logical block address identifier to be read, ensuring that the logical block address identifier in the difference cache is not missed, and thus ensuring the accuracy of the read data.
[0170] According to an embodiment of this application, the method further includes: if the logical block address identifiers of the storage regions whose data state has changed in the t-th snapshot are found to be consecutive, writing the logical block address identifiers of the storage regions whose data state has changed in the t snapshots to the difference cache associated with each of the t snapshots, and terminating the query operation for all snapshots after the t-th snapshot, where 1 < t ≤ T. According to an embodiment of this application, during the independent query process in the order of each snapshot version from the target time to the start time, if the logical block address identifiers of the storage regions whose data state has changed in a certain snapshot are consecutive, then this query does not need to query snapshot versions earlier than that snapshot time.
[0171] Figure 10 This diagram illustrates that the logical block address identifiers of a storage region whose data state has changed according to an embodiment of this application are continuous in the t-th snapshot.
[0172] like Figure 10 As shown, if the logical block address identifiers of the storage area whose data state has changed exist consecutively for K times in snapshot 1 (i.e., reaching the predetermined capacity threshold of the differential cache, assuming K=5), then snapshot 0 will not be queried this time. The determination of the minimum ending address identifier (i.e., the target logical block address identifier) is only performed in snapshot 2 and snapshot 1. This can further reduce the number of queries and improve efficiency.
[0173] According to an embodiment of this application, if the logical block address identifiers of storage areas where the data state has changed during the query process are consecutive when querying a snapshot, then there is no need to query subsequent snapshots, thereby further reducing the number of queries and improving query efficiency.
[0174] Figure 11 A schematic diagram illustrating the dequeueing and enqueueing of the address sequence of data to be read according to an embodiment of this application is shown.
[0175] like Figure 11 As shown, the candidate logical block address identifiers for each differential cache are determined based on the target logical block address identifier after the first query (e.g., Figure 11 middle (Partial), and mark the candidate logical block address identifiers of each difference cache with difference cache level identifiers and indexes. The difference cache level identifiers correspond to snapshots. For example, the difference cache with the Level 1 level identifier corresponds to snapshot 1.
[0176] The first candidate logical block address identifiers LBA1, LBA0, and LBA0 of each differential cache are used as target candidate logical block address identifiers to construct a priority queue. The queue elements include: (LBA1, Level 2, Index0), (LBA0, Level 1, Index0), and (LBA0, Level 0, Index0). (e.g.) Figure 11 middle finger (The dashed lines in step 1 of the text) Based on the rule that when LBA values are unequal, the smaller LBA value takes precedence, and when LBA values are equal, the larger Level value takes precedence, the priority queue elements in step 1 are sorted (e.g., ...). Figure 11 middle finger (The dotted line in step 2 of the text) Place the highest priority element at the front of the priority queue and the lowest priority element at the back, resulting in the address sequence of the data to be read: (LBA0, Level 1, Index0), (LBA0, Level 0, Index0), (LBA1, Level 2, Index0). Then, remove the highest priority element (LBA0, Level 1, Index0) from the front of the queue as the dequeue element. Figure 11 middle Step 3 in this section involves determining the corresponding snapshot (snap1) based on the target candidate logical block address identifier (LBA0) and the level identifier (Level 1) of the difference cache included in the dequeued element. Data for the corresponding snapshot (snap1) is then read from the storage area of the volume space based on the target candidate logical block address identifier (LBA0). Simultaneously, if there are address identifiers in the difference cache layer to which the dequeued element belongs that are less than or equal to the target logical block address identifier, the next candidate logical block address identifier in the difference cache layer to which the dequeued element belongs is determined based on the level identifier (Level 1) and Index 0. This next candidate logical block address identifier is then added to the priority queue (LBA2, Level 1, Index 1), resulting in a new priority queue. This new priority queue is then sorted to obtain a new sequence of addresses to be read, continuing until all data in the storage areas of the candidate logical block address identifiers has been read. It should be noted that after (LBA0, Level 1, Index0) is removed from the head of the queue as a dequeue element, the data in the LBA0 storage area of the next higher priority queue element (LBA0, Level 0, Index0) corresponding to Level 0 is not the latest data. Therefore, it can be directly removed from the priority queue, and the enqueue element is determined based on the removed queue element.
[0177] Figure 12 A schematic diagram illustrating the independent query of snapshot differences according to an embodiment of this application is shown.
[0178] like Figure 12As shown, the process involves: obtaining T snapshots of the volume space in the storage system (S1201); for the t-th snapshot, determining whether the number of logical block addresses written to the differential cache associated with the t-th snapshot meets a predetermined query condition (S1202); if not, not executing the current round of query operation for the t-th snapshot (S1203); if so, starting from the target address identifier of the previous round of query, querying the storage region in the current round of the t-th snapshot where the data state has changed (S1204); writing the logical block address identifiers of the storage region where the data state has changed into the differential cache associated with the t-th snapshot (S1205); determining whether the number of logical block address identifiers written to the differential cache is equal to the predetermined capacity threshold of the differential cache (S1206); if not, continuing to execute the current round of query operation for the t-th snapshot. The previous round of query operations continues until the value equals the predetermined capacity threshold of the differential cache (S1207). If so, the current round of query for the t-th snapshot is stopped, and the current round of query for the T snapshots is completed sequentially (S1208). Data of the target storage area of the volume space that is less than or equal to the target logical block address determined from the smallest address identifier among the largest logical block address identifiers in the respective T differential caches is read (S1209). It is determined whether the data in the target storage area has been completely read (S1210). If not, reading continues until it is completely read and the next round of query is executed (S1211). If it has been completely read, the process returns to execute (S1202~S1210). The query operation for each snapshot of the volume space ends (S1212) when the termination address of the volume space is found for each snapshot.
[0179] Figure 13 A schematic diagram illustrating the dequeue and enqueue operations of a sequence of addresses to be read constructed based on the target logical block address identifier according to an embodiment of this application.
[0180] like Figure 13As shown, the minimum address identifier among the maximum logical block address identifiers of the difference cache associated with the corresponding snapshot is determined as the target logical block address identifier (S1301); and candidate logical block address identifiers in each difference cache are determined based on the target logical block address identifier (S1302); the first candidate logical block address identifier in the difference cache corresponding to each cache identifier is taken as a queue element and added to the priority queue (S1303); according to the priority rules, the first candidate logical block address identifiers corresponding to each difference cache are sorted (S1304); the highest priority is placed at the head of the queue, and the lowest priority is placed at the tail of the queue. The first element is dequeued, and data is read from the storage area of the logical block address identifier of the corresponding snapshot based on the composition of the dequeued element. The LBA index for data reading in the difference cache is updated (S1305). It is determined whether the dequeued element has a next candidate logical block address identifier that is smaller than the target logical block address identifier (S1306). If so, the next candidate logical block address identifier is added to the tail of the queue as an enqueue element (S1307), and then S1304 is executed. If not, it is determined whether the priority queue is empty (S1308). If it is empty, the process ends (S1309). If it is not empty, S1305 is executed.
[0181] Figure 14 A block diagram of a volume snapshot difference query apparatus according to an embodiment of this application is shown.
[0182] like Figure 14 As shown, the volume snapshot difference query device 1400 includes: a snapshot acquisition module 1401 and a first address identifier writing module 1402.
[0183] The snapshot acquisition module 1401 is used to acquire T snapshots of the volume space in the storage system. The Tt-th snapshot indicates the change information of the first data state in each storage area of the volume space at time Tt relative to the second data state in each storage area of the volume space at time Tt-1. T is an integer greater than 1, and t=1,...,T.
[0184] The first address identifier writing module 1402 is used to, for the t-th snapshot, if the number of logical block addresses written to the difference cache associated with the t-th snapshot meets a predetermined query condition, and in response to the target address identifier of the end of the previous round of query, query the storage area in the t-th snapshot of the current round where the data state has changed, and write the logical block address identifier of the storage area where the data state has changed into the difference cache. The logical block address identifier written into the difference cache includes the target address identifier indicating the end of the current round of query.
[0185] According to an embodiment of this application, the first address identifier writing module 1402 includes an address identifier writing submodule.
[0186] The address identifier writing submodule is used to query the storage area whose data status has changed in the t-th snapshot of the current round, starting from the target address identifier that responds to the end of the previous round of query, and write the logical block address identifier of the storage area whose data status has changed into the differential cache, until the number of logical block address identifiers written into the differential cache is equal to the predetermined capacity threshold.
[0187] According to an embodiment of this application, the device 1400 further includes a second address identifier writing module.
[0188] The second address identifier writing module is used to respond to the target address identifier at the end of the previous round of query, to query the storage area where the data status has changed in the t-th snapshot of the current round, and write the logical block address identifier of the storage area where the data status has changed into the differential cache, until the end address of the volume space is queried.
[0189] According to an embodiment of this application, the device 1400 further includes: an execution judgment module.
[0190] The execution judgment module is used to prevent the operation of querying the storage area in the t-th snapshot whose data status has changed, starting from the target address identifier at the end of the previous round of query, if the number of logical block addresses written to the difference cache associated with the t-th snapshot is greater than zero and less than the predetermined capacity threshold of the difference cache.
[0191] According to an embodiment of this application, the above-mentioned device 1400 further includes: an address identifier reading module and an address identifier sorting module.
[0192] The address identifier reading module is used to read candidate logical block address identifiers that are less than or equal to the target logical block address identifier from the difference cache associated with each snapshot, based on the target logical block address identifier. The target logical block address identifier is the smallest address identifier among the target address identifiers at the end of the current round of queries for each of the T snapshots.
[0193] The address identifier sorting module is used to sort the address identifiers of candidate logical blocks in T difference caches to obtain the address sequence of the data to be read.
[0194] According to an embodiment of this application, the address identifier sorting module includes: a dequeue element determination submodule and an enqueue element determination submodule.
[0195] The dequeue element determination submodule is used to extract the target candidate logical block address identifiers from the candidate logical block address identifiers in T difference caches and sort them. The target candidate logical block address identifier at the top is used as the dequeue element. The dequeue element is used to read data from the target storage area of the volume space. The target candidate logical block address identifier represents the smallest candidate logical block address identifier in each difference cache.
[0196] The enqueue element determination submodule is used to select the smallest candidate logical block address that belongs to the same difference cache as the dequeue element from the remaining candidate logical block address identifiers in the T difference caches as the enqueue element, so as to obtain the address sequence of the data to be read.
[0197] According to an embodiment of this application, the dequeue element determination submodule includes:
[0198] The queue element determination unit is used to select the target candidate logical block address identifier from the candidate logical block address identifiers associated with T snapshots as the queue element of the priority queue. The queue element in the priority queue consists of the target candidate logical block address identifier and the hierarchy identifier of the difference cache written to the target candidate logical block address identifier.
[0199] The queue element sorting unit is used to sort the queue elements of the priority queue according to the target candidate logical block address identifier and the hierarchical identifier of the difference cache written to the target candidate logical block address identifier.
[0200] According to an embodiment of this application, the enqueue element determination submodule includes: a difference cache determination unit and an enqueue element determination unit.
[0201] The difference cache determination unit is used to determine the difference cache associated with the dequeued element from T difference caches based on the dequeued element.
[0202] The enqueue element determination unit is used to determine the smallest candidate logical block address identifier that belongs to the same difference cache as the dequeue element when there is a candidate logical block identifier in the difference cache associated with the dequeue element, and to add the target candidate logical block address identifier as the enqueue element to the tail of the queue.
[0203] According to an embodiment of this application, the above-described device 1400 further includes an address identifier writing module.
[0204] The address identifier writing module is used to write the logical block address identifiers of the storage areas whose data status has changed in the t-th snapshot to the difference cache associated with each of the t snapshots when the logical block address identifiers of the storage areas whose data status has changed in the t-th snapshot are consecutive, thereby terminating the query operation for all snapshots after the t-th snapshot, where 1 < t ≤ T.
[0205] Any one or more of the modules, submodules, and units according to the embodiments of this application, or at least part of the functions of any one or more of them, can be implemented in one module. Any one or more of the modules, submodules, and units according to the embodiments of this application can be implemented by dividing them into multiple modules. Any one or more of the modules, submodules, and units according to the embodiments of this application can be at least partially implemented as hardware circuits, such as field-programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems-on-a-chip, systems-on-a-substrate, systems-on-package, application-specific integrated circuits (ASICs), or implemented by hardware or firmware in any other reasonable manner by integrating or packaging circuits, or implemented in any one of software, hardware, and firmware, or in a suitable combination of any of these. Alternatively, one or more of the modules, submodules, and units according to the embodiments of this application can be at least partially implemented as computer program modules, which, when run, can perform corresponding functions.
[0206] For example, any plurality of the snapshot acquisition module 1401 and the first address identifier writing module 1402 can be combined into one module / submodule / unit, or any one of the modules / submodules / units can be split into multiple modules / submodules / units. Alternatively, at least part of the functionality of one or more of these modules / submodules / units can be combined with at least part of the functionality of other modules / submodules / units and implemented in one module / submodule / unit. According to embodiments of this application, at least one of the snapshot acquisition module 1401 and the first address identifier writing module 1402 can be at least partially implemented as hardware circuitry, such as a field-programmable gate array (FPGA), a programmable logic array (PLA), a system-on-a-chip, a system-on-a-substrate, a system-on-package, an application-specific integrated circuit (ASIC), or any other reasonable means of integrating or packaging the circuitry, or implemented in software, hardware, or firmware, or in any one of the three implementation methods or a suitable combination of any of them. Alternatively, at least one of the snapshot acquisition module 1401 and the first address identifier writing module 1402 may be implemented at least partially as a computer program module, which can perform corresponding functions when the computer program module is run.
[0207] It should be noted that the volume snapshot difference query device part in the embodiments of this application corresponds to the volume snapshot difference query method part in the embodiments of this application. For a detailed description of the volume snapshot difference query device part, please refer to the volume snapshot difference query method part, which will not be repeated here.
[0208] Figure 15A block diagram of an electronic device suitable for implementing the volume snapshot difference query method described above, according to an embodiment of this application, is shown. Figure 15 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0209] like Figure 15 As shown, an electronic device according to an embodiment of this application includes a processor 1501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1502 or a program loaded from a storage portion 1508 into a random access memory (RAM) 1503. The processor 1501 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or an associated chipset and / or a special-purpose microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 1501 may also include onboard memory for caching purposes. The processor 1501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of this application.
[0210] RAM 1503 stores various programs and data required for the operation of the electronic device. Processor 1501, ROM 1502, and RAM 1503 are interconnected via bus 1504. Processor 1501 executes various operations of the method flow according to embodiments of this application by executing programs in ROM 1502 and / or RAM 1503. It should be noted that programs may also be stored in one or more memories other than ROM 1502 and RAM 1503. Processor 1501 may also execute various operations of the method flow according to embodiments of this application by executing programs stored in one or more memories.
[0211] According to embodiments of this application, the electronic device may further include an input / output (I / O) interface 1505, which is also connected to a bus 1504. The electronic device may also include one or more of the following components connected to the input / output (I / O) interface 1505: an input section 1506 including a keyboard, mouse, etc.; an output section 1507 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1508 including a hard disk, etc.; and a communication section 1509 including a network interface card such as a LAN card, modem, etc. The communication section 1509 performs communication processing via a network such as the Internet. A drive 1510 is also connected to the input / output (I / O) interface 1505 as needed. A removable medium 1511, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 1510 as needed so that computer programs read from it can be installed into the storage section 1508 as needed.
[0212] According to embodiments of this application, the method flow according to embodiments of this application can be implemented as a computer software program. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable storage medium, the computer program containing program code for performing the methods shown in the flowchart. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1509, and / or installed from removable medium 1511. When the computer program is executed by processor 1501, it performs the functions defined in the system of embodiments of this application. According to embodiments of this application, the systems, devices, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0213] This application also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or it may exist independently and not assembled into the device / apparatus / system. The computer-readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of this application.
[0214] According to embodiments of this application, the computer-readable storage medium can be a non-volatile computer-readable storage medium. Examples include, but are not limited to: portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this application, the computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0215] For example, according to embodiments of this application, a computer-readable storage medium may include the ROM 1502 and / or RAM 1503 described above and / or one or more memories other than ROM 1502 and RAM 1503.
[0216] Embodiments of this application also include a computer program product comprising a computer program containing program code for performing the methods provided in the embodiments of this application. When the computer program product is run on an electronic device, the program code is used to enable the electronic device to implement the volume snapshot difference query method provided in the embodiments of this application.
[0217] When the computer program is executed by the processor 1501, it performs the functions defined in the system / apparatus of this application embodiment. According to the embodiments of this application, the systems, apparatuses, modules, units, etc., described above can be implemented by computer program modules.
[0218] In one embodiment, the computer program may rely on a tangible storage medium such as an optical storage device or a magnetic storage device. In another embodiment, the computer program may also be transmitted and distributed in the form of signals over a network medium, and may be downloaded and installed via the communication section 1509, and / or installed from the removable medium 1511. The program code contained in the computer program can be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination thereof.
[0219] According to embodiments of this application, program code for executing the computer programs provided in the embodiments of this application can be written in any combination of one or more programming languages. Specifically, these computational programs can be implemented using high-level procedural and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, languages such as Java, C++, Python, "C", or similar programming languages. The program code can be executed entirely on the user's computing device, partially on the user's device, partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0220] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. Those skilled in the art will understand that the features described in the various embodiments of this application can be combined and / or combined in various ways, even if such combinations are not explicitly described in this application. In particular, without departing from the spirit and teachings of this application, the features described in the various embodiments of this application can be combined and / or combined in various ways. All such combinations and / or combinations fall within the scope of this application.
[0221] The embodiments of this application have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of this application. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Without departing from the scope of this application, those skilled in the art can make various substitutions and modifications, all of which should fall within the scope of this application.
Claims
1. A method for querying volume snapshot differences, characterized in that, include: Obtain T snapshots of the volume space in the storage system. The t-th snapshot indicates the change information of the first data state in each storage area of the volume space at time t relative to the second data state in each storage area of the volume space at time t-1. T is an integer greater than 1, and t=1,...,T; For the t-th snapshot, if the number of logical block addresses written to the difference cache associated with the t-th snapshot meets a predetermined query condition, in response to the target address identifier indicating the end of the previous round of query, the storage region in the t-th snapshot of the current round whose data state has changed is queried, and the logical block address identifier of the storage region whose data state has changed is written to the difference cache, wherein the logical block address identifier written to the difference cache includes the target address identifier indicating the end of the current round of query.
2. The method according to claim 1, characterized in that, The predetermined query conditions are met if the number of logical block addresses written to the differential cache is less than a predetermined capacity threshold of the differential cache. The process of responding to the target address identifier at the end of the previous round of querying, starting from the target address identifier, querying the storage region in the t-th snapshot of the current round where the data state has changed, and writing the logical block address identifier of the storage region where the data state has changed into the difference cache, includes: In response to starting from the target address identifier at the end of the previous round of query, the storage area in the t-th snapshot of the current round where the data state has changed is queried, and the logical block address identifier of the storage area where the data state has changed is written into the difference cache, until the number of logical block address identifiers written into the difference cache is equal to the predetermined capacity threshold.
3. The method according to claim 2, characterized in that, The method further includes: In response to starting from the target address identifier where the previous round of query ended, the storage region in the t-th snapshot of the current round where the data state has changed is queried, and the logical block address identifier of the storage region where the data state has changed is written into the differential cache, until the termination address of the volume space is queried.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: If the number of logical block addresses written to the differential cache associated with the t-th snapshot is greater than zero and less than the predetermined capacity threshold of the differential cache, the operation of querying the storage area in the t-th snapshot whose data state has changed, starting from the target address identifier at the end of the previous round of query, will not be performed.
5. The method according to claim 1, characterized in that, The method further includes: Based on the target logical block address identifier, candidate logical block address identifiers whose logical block address identifiers are less than or equal to the target logical block address identifier are read from the difference cache associated with each snapshot, wherein the target logical block address identifier is the smallest address identifier among the target address identifiers that have ended the current round of query corresponding to each of the T snapshots; Sort the candidate logical block address identifiers in the T difference caches to obtain the address sequence of the data to be read.
6. The method according to claim 5, characterized in that, The step of sorting the candidate logical block address identifiers in the T difference caches to obtain the address sequence of the data to be read includes: Extract the target candidate logical block address identifier from the candidate logical block address identifiers in the T differential caches and sort them. Take the target candidate logical block address identifier at the top as the dequeue element. The dequeue element is used to read data from the target storage area of the volume space. The target candidate logical block address identifier represents the smallest candidate logical block address identifier in each differential cache. From the remaining candidate logical block address identifiers in the T difference caches, the smallest candidate logical block address identifier that belongs to the same difference cache as the dequeued element is taken as the enqueued element to obtain the address sequence of the data to be read.
7. The method according to claim 6, characterized in that, The step of selecting the target candidate logical block address identifier from the candidate logical block address identifiers in the T difference caches and sorting them includes: The target candidate logical block address identifier selected from the candidate logical block address identifiers associated with the T snapshots is used as a queue element of the priority queue. The queue element in the priority queue consists of the target candidate logical block address identifier and the hierarchy identifier of the differential cache written to the target candidate logical block address identifier. The queue elements of the priority queue are sorted according to the target candidate logical block address identifier and the hierarchy identifier of the differential cache written to the target candidate logical block address identifier.
8. The method according to claim 6, characterized in that, The step of selecting the smallest candidate logical block address from the remaining candidate logical block address identifiers in the T difference caches that belongs to the same difference cache as the dequeued element as the enqueued element includes: Based on the dequeue element, determine the difference cache associated with the dequeue element from the T difference caches; If the candidate logical block identifier exists in the difference cache associated with the dequeued element, the smallest candidate logical block address identifier belonging to the same difference cache as the dequeued element is taken as the target candidate logical block address identifier, and the target candidate logical block address identifier is added to the tail of the queue as an enqueued element.
9. The method according to claim 1, characterized in that, The method further includes: If the logical block address identifiers of the storage regions whose data state has changed in the t-th snapshot are consecutive, write the logical block address identifiers of the storage regions whose data state has changed in the t-th snapshots to the difference cache associated with each of the t-th snapshots, and terminate the query operation for all snapshots after the t-th snapshot, 1 < t ≤ T.
10. An electronic device, comprising: One or more processors; Memory, used to store one or more programs. Wherein, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of any one of claims 1 to 9.